[cfe-commits] r128210 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/goto.cpp

Douglas Gregor dgregor at apple.com
Thu Mar 24 07:35:16 PDT 2011


Author: dgregor
Date: Thu Mar 24 09:35:16 2011
New Revision: 128210

URL: http://llvm.org/viewvc/llvm-project?rev=128210&view=rev
Log:
Minor fix in the injection of labels, since we want to look at the redeclaration context of each declaration in the identifier chain. Should fix Linux self-host

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/goto.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=128210&r1=128209&r2=128210&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Mar 24 09:35:16 2011
@@ -500,7 +500,7 @@
     // isn't strictly lexical, which breaks name lookup. Be careful to insert
     // the label at the appropriate place in the identifier chain.
     for (I = IdResolver.begin(D->getDeclName()); I != IEnd; ++I) {
-      DeclContext *IDC = (*I)->getLexicalDeclContext();
+      DeclContext *IDC = (*I)->getLexicalDeclContext()->getRedeclContext();
       if (IDC == CurContext) {
         if (!S->isDeclScope(*I))
           continue;

Modified: cfe/trunk/test/SemaCXX/goto.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/goto.cpp?rev=128210&r1=128209&r2=128210&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/goto.cpp (original)
+++ cfe/trunk/test/SemaCXX/goto.cpp Thu Mar 24 09:35:16 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall -fblocks %s
 
 // PR9463
 double *end;
@@ -57,7 +57,7 @@
   end:
     ::end = 0;
   }
- end:
+ end: // expected-warning{{unused label 'end'}}
   end = 1;
 }
 
@@ -92,4 +92,14 @@
   }
 }
 
+extern "C" {
+  void exit(int);
+}
 
+void f() {
+  {
+    goto exit;
+  }
+ exit:
+  return;
+}





More information about the cfe-commits mailing list