Don't print scope qualifiers for references to a type defined locally in a function...
authorEli Friedman <eli.friedman@gmail.com>
Wed, 24 Oct 2012 20:21:25 +0000 (20:21 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 24 Oct 2012 20:21:25 +0000 (20:21 +0000)
llvm-svn: 166617

clang/lib/AST/TypePrinter.cpp
clang/test/SemaCXX/ast-print.cpp

index 4cf4b18..90b2ca9 100644 (file)
@@ -799,6 +799,7 @@ void TypePrinter::printAtomicAfter(const AtomicType *T, raw_ostream &OS) { }
 /// Appends the given scope to the end of a string.
 void TypePrinter::AppendScope(DeclContext *DC, raw_ostream &OS) {
   if (DC->isTranslationUnit()) return;
+  if (DC->isFunctionOrMethod()) return;
   AppendScope(DC->getParent(), OS);
 
   if (NamespaceDecl *NS = dyn_cast<NamespaceDecl>(DC)) {
index 0dad623..aeb4039 100644 (file)
@@ -64,3 +64,20 @@ template <class S> void test7()
 // CHECK: t.~T();
 
 template <typename T> void test8(T t) { t.~T(); }
+
+
+// CHECK:      enum E {
+// CHECK-NEXT:  A,
+// CHECK-NEXT:  B,
+// CHECK-NEXT:  C
+// CHECK-NEXT:  };
+// CHECK-NEXT: {{^[ ]+}}E a = A;
+
+struct test9
+{
+    void f()
+    {
+        enum E { A, B, C };
+        E a = A;
+    }
+};