diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-01 17:52:58 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-01 17:52:58 +0000 |
commit | cfa1caa92611184f59c2f3e606c53ddcc726449a (patch) | |
tree | 717933dcca0a1a8536edd9f5a15f398c631490e7 /lib | |
parent | ef4b666e841e3917385892713612888ec6c3a056 (diff) |
Make the FilenameRange of the InclusionDirective callback more accurate,
preserve the macro location of the range end if the filename came from a macro.
Patch by Kim Gräsman!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167239 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 9314517ed3..b7c1846e82 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1296,7 +1296,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, case tok::string_literal: Filename = getSpelling(FilenameTok, FilenameBuffer); End = FilenameTok.getLocation(); - CharEnd = End.getLocWithOffset(Filename.size()); + CharEnd = End.getLocWithOffset(FilenameTok.getLength()); break; case tok::less: @@ -1306,7 +1306,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, if (ConcatenateIncludeName(FilenameBuffer, End)) return; // Found <eod> but no ">"? Diagnostic already emitted. Filename = FilenameBuffer.str(); - CharEnd = getLocForEndOfToken(End); + CharEnd = End.getLocWithOffset(1); break; default: Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename); |