diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-12 06:36:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-12 06:36:00 +0000 |
commit | 3adb17d44f49548add4c09ee78146812a5159bbe (patch) | |
tree | d682d2534bb6a5d57173be7279166abd32d6244c /clang/lib/Parse/ParseInit.cpp | |
parent | 3ab8ca2894dc9f6bfaf1dfe39357d39ce02b504d (diff) | |
download | llvm-3adb17d44f49548add4c09ee78146812a5159bbe.zip llvm-3adb17d44f49548add4c09ee78146812a5159bbe.tar.gz llvm-3adb17d44f49548add4c09ee78146812a5159bbe.tar.bz2 |
fix a bug I noticed by inspection, correcting two reject-valid bugs.
llvm-svn: 101026
Diffstat (limited to 'clang/lib/Parse/ParseInit.cpp')
-rw-r--r-- | clang/lib/Parse/ParseInit.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp index 57751c9..123908d 100644 --- a/clang/lib/Parse/ParseInit.cpp +++ b/clang/lib/Parse/ParseInit.cpp @@ -14,6 +14,7 @@ #include "clang/Parse/Designator.h" #include "clang/Parse/Parser.h" #include "clang/Parse/ParseDiagnostic.h" +#include "clang/Parse/Scope.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/raw_ostream.h" using namespace clang; @@ -125,12 +126,16 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() { SourceLocation StartLoc = ConsumeBracket(); // If Objective-C is enabled and this is a typename (class message send) or - // 'super', parse this as a message send expression. + // send to 'super', parse this as a message send expression. if (getLang().ObjC1 && Tok.is(tok::identifier)) { IdentifierInfo *II = Tok.getIdentifierInfo(); - if (II == Ident_super || Actions.getTypeName(*II, Tok.getLocation(), - CurScope)) { + // Three cases. This is a message send to a type: [type foo] + // This is a message send to super: [super foo] + // This is a message sent to an expr: [super.bar foo] + if (Actions.getTypeName(*II, Tok.getLocation(), CurScope) || + (II == Ident_super && GetLookAheadToken(1).isNot(tok::period) && + CurScope->isInObjcMethodScope())) { // If we have exactly one array designator, this used the GNU // 'designation: array-designator' extension, otherwise there should be no // designators at all! |