aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseTentative.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-16 01:51:54 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-16 01:51:54 +0000
commit9497a73ad0d54859edbf48beb93ebb19a7ae50c9 (patch)
treec71789bbb2dda9a909fb3655f088085e2f286d10 /lib/Parse/ParseTentative.cpp
parentb36cd3e1757fb4fcd9509f35558c847b04bef35f (diff)
Implement automatic bracket insertion for Objective-C class message
sends. These are far trickier than instance messages, because we typically have something like NSArray alloc] where it appears to be a declaration of a variable named "alloc" up until we see the ']' (or a ':'), and at that point we can't backtrace. So, we use a combination of syntactic and semantic disambiguation to treat this as a message send only when the type is an Objective-C type and it has the syntax of a class message send (which would otherwise be ill-formed). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseTentative.cpp')
-rw-r--r--lib/Parse/ParseTentative.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index c22d99fa9d..085edb1281 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -821,6 +821,9 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
if (NextToken().is(tok::l_paren))
return TPResult::Ambiguous();
+ if (isStartOfObjCClassMessageMissingOpenBracket())
+ return TPResult::False();
+
return TPResult::True();
// GNU typeof support.