summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-10-15 17:37:55 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-10-15 17:37:55 +0000
commitca5c7be08883558ca71eae1f7d17ec1848bca44c (patch)
tree1f735a19524e67ec04769af4bfbbf83086a268d1 /clang/lib/Frontend
parentdaf483186888965341ce5636ff9090115c48ef35 (diff)
downloadbcm5719-llvm-ca5c7be08883558ca71eae1f7d17ec1848bca44c.tar.gz
bcm5719-llvm-ca5c7be08883558ca71eae1f7d17ec1848bca44c.zip
[libclang] For an unscoped enum include the enumerators in the top-level code-completion hash since they enter the top-level namespace.
rdar://14703327 llvm-svn: 192720
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index e2641ccec4a..610c20d9fb1 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -877,6 +877,18 @@ void AddTopLevelDeclarationToHash(Decl *D, unsigned &Hash) {
return;
if (NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
+ if (EnumDecl *EnumD = dyn_cast<EnumDecl>(D)) {
+ // For an unscoped enum include the enumerators in the hash since they
+ // enter the top-level namespace.
+ if (!EnumD->isScoped()) {
+ for (EnumDecl::enumerator_iterator EI = EnumD->enumerator_begin(),
+ EE = EnumD->enumerator_end(); EI != EE; ++EI) {
+ if ((*EI)->getIdentifier())
+ Hash = llvm::HashString((*EI)->getIdentifier()->getName(), Hash);
+ }
+ }
+ }
+
if (ND->getIdentifier())
Hash = llvm::HashString(ND->getIdentifier()->getName(), Hash);
else if (DeclarationName Name = ND->getDeclName()) {
OpenPOWER on IntegriCloud