aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2016-12-07 10:24:44 +0000
committerAlex Lorenz <arphaman@gmail.com>2016-12-07 10:24:44 +0000
commite151f010deab7417abf663fb1c8ff841539903e7 (patch)
treea6d9821dbfb097e82234e4f8227c749f3b7bf72e /clang/lib/Parse/ParseDecl.cpp
parent59336a0a45c64bef27adf2476274466134693723 (diff)
downloadllvm-e151f010deab7417abf663fb1c8ff841539903e7.zip
llvm-e151f010deab7417abf663fb1c8ff841539903e7.tar.gz
llvm-e151f010deab7417abf663fb1c8ff841539903e7.tar.bz2
[ObjC++] Don't enter a C++ declarator scope when the current context is
an Objective-C declaration This commit ensures that Sema won't enter a C++ declarator scope when the current context is an Objective-C declaration. This prevents an assertion failure in EnterDeclaratorContext that's used to ensure that current context will be restored correctly after exiting the declarator context. rdar://20560175 Differential Revision: https://reviews.llvm.org/D26922 llvm-svn: 288893
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index d15e41d..ea7ab26 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -5264,6 +5264,14 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
// Change the declaration context for name lookup, until this function
// is exited (and the declarator has been parsed).
DeclScopeObj.EnterDeclaratorScope();
+ else if (getObjCDeclContext()) {
+ // Ensure that we don't interpret the next token as an identifier when
+ // dealing with declarations in an Objective-C container.
+ D.SetIdentifier(nullptr, Tok.getLocation());
+ D.setInvalidType(true);
+ ConsumeToken();
+ goto PastIdentifier;
+ }
}
// C++0x [dcl.fct]p14: