[cfe-commits] r166617 - in /cfe/trunk: lib/AST/TypePrinter.cpp test/SemaCXX/ast-print.cpp

Eli Friedman eli.friedman at gmail.com
Wed Oct 24 13:21:25 PDT 2012


Author: efriedma
Date: Wed Oct 24 15:21:25 2012
New Revision: 166617

URL: http://llvm.org/viewvc/llvm-project?rev=166617&view=rev
Log:
Don't print scope qualifiers for references to a type defined locally in a function.  Patch by Grzegorz Jablonski.


Modified:
    cfe/trunk/lib/AST/TypePrinter.cpp
    cfe/trunk/test/SemaCXX/ast-print.cpp

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=166617&r1=166616&r2=166617&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Wed Oct 24 15:21:25 2012
@@ -799,6 +799,7 @@
 /// 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)) {

Modified: cfe/trunk/test/SemaCXX/ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ast-print.cpp?rev=166617&r1=166616&r2=166617&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/ast-print.cpp Wed Oct 24 15:21:25 2012
@@ -64,3 +64,20 @@
 // 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;
+    }
+};





More information about the cfe-commits mailing list