summaryrefslogtreecommitdiffstats
path: root/clang/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
commitf6591ca6d991fb9a229c3fa6745124622ab178e5 (patch)
treee41ed0ad1b5c579911ae8bcbed58572e20fd1ca1 /clang/lib/Parse/Parser.cpp
parenta950e99dee42a37db0eb2d8700398af9da1f1775 (diff)
downloadbcm5719-llvm-f6591ca6d991fb9a229c3fa6745124622ab178e5.tar.gz
bcm5719-llvm-f6591ca6d991fb9a229c3fa6745124622ab178e5.zip
Implement Declarator::getSourceRange().
llvm-svn: 64151
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r--clang/lib/Parse/Parser.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index eb84a4a3825..f28767a0fdb 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud