aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ARCMigrate
diff options
context:
space:
mode:
authorMikhail Maltsev <mikhail.maltsev@arm.com>2020-10-19 18:30:51 +0100
committerMikhail Maltsev <mikhail.maltsev@arm.com>2020-10-19 18:31:05 +0100
commita3c16039b3f119cd83d872f256c45599ae6ac60c (patch)
treeac12871e6c4e033fe750364594e2c3029b5492ea /clang/lib/ARCMigrate
parent3cbdae22b91b94d21c0ca348e5ceea7081c9887d (diff)
downloadllvm-a3c16039b3f119cd83d872f256c45599ae6ac60c.zip
llvm-a3c16039b3f119cd83d872f256c45599ae6ac60c.tar.gz
llvm-a3c16039b3f119cd83d872f256c45599ae6ac60c.tar.bz2
[clang] Use SourceLocation as key in std::map, NFCI
SourceLocation implements `operator<`, so `SourceLocation`-s can be used as keys in `std::map` directly, there is no need to extract the internal representation. Since the `operator<` simply compares the internal representations of its operands, this patch does not introduce any functional changes. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D89705
Diffstat (limited to 'clang/lib/ARCMigrate')
-rw-r--r--clang/lib/ARCMigrate/TransProperties.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp
index cba2256..db0e6ac 100644
--- a/clang/lib/ARCMigrate/TransProperties.cpp
+++ b/clang/lib/ARCMigrate/TransProperties.cpp
@@ -65,7 +65,7 @@ class PropertiesRewriter {
};
typedef SmallVector<PropData, 2> PropsTy;
- typedef std::map<unsigned, PropsTy> AtPropDeclsTy;
+ typedef std::map<SourceLocation, PropsTy> AtPropDeclsTy;
AtPropDeclsTy AtProps;
llvm::DenseMap<IdentifierInfo *, PropActionKind> ActionOnProp;
@@ -76,13 +76,13 @@ public:
static void collectProperties(ObjCContainerDecl *D, AtPropDeclsTy &AtProps,
AtPropDeclsTy *PrevAtProps = nullptr) {
for (auto *Prop : D->instance_properties()) {
- if (Prop->getAtLoc().isInvalid())
+ SourceLocation Loc = Prop->getAtLoc();
+ if (Loc.isInvalid())
continue;
- unsigned RawLoc = Prop->getAtLoc().getRawEncoding();
if (PrevAtProps)
- if (PrevAtProps->find(RawLoc) != PrevAtProps->end())
+ if (PrevAtProps->find(Loc) != PrevAtProps->end())
continue;
- PropsTy &props = AtProps[RawLoc];
+ PropsTy &props = AtProps[Loc];
props.push_back(Prop);
}
}
@@ -113,8 +113,7 @@ public:
ObjCIvarDecl *ivarD = implD->getPropertyIvarDecl();
if (!ivarD || ivarD->isInvalidDecl())
continue;
- unsigned rawAtLoc = propD->getAtLoc().getRawEncoding();
- AtPropDeclsTy::iterator findAtLoc = AtProps.find(rawAtLoc);
+ AtPropDeclsTy::iterator findAtLoc = AtProps.find(propD->getAtLoc());
if (findAtLoc == AtProps.end())
continue;
@@ -130,7 +129,7 @@ public:
for (AtPropDeclsTy::iterator
I = AtProps.begin(), E = AtProps.end(); I != E; ++I) {
- SourceLocation atLoc = SourceLocation::getFromRawEncoding(I->first);
+ SourceLocation atLoc = I->first;
PropsTy &props = I->second;
if (!getPropertyType(props)->isObjCRetainableType())
continue;