From 4f35532dbe645f4a349ea63951d659334359abd9 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Mon, 9 Nov 2015 16:45:17 +0000 Subject: 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 --- clang/lib/AST/Decl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/lib/AST/Decl.cpp') 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(*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(*I); } -- cgit v1.2.3