[cfe-commits] r65708 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Parser/control-scope.c

Chris Lattner sabre at nondot.org
Sat Feb 28 11:37:57 PST 2009


Author: lattner
Date: Sat Feb 28 13:37:57 2009
New Revision: 65708

URL: http://llvm.org/viewvc/llvm-project?rev=65708&view=rev
Log:
Fix a crash in test/Parser/control-scope.c that testrunner didn't
notice because it was a negative test with a fix suggested by
Jean-Daniel Dupas.  Convert the test from a negative to a positive
test to catch stuff like this.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Parser/control-scope.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=65708&r1=65707&r2=65708&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Feb 28 13:37:57 2009
@@ -3497,7 +3497,7 @@
       else
         Diag(IdLoc, diag::err_redefinition) << Id;
       Diag(PrevDecl->getLocation(), diag::note_previous_definition);
-      Val->Destroy(Context);
+      if (Val) Val->Destroy(Context);
       return 0;
     }
   }

Modified: cfe/trunk/test/Parser/control-scope.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/control-scope.c?rev=65708&r1=65707&r2=65708&view=diff

==============================================================================
--- cfe/trunk/test/Parser/control-scope.c (original)
+++ cfe/trunk/test/Parser/control-scope.c Sat Feb 28 13:37:57 2009
@@ -1,8 +1,8 @@
-// RUN: not clang %s -std=c90 &&
+// RUN: clang %s -std=c90 -verify &&
 // RUN: clang %s -std=c99
 
 int f (int z) { 
-  if (z + sizeof (enum {a})) 
-    return 1 + sizeof (enum {a}); 
+  if (z + sizeof (enum {a}))        // expected-note {{previous definition is here}}
+    return 1 + sizeof (enum {a});   // expected-error {{redefinition of enumerator 'a'}}
   return 0; 
 }





More information about the cfe-commits mailing list