diff options
author | Alexander Kornienko <alexfh@google.com> | 2015-11-09 16:45:17 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2015-11-09 16:45:17 +0000 |
commit | 4f35532dbe645f4a349ea63951d659334359abd9 (patch) | |
tree | 0d902c5247183a6f51bfe21aa6514f8cc10cc29e /clang/lib/AST/Decl.cpp | |
parent | 3f5dfc256204b4f4825fbfbfc7c9f985f4e78422 (diff) | |
download | bcm5719-llvm-4f35532dbe645f4a349ea63951d659334359abd9.tar.gz bcm5719-llvm-4f35532dbe645f4a349ea63951d659334359abd9.zip |
Adjust printQualifiedName to handle unscoped enums in a way similar to anonymous namespaces.
Patch by Sterling Augustine!
Differential revision: http://reviews.llvm.org/D14459
llvm-svn: 252488
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 7485b12614d..85724878fd4 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -1430,6 +1430,15 @@ void NamedDecl::printQualifiedName(raw_ostream &OS, } } OS << ')'; + } else if (const EnumDecl *ED = dyn_cast<EnumDecl>(*I)) { + // C++ [dcl.enum]p10: Each enum-name and each unscoped + // enumerator is declared in the scope that immediately contains + // the enum-specifier. Each scoped enumerator is declared in the + // scope of the enumeration. + if (ED->isScoped() || ED->getIdentifier()) + OS << *ED; + else + continue; } else { OS << *cast<NamedDecl>(*I); } |