diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-02 04:16:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-02 04:16:50 +0000 |
commit | 97144fc41a9419bf6d74fc9450e8ef3f6e11f7e0 (patch) | |
tree | fa4999c1dd962098ab138210b5268e02b340acbc /lib/Parse/Parser.cpp | |
parent | 0ddaff3a558cca0d1157c3f63e3ad82b72cf625a (diff) |
fix a FIXME, providing accurate source range info for DeclStmt's. The end
of the range is now the ';' location. For something like this:
$ cat t2.c
#define bool int
void f(int x, int y) {
bool b = !x && y;
}
We used to produce:
$ clang-cc t2.c -ast-dump
typedef char *__builtin_va_list;
void f(int x, int y)
(CompoundStmt 0x2201f10 <t2.c:3:22, line:5:1>
(DeclStmt 0x2201ef0 <line:2:14> <----
0x2201a20 "int b =
(BinaryOperator 0x2201ed0 <line:4:10, col:16> 'int' '&&'
(UnaryOperator 0x2201e90 <col:10, col:11> 'int' prefix '!'
(DeclRefExpr 0x2201c90 <col:11> 'int' ParmVar='x' 0x2201a50))
(DeclRefExpr 0x2201eb0 <col:16> 'int' ParmVar='y' 0x2201e10))")
Now we produce:
$ clang-cc t2.c -ast-dump
typedef char *__builtin_va_list;
void f(int x, int y)
(CompoundStmt 0x2201f10 <t2.c:3:22, line:5:1>
(DeclStmt 0x2201ef0 <line:2:14, line:4:17> <------
0x2201a20 "int b =
(BinaryOperator 0x2201ed0 <col:10, col:16> 'int' '&&'
(UnaryOperator 0x2201e90 <col:10, col:11> 'int' prefix '!'
(DeclRefExpr 0x2201c90 <col:11> 'int' ParmVar='x' 0x2201a50))
(DeclRefExpr 0x2201eb0 <col:16> 'int' ParmVar='y' 0x2201e10))")
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68288 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r-- | lib/Parse/Parser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 495d5e51dd..a245ac2156 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -423,7 +423,10 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration() { case tok::kw_export: // As in 'export template' case tok::kw_static_assert: // A function definition cannot start with a these keywords. - return ParseDeclaration(Declarator::FileContext); + { + SourceLocation DeclEnd; + return ParseDeclaration(Declarator::FileContext, DeclEnd); + } default: // We can't tell whether this is a function-definition or declaration yet. return ParseDeclarationOrFunctionDefinition(); |