diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-19 20:40:35 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-19 20:40:35 +0000 |
commit | 507097ec40105ed927cb5a744fad98f5875aacac (patch) | |
tree | 6a3b744d2bdb1ad5291f59b7111972963da69374 /lib/Basic/SourceManager.cpp | |
parent | efa2ff8603dae51f5f5ed7509a503f477498ad22 (diff) | |
download | clang-507097ec40105ed927cb5a744fad98f5875aacac.tar.gz |
[libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r-- | lib/Basic/SourceManager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 38cc9946be..68c98fe02c 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -1324,7 +1324,8 @@ static llvm::Optional<ino_t> getActualFileInode(const FileEntry *File) { /// If the source file is included multiple times, the source location will /// be based upon an arbitrary inclusion. SourceLocation SourceManager::translateFileLineCol(const FileEntry *SourceFile, - unsigned Line, unsigned Col) { + unsigned Line, + unsigned Col) const { assert(SourceFile && "Null source file!"); assert(Line && Col && "Line and column should start from 1!"); @@ -1439,7 +1440,8 @@ SourceLocation SourceManager::translateFileLineCol(const FileEntry *SourceFile, /// \brief Get the source location in \arg FID for the given line:col. /// Returns null location if \arg FID is not a file SLocEntry. SourceLocation SourceManager::translateLineCol(FileID FID, - unsigned Line, unsigned Col) { + unsigned Line, + unsigned Col) const { if (FID.isInvalid()) return SourceLocation(); @@ -1496,7 +1498,8 @@ SourceLocation SourceManager::translateLineCol(FileID FID, /// 0 -> SourceLocation() /// 100 -> Expanded macro arg location /// 110 -> SourceLocation() -void SourceManager::computeMacroArgsCache(ContentCache *Content, FileID FID) { +void SourceManager::computeMacroArgsCache(ContentCache *Content, + FileID FID) const { assert(!Content->MacroArgsCache); assert(!FID.isInvalid()); @@ -1575,7 +1578,8 @@ void SourceManager::computeMacroArgsCache(ContentCache *Content, FileID FID) { /// ^ /// Passing a file location pointing at 'foo', will yield a macro location /// where 'foo' was expanded into. -SourceLocation SourceManager::getMacroArgExpandedLocation(SourceLocation Loc) { +SourceLocation +SourceManager::getMacroArgExpandedLocation(SourceLocation Loc) const { if (Loc.isInvalid() || !Loc.isFileID()) return Loc; |