[cfe-commits] r155836 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaObjCXX/crash.mm
Douglas Gregor
dgregor at apple.com
Mon Apr 30 11:13:01 PDT 2012
Author: dgregor
Date: Mon Apr 30 13:13:01 2012
New Revision: 155836
URL: http://llvm.org/viewvc/llvm-project?rev=155836&view=rev
Log:
HandleDeclarator() returns NULL for semantic disasters. Deal with it
when we're in an Objective-C container context. Fixes
<rdar://problem/11286701>.
Added:
cfe/trunk/test/SemaObjCXX/crash.mm
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=155836&r1=155835&r2=155836&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Apr 30 13:13:01 2012
@@ -3233,7 +3233,7 @@
Decl *Dcl = HandleDeclarator(S, D, MultiTemplateParamsArg(*this));
if (OriginalLexicalContext && OriginalLexicalContext->isObjCContainer() &&
- Dcl->getDeclContext()->isFileContext())
+ Dcl && Dcl->getDeclContext()->isFileContext())
Dcl->setTopLevelDeclInObjCContainer();
return Dcl;
Added: cfe/trunk/test/SemaObjCXX/crash.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/crash.mm?rev=155836&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/crash.mm (added)
+++ cfe/trunk/test/SemaObjCXX/crash.mm Mon Apr 30 13:13:01 2012
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+
+// <rdar://problem/11286701>
+namespace std {
+ template<typename T, typename U> class pair;
+}
+
+ at interface NSObject
+ at end
+
+ at interface Test : NSObject
+ at end
+
+ at implementation Test
+
+struct EvilStruct {
+} // note the missing semicolon
+
+ typedef std::pair<int, int> IntegerPair; // expected-error{{typedef declarator cannot be qualified}} \
+// expected-error{{typedef name must be an identifier}} \
+// expected-error{{expected ';' after top level declarator}}
+
+ at end
More information about the cfe-commits
mailing list