aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-02-09 18:23:29 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-02-09 18:23:29 +0000
commitab197baec16bacade82325fb274cf6b992ac5d8a (patch)
tree0381fff06de5af8ef5e30e3e00b95afe957bce01 /lib/Parse/Parser.cpp
parentd3098ee64c069a3eff4d2d0a5d655d968c7b5dd2 (diff)
Implement Declarator::getSourceRange().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index eb84a4a382..f28767a0fd 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -522,6 +522,7 @@ Parser::DeclTy *Parser::ParseFunctionDefinition(Declarator &D) {
D.getMutableDeclSpec().SetTypeSpecType(DeclSpec::TST_int,
D.getIdentifierLoc(),
PrevSpec);
+ D.SetRangeBegin(D.getDeclSpec().getSourceRange().getBegin());
}
// If this declaration was formed with a K&R-style identifier list for the
@@ -702,7 +703,7 @@ Parser::OwningExprResult Parser::ParseAsmStringLiteral() {
/// [GNU] simple-asm-expr:
/// 'asm' '(' asm-string-literal ')'
///
-Parser::OwningExprResult Parser::ParseSimpleAsm() {
+Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
assert(Tok.is(tok::kw_asm) && "Not an asm!");
SourceLocation Loc = ConsumeToken();
@@ -711,14 +712,20 @@ Parser::OwningExprResult Parser::ParseSimpleAsm() {
return ExprError();
}
- ConsumeParen();
+ Loc = ConsumeParen();
OwningExprResult Result(ParseAsmStringLiteral());
- if (Result.isInvalid())
- SkipUntil(tok::r_paren);
- else
- MatchRHSPunctuation(tok::r_paren, Loc);
+ if (Result.isInvalid()) {
+ SkipUntil(tok::r_paren, true, true);
+ if (EndLoc)
+ *EndLoc = Tok.getLocation();
+ ConsumeAnyToken();
+ } else {
+ Loc = MatchRHSPunctuation(tok::r_paren, Loc);
+ if (EndLoc)
+ *EndLoc = Loc;
+ }
return move(Result);
}