diff options
Diffstat (limited to 'lib/Lex/PreprocessingRecord.cpp')
-rw-r--r-- | lib/Lex/PreprocessingRecord.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp index dfdeba3f9c..40250f6786 100644 --- a/lib/Lex/PreprocessingRecord.cpp +++ b/lib/Lex/PreprocessingRecord.cpp @@ -389,8 +389,8 @@ void PreprocessingRecord::InclusionDirective( const clang::Token &IncludeTok, StringRef FileName, bool IsAngled, + CharSourceRange FilenameRange, const FileEntry *File, - clang::SourceLocation EndLoc, StringRef SearchPath, StringRef RelativePath) { InclusionDirective::InclusionKind Kind = InclusionDirective::Include; @@ -415,7 +415,16 @@ void PreprocessingRecord::InclusionDirective( default: llvm_unreachable("Unknown include directive kind"); } - + + SourceLocation EndLoc; + if (!IsAngled) { + EndLoc = FilenameRange.getBegin(); + } else { + EndLoc = FilenameRange.getEnd(); + if (FilenameRange.isCharRange()) + EndLoc = EndLoc.getLocWithOffset(-1); // the InclusionDirective expects + // a token range. + } clang::InclusionDirective *ID = new (*this) clang::InclusionDirective(*this, Kind, FileName, !IsAngled, File, SourceRange(HashLoc, EndLoc)); |