[cfe-commits] r103812 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Parser/cxx-undeclared-identifier.cpp

Fariborz Jahanian fjahanian at apple.com
Fri May 14 14:35:02 PDT 2010


Author: fjahanian
Date: Fri May 14 16:35:02 2010
New Revision: 103812

URL: http://llvm.org/viewvc/llvm-project?rev=103812&view=rev
Log:
Patch to fix a crash on incomplete class declaration.
Radar 7923673.

Added:
    cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp
Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=103812&r1=103811&r2=103812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri May 14 16:35:02 2010
@@ -5329,9 +5329,13 @@
 
   // Maybe add qualifier info.
   if (SS.isNotEmpty()) {
-    NestedNameSpecifier *NNS
-      = static_cast<NestedNameSpecifier*>(SS.getScopeRep());
-    New->setQualifierInfo(NNS, SS.getRange());
+    if (SS.isSet()) {
+      NestedNameSpecifier *NNS
+        = static_cast<NestedNameSpecifier*>(SS.getScopeRep());
+      New->setQualifierInfo(NNS, SS.getRange());
+    }
+    else
+      Invalid = true;
   }
 
   if (Kind != TTK_Enum) {

Added: cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp?rev=103812&view=auto
==============================================================================
--- cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp (added)
+++ cfe/trunk/test/Parser/cxx-undeclared-identifier.cpp Fri May 14 16:35:02 2010
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \
+                 // expected-note {{to match this '{'}} \
+                 // expected-error {{expected ';' after class}}
+                 // expected-error {{expected '}'}}





More information about the cfe-commits mailing list