Thank you for this, good catch! ~Aaron
On Fri, Jan 9, 2015 at 1:09 PM, David Majnemer <[email protected]> wrote: > Author: majnemer > Date: Fri Jan 9 12:09:39 2015 > New Revision: 225533 > > URL: http://llvm.org/viewvc/llvm-project?rev=225533&view=rev > Log: > Parse: Don't crash when an annotation token shows up in a C++11 attr > > It's not safe to blindly call getIdentifierInfo without checking the > token is not an annotation token. > > Modified: > cfe/trunk/lib/Parse/ParseDeclCXX.cpp > cfe/trunk/test/Parser/cxx0x-attributes.cpp > > Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=225533&r1=225532&r2=225533&view=diff > ============================================================================== > --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original) > +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Jan 9 12:09:39 2015 > @@ -3386,9 +3386,11 @@ IdentifierInfo *Parser::TryParseCXX11Att > switch (Tok.getKind()) { > default: > // Identifiers and keywords have identifier info attached. > - if (IdentifierInfo *II = Tok.getIdentifierInfo()) { > - Loc = ConsumeToken(); > - return II; > + if (!Tok.isAnnotation()) { > + if (IdentifierInfo *II = Tok.getIdentifierInfo()) { > + Loc = ConsumeToken(); > + return II; > + } > } > return nullptr; > > > Modified: cfe/trunk/test/Parser/cxx0x-attributes.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-attributes.cpp?rev=225533&r1=225532&r2=225533&view=diff > ============================================================================== > --- cfe/trunk/test/Parser/cxx0x-attributes.cpp (original) > +++ cfe/trunk/test/Parser/cxx0x-attributes.cpp Fri Jan 9 12:09:39 2015 > @@ -334,3 +334,10 @@ namespace { > [[deprecated()]] void foo(); // expected-error {{parentheses must be > omitted if 'deprecated' attribute's argument list is empty}} > [[gnu::deprecated()]] void quux(); > } > + > +namespace { > +[[ // expected-error {{expected ']'}} > +#pragma pack(pop) > +deprecated > +]] void bad(); > +} > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
