summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorKaelyn Takata <rikka@google.com>2014-06-11 18:07:08 +0000
committerKaelyn Takata <rikka@google.com>2014-06-11 18:07:08 +0000
commit7dcc0e6f5708f811c61473a233c8cbf48e897d41 (patch)
tree59232fb5aa4f0c39aac7575ae27997d62e28b838 /clang/lib/Sema/SemaLookup.cpp
parenta5bdbc840c27fe81c4dc92b580ecb53c3fd2ae2f (diff)
downloadbcm5719-llvm-7dcc0e6f5708f811c61473a233c8cbf48e897d41.tar.gz
bcm5719-llvm-7dcc0e6f5708f811c61473a233c8cbf48e897d41.zip
Sink SpecifierInfo into the only class that uses it.
SpecifierInfo is not used outside of NamespaceSpecifierSet except indirectly through NamespaceSpecifierSet's iterator, so clean up the code a bit by moving SpecifierInfo into NamespaceSpecifierSet. Also drop SpecifierInfo's trivial yet verbose constructor since brace initiialization is sufficient in the only two places the constructor was being explicitly called. No functionality changed. llvm-svn: 210672
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 47e5f6f66cd..d0bd01e6da8 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -3374,20 +3374,16 @@ public:
TypoCorrection getNextCorrection();
private:
- class SpecifierInfo {
- public:
- DeclContext* DeclCtx;
- NestedNameSpecifier* NameSpecifier;
- unsigned EditDistance;
-
- SpecifierInfo(DeclContext *Ctx, NestedNameSpecifier *NNS, unsigned ED)
- : DeclCtx(Ctx), NameSpecifier(NNS), EditDistance(ED) {}
- };
+ class NamespaceSpecifierSet {
+ struct SpecifierInfo {
+ DeclContext* DeclCtx;
+ NestedNameSpecifier* NameSpecifier;
+ unsigned EditDistance;
+ };
- typedef SmallVector<DeclContext*, 4> DeclContextList;
- typedef SmallVector<SpecifierInfo, 16> SpecifierInfoList;
+ typedef SmallVector<DeclContext*, 4> DeclContextList;
+ typedef SmallVector<SpecifierInfo, 16> SpecifierInfoList;
- class NamespaceSpecifierSet {
ASTContext &Context;
DeclContextList CurContextChain;
std::string CurNameSpecifier;
@@ -3433,8 +3429,8 @@ private:
// Add the global context as a NestedNameSpecifier
Distances.insert(1);
DistanceMap[1].push_back(
- SpecifierInfo(cast<DeclContext>(Context.getTranslationUnitDecl()),
- NestedNameSpecifier::GlobalSpecifier(Context), 1));
+ {cast<DeclContext>(Context.getTranslationUnitDecl()),
+ NestedNameSpecifier::GlobalSpecifier(Context), 1});
}
/// \brief Add the DeclContext (a namespace or record) to the set, computing
@@ -3747,9 +3743,8 @@ void TypoCorrectionConsumer::performQualifiedLookups() {
QualifiedResults.clear();
}
-TypoCorrectionConsumer::DeclContextList
-TypoCorrectionConsumer::NamespaceSpecifierSet::buildContextChain(
- DeclContext *Start) {
+auto TypoCorrectionConsumer::NamespaceSpecifierSet::buildContextChain(
+ DeclContext *Start) -> DeclContextList {
assert(Start && "Building a context chain from a null context");
DeclContextList Chain;
for (DeclContext *DC = Start->getPrimaryContext(); DC != nullptr;
@@ -3862,7 +3857,7 @@ void TypoCorrectionConsumer::NamespaceSpecifierSet::addNameSpecifier(
isSorted = false;
Distances.insert(NumSpecifiers);
- DistanceMap[NumSpecifiers].push_back(SpecifierInfo(Ctx, NNS, NumSpecifiers));
+ DistanceMap[NumSpecifiers].push_back({Ctx, NNS, NumSpecifiers});
}
/// \brief Perform name lookup for a possible result for typo correction.
OpenPOWER on IntegriCloud