summaryrefslogtreecommitdiffstats
path: root/clang/Parse/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/Parse/Parser.cpp')
-rw-r--r--clang/Parse/Parser.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/Parse/Parser.cpp b/clang/Parse/Parser.cpp
index e3208a0b3e9..860a44f9e94 100644
--- a/clang/Parse/Parser.cpp
+++ b/clang/Parse/Parser.cpp
@@ -367,7 +367,10 @@ Parser::DeclTy *Parser::ParseDeclarationOrFunctionDefinition() {
// Parse the common declaration-specifiers piece.
DeclSpec DS;
ParseDeclarationSpecifiers(DS);
-
+ // If the decl specs are invalid, there is no need to continue.
+ if (DS.isInvalid())
+ return 0;
+
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'
if (Tok.is(tok::semi)) {
OpenPOWER on IntegriCloud