summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Parse')
-rw-r--r--clang/lib/Parse/MinimalAction.cpp3
-rw-r--r--clang/lib/Parse/ParseDecl.cpp16
-rw-r--r--clang/lib/Parse/ParseObjc.cpp2
-rw-r--r--clang/lib/Parse/Parser.cpp6
4 files changed, 19 insertions, 8 deletions
diff --git a/clang/lib/Parse/MinimalAction.cpp b/clang/lib/Parse/MinimalAction.cpp
index cb130c3d268..352925535dd 100644
--- a/clang/lib/Parse/MinimalAction.cpp
+++ b/clang/lib/Parse/MinimalAction.cpp
@@ -63,7 +63,8 @@ MinimalAction::isTypeName(const IdentifierInfo &II, Scope *S) {
/// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
/// popped.
Action::DeclTy *
-MinimalAction::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) {
+MinimalAction::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup,
+ ExprTy *AsmLabel) {
IdentifierInfo *II = D.getIdentifier();
// If there is no identifier associated with this declarator, bail out.
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 81cb0ce6271..33482c5700f 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -256,8 +256,14 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// rest of the init-declarator-list.
while (1) {
// If a simple-asm-expr is present, parse it.
- if (Tok.is(tok::kw_asm))
- ParseSimpleAsm();
+ ExprResult AsmLabel;
+ if (Tok.is(tok::kw_asm)) {
+ AsmLabel = ParseSimpleAsm();
+ if (AsmLabel.isInvalid) {
+ SkipUntil(tok::semi);
+ return 0;
+ }
+ }
// If attributes are present, parse them.
if (Tok.is(tok::kw___attribute))
@@ -265,13 +271,13 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// Inform the current actions module that we just parsed this declarator.
// FIXME: pass asm & attributes.
- LastDeclInGroup = Actions.ActOnDeclarator(CurScope, D, LastDeclInGroup);
+ LastDeclInGroup = Actions.ActOnDeclarator(CurScope, D, LastDeclInGroup,
+ AsmLabel.Val);
// Parse declarator '=' initializer.
- ExprResult Init;
if (Tok.is(tok::equal)) {
ConsumeToken();
- Init = ParseInitializer();
+ ExprResult Init = ParseInitializer();
if (Init.isInvalid) {
SkipUntil(tok::semi);
return 0;
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 980105a02ce..467cbd84a0a 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -1222,7 +1222,7 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
ParseDeclarator(DeclaratorInfo);
if (DeclaratorInfo.getIdentifier()) {
DeclTy *aBlockVarDecl = Actions.ActOnDeclarator(CurScope,
- DeclaratorInfo, 0);
+ DeclaratorInfo, 0, 0);
StmtResult stmtResult =
Actions.ActOnDeclStmt(aBlockVarDecl,
DS.getSourceRange().getBegin(),
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index ef07d3f08ba..9eab4fda151 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -670,7 +670,11 @@ Parser::ExprResult Parser::ParseSimpleAsm() {
ExprResult Result = ParseAsmStringLiteral();
- MatchRHSPunctuation(tok::r_paren, Loc);
+ if (Result.isInvalid) {
+ SkipUntil(tok::r_paren);
+ } else {
+ MatchRHSPunctuation(tok::r_paren, Loc);
+ }
return Result;
}
OpenPOWER on IntegriCloud