[cfe-commits] r118625 - in /cfe/trunk: lib/Parse/ParseDecl.cpp lib/Parse/ParseDeclCXX.cpp test/Parser/cxx-decl.cpp
Chris Lattner
sabre at nondot.org
Tue Nov 9 12:14:26 PST 2010
Author: lattner
Date: Tue Nov 9 14:14:26 2010
New Revision: 118625
URL: http://llvm.org/viewvc/llvm-project?rev=118625&view=rev
Log:
fix PR8380, a crash on invalid due to an illogical DeclSpec SourceRange being constructed.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/cxx-decl.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=118625&r1=118624&r2=118625&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Nov 9 14:14:26 2010
@@ -889,6 +889,7 @@
AccessSpecifier AS,
DeclSpecContext DSContext) {
DS.SetRangeStart(Tok.getLocation());
+ DS.SetRangeEnd(Tok.getLocation());
while (1) {
bool isInvalid = false;
const char *PrevSpec = 0;
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=118625&r1=118624&r2=118625&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Tue Nov 9 14:14:26 2010
@@ -187,7 +187,6 @@
unsigned Context) {
assert(Tok.is(tok::string_literal) && "Not a string literal!");
llvm::SmallString<8> LangBuffer;
- // LangBuffer is guaranteed to be big enough.
bool Invalid = false;
llvm::StringRef Lang = PP.getSpelling(Tok, LangBuffer, &Invalid);
if (Invalid)
Modified: cfe/trunk/test/Parser/cxx-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-decl.cpp?rev=118625&r1=118624&r2=118625&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx-decl.cpp Tue Nov 9 14:14:26 2010
@@ -83,3 +83,14 @@
void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
}
+
+;
+
+// PR8380
+extern "" // expected-error {{unknown linkage language}}
+test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \
+ // expected-error {{expected ';' after top level declarator}}
+
+ int test6b;
+
+
More information about the cfe-commits
mailing list