aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Edit/EditedSource.h2
-rw-r--r--clang/include/clang/Sema/Sema.h2
-rw-r--r--clang/include/clang/Tooling/Syntax/Tokens.h2
-rw-r--r--clang/lib/ARCMigrate/TransGCAttrs.cpp22
-rw-r--r--clang/lib/ARCMigrate/TransProperties.cpp2
-rw-r--r--clang/lib/ARCMigrate/Transforms.h6
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.h2
-rw-r--r--clang/lib/Edit/EditedSource.cpp4
-rw-r--r--clang/lib/Tooling/Syntax/BuildTree.cpp7
-rw-r--r--clang/lib/Tooling/Syntax/Tokens.cpp10
10 files changed, 28 insertions, 31 deletions
diff --git a/clang/include/clang/Edit/EditedSource.h b/clang/include/clang/Edit/EditedSource.h
index 60072f6..ab76b0d 100644
--- a/clang/include/clang/Edit/EditedSource.h
+++ b/clang/include/clang/Edit/EditedSource.h
@@ -62,7 +62,7 @@ class EditedSource {
}
};
- llvm::DenseMap<unsigned, SmallVector<MacroArgUse, 2>> ExpansionToArgMap;
+ llvm::DenseMap<SourceLocation, SmallVector<MacroArgUse, 2>> ExpansionToArgMap;
SmallVector<std::pair<SourceLocation, MacroArgUse>, 2>
CurrCommitMacroArgExps;
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 2d08b0e..7ced3d9 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -12768,7 +12768,7 @@ template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> {
static unsigned getHashValue(const FunctionDeclAndLoc &FDL) {
return hash_combine(FDBaseInfo::getHashValue(FDL.FD),
- FDL.Loc.getRawEncoding());
+ FDL.Loc.getHashValue());
}
static bool isEqual(const FunctionDeclAndLoc &LHS,
diff --git a/clang/include/clang/Tooling/Syntax/Tokens.h b/clang/include/clang/Tooling/Syntax/Tokens.h
index 6e253ab..98320bd 100644
--- a/clang/include/clang/Tooling/Syntax/Tokens.h
+++ b/clang/include/clang/Tooling/Syntax/Tokens.h
@@ -438,7 +438,7 @@ private:
/// the stack) and not when they end (when we pop a macro from the stack).
/// To workaround this limitation, we rely on source location information
/// stored in this map.
- using PPExpansions = llvm::DenseMap</*SourceLocation*/ int, SourceLocation>;
+ using PPExpansions = llvm::DenseMap<SourceLocation, SourceLocation>;
class Builder;
class CollectPPExpansions;
diff --git a/clang/lib/ARCMigrate/TransGCAttrs.cpp b/clang/lib/ARCMigrate/TransGCAttrs.cpp
index 8f5f3cf..99a61e0 100644
--- a/clang/lib/ARCMigrate/TransGCAttrs.cpp
+++ b/clang/lib/ARCMigrate/TransGCAttrs.cpp
@@ -88,8 +88,8 @@ public:
return false;
SourceLocation Loc = OwnershipAttr->getLocation();
- unsigned RawLoc = Loc.getRawEncoding();
- if (MigrateCtx.AttrSet.count(RawLoc))
+ SourceLocation OrigLoc = Loc;
+ if (MigrateCtx.AttrSet.count(OrigLoc))
return true;
ASTContext &Ctx = MigrateCtx.Pass.Ctx;
@@ -105,7 +105,7 @@ public:
else
return false;
- MigrateCtx.AttrSet.insert(RawLoc);
+ MigrateCtx.AttrSet.insert(OrigLoc);
MigrateCtx.GCAttrs.push_back(MigrationContext::GCAttrOccurrence());
MigrationContext::GCAttrOccurrence &Attr = MigrateCtx.GCAttrs.back();
@@ -204,7 +204,7 @@ static void checkWeakGCAttrs(MigrationContext &MigrateCtx) {
if (!canApplyWeak(MigrateCtx.Pass.Ctx, Attr.ModifiedType,
/*AllowOnUnknownClass=*/true)) {
Transaction Trans(TA);
- if (!MigrateCtx.RemovedAttrSet.count(Attr.Loc.getRawEncoding()))
+ if (!MigrateCtx.RemovedAttrSet.count(Attr.Loc))
TA.replaceText(Attr.Loc, "__weak", "__unsafe_unretained");
TA.clearDiagnostic(diag::err_arc_weak_no_runtime,
diag::err_arc_unsupported_weak_class,
@@ -262,7 +262,7 @@ static void checkAllAtProps(MigrationContext &MigrateCtx,
if (GCAttrsCollector::hasObjCImpl(
cast<Decl>(IndProps.front()->getDeclContext()))) {
if (hasWeak)
- MigrateCtx.AtPropsWeak.insert(AtLoc.getRawEncoding());
+ MigrateCtx.AtPropsWeak.insert(AtLoc);
} else {
StringRef toAttr = "strong";
@@ -289,14 +289,14 @@ static void checkAllAtProps(MigrationContext &MigrateCtx,
TA.clearDiagnostic(diag::err_objc_property_attr_mutually_exclusive, AtLoc);
TA.clearDiagnostic(diag::err_arc_inconsistent_property_ownership,
ATLs[i].second->getLocation());
- MigrateCtx.RemovedAttrSet.insert(Loc.getRawEncoding());
+ MigrateCtx.RemovedAttrSet.insert(Loc);
}
}
static void checkAllProps(MigrationContext &MigrateCtx,
std::vector<ObjCPropertyDecl *> &AllProps) {
typedef llvm::TinyPtrVector<ObjCPropertyDecl *> IndivPropsTy;
- llvm::DenseMap<unsigned, IndivPropsTy> AtProps;
+ llvm::DenseMap<SourceLocation, IndivPropsTy> AtProps;
for (unsigned i = 0, e = AllProps.size(); i != e; ++i) {
ObjCPropertyDecl *PD = AllProps[i];
@@ -306,14 +306,12 @@ static void checkAllProps(MigrationContext &MigrateCtx,
SourceLocation AtLoc = PD->getAtLoc();
if (AtLoc.isInvalid())
continue;
- unsigned RawAt = AtLoc.getRawEncoding();
- AtProps[RawAt].push_back(PD);
+ AtProps[AtLoc].push_back(PD);
}
}
- for (llvm::DenseMap<unsigned, IndivPropsTy>::iterator
- I = AtProps.begin(), E = AtProps.end(); I != E; ++I) {
- SourceLocation AtLoc = SourceLocation::getFromRawEncoding(I->first);
+ for (auto I = AtProps.begin(), E = AtProps.end(); I != E; ++I) {
+ SourceLocation AtLoc = I->first;
IndivPropsTy &IndProps = I->second;
checkAllAtProps(MigrateCtx, AtLoc, IndProps);
}
diff --git a/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp
index db0e6ac..e5ccf1c 100644
--- a/clang/lib/ARCMigrate/TransProperties.cpp
+++ b/clang/lib/ARCMigrate/TransProperties.cpp
@@ -337,7 +337,7 @@ private:
return false;
if (props.empty())
return false;
- return MigrateCtx.AtPropsWeak.count(atLoc.getRawEncoding());
+ return MigrateCtx.AtPropsWeak.count(atLoc);
}
bool isUserDeclared(ObjCIvarDecl *ivarD) const {
diff --git a/clang/lib/ARCMigrate/Transforms.h b/clang/lib/ARCMigrate/Transforms.h
index e087136..37e2d6b 100644
--- a/clang/lib/ARCMigrate/Transforms.h
+++ b/clang/lib/ARCMigrate/Transforms.h
@@ -93,12 +93,12 @@ public:
bool FullyMigratable;
};
std::vector<GCAttrOccurrence> GCAttrs;
- llvm::DenseSet<unsigned> AttrSet;
- llvm::DenseSet<unsigned> RemovedAttrSet;
+ llvm::DenseSet<SourceLocation> AttrSet;
+ llvm::DenseSet<SourceLocation> RemovedAttrSet;
/// Set of raw '@' locations for 'assign' properties group that contain
/// GC __weak.
- llvm::DenseSet<unsigned> AtPropsWeak;
+ llvm::DenseSet<SourceLocation> AtPropsWeak;
explicit MigrationContext(MigrationPass &pass) : Pass(pass) {}
~MigrationContext();
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index e39c2e1..d67034c 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -391,7 +391,7 @@ protected:
private:
/// Map for SourceLocation and OpenMP runtime library debug locations.
- typedef llvm::DenseMap<unsigned, llvm::Value *> OpenMPDebugLocMapTy;
+ typedef llvm::DenseMap<SourceLocation, llvm::Value *> OpenMPDebugLocMapTy;
OpenMPDebugLocMapTy OpenMPDebugLocMap;
/// The type for a microtask which gets passed to __kmpc_fork_call().
/// Original representation is:
diff --git a/clang/lib/Edit/EditedSource.cpp b/clang/lib/Edit/EditedSource.cpp
index b3bc63a..74e6005 100644
--- a/clang/lib/Edit/EditedSource.cpp
+++ b/clang/lib/Edit/EditedSource.cpp
@@ -59,7 +59,7 @@ void EditedSource::finishedCommit() {
SourceLocation ExpLoc;
MacroArgUse ArgUse;
std::tie(ExpLoc, ArgUse) = ExpArg;
- auto &ArgUses = ExpansionToArgMap[ExpLoc.getRawEncoding()];
+ auto &ArgUses = ExpansionToArgMap[ExpLoc];
if (llvm::find(ArgUses, ArgUse) == ArgUses.end())
ArgUses.push_back(ArgUse);
}
@@ -82,7 +82,7 @@ bool EditedSource::canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs) {
SourceLocation ExpLoc;
MacroArgUse ArgUse;
deconstructMacroArgLoc(OrigLoc, ExpLoc, ArgUse);
- auto I = ExpansionToArgMap.find(ExpLoc.getRawEncoding());
+ auto I = ExpansionToArgMap.find(ExpLoc);
if (I != ExpansionToArgMap.end() &&
find_if(I->second, [&](const MacroArgUse &U) {
return ArgUse.Identifier == U.Identifier &&
diff --git a/clang/lib/Tooling/Syntax/BuildTree.cpp b/clang/lib/Tooling/Syntax/BuildTree.cpp
index e1ed55f..1975905 100644
--- a/clang/lib/Tooling/Syntax/BuildTree.cpp
+++ b/clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -367,7 +367,7 @@ class syntax::TreeBuilder {
public:
TreeBuilder(syntax::Arena &Arena) : Arena(Arena), Pending(Arena) {
for (const auto &T : Arena.getTokenBuffer().expandedTokens())
- LocationToToken.insert({T.location().getRawEncoding(), &T});
+ LocationToToken.insert({T.location(), &T});
}
llvm::BumpPtrAllocator &allocator() { return Arena.getAllocator(); }
@@ -689,8 +689,7 @@ private:
syntax::Arena &Arena;
/// To quickly find tokens by their start location.
- llvm::DenseMap</*SourceLocation*/ unsigned, const syntax::Token *>
- LocationToToken;
+ llvm::DenseMap<SourceLocation, const syntax::Token *> LocationToToken;
Forest Pending;
llvm::DenseSet<Decl *> DeclsWithoutSemicolons;
ASTToSyntaxMapping Mapping;
@@ -1708,7 +1707,7 @@ void syntax::TreeBuilder::markExprChild(Expr *Child, NodeRole Role) {
const syntax::Token *syntax::TreeBuilder::findToken(SourceLocation L) const {
if (L.isInvalid())
return nullptr;
- auto It = LocationToToken.find(L.getRawEncoding());
+ auto It = LocationToToken.find(L);
assert(It != LocationToToken.end());
return It->second;
}
diff --git a/clang/lib/Tooling/Syntax/Tokens.cpp b/clang/lib/Tooling/Syntax/Tokens.cpp
index a83cc2d..234df9c 100644
--- a/clang/lib/Tooling/Syntax/Tokens.cpp
+++ b/clang/lib/Tooling/Syntax/Tokens.cpp
@@ -575,11 +575,11 @@ public:
// A's startpoint.
if (!Range.getBegin().isFileID()) {
Range.setBegin(SM.getExpansionLoc(Range.getBegin()));
- assert(Collector->Expansions.count(Range.getBegin().getRawEncoding()) &&
+ assert(Collector->Expansions.count(Range.getBegin()) &&
"Overlapping macros should have same expansion location");
}
- Collector->Expansions[Range.getBegin().getRawEncoding()] = Range.getEnd();
+ Collector->Expansions[Range.getBegin()] = Range.getEnd();
LastExpansionEnd = Range.getEnd();
}
// FIXME: handle directives like #pragma, #include, etc.
@@ -711,8 +711,8 @@ private:
// If we know mapping bounds at [NextSpelled, KnownEnd] (macro expansion)
// then we want to partition our (empty) mapping.
// [Start, NextSpelled) [NextSpelled, KnownEnd] (KnownEnd, Target)
- SourceLocation KnownEnd = CollectedExpansions.lookup(
- SpelledTokens[NextSpelled].location().getRawEncoding());
+ SourceLocation KnownEnd =
+ CollectedExpansions.lookup(SpelledTokens[NextSpelled].location());
if (KnownEnd.isValid()) {
FlushMapping(); // Emits [Start, NextSpelled)
while (NextSpelled < SpelledTokens.size() &&
@@ -749,7 +749,7 @@ private:
// We need no mapping for file tokens copied to the expanded stream.
} else {
// We found a new macro expansion. We should have its spelling bounds.
- auto End = CollectedExpansions.lookup(Expansion.getRawEncoding());
+ auto End = CollectedExpansions.lookup(Expansion);
assert(End.isValid() && "Macro expansion wasn't captured?");
// Mapping starts here...