diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-13 01:03:57 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-13 01:03:57 +0000 |
commit | ecc65238c98ba21d08763da7b7972d617677e908 (patch) | |
tree | 55b6d0ffc73876facdfc8c1ae740df53f5493012 /include/clang/Basic/SourceManager.h | |
parent | 3a0f7ac43aa3dcf1e3231549ca9ce8cffd5a2d7c (diff) |
Introduce SourceManager::getDecomposedIncludedLoc, that returns the "included/expanded in" decomposed location of the given FileID.
The main benefit is to speed-up SourceManager::isBeforeInTranslationUnit which is common to query
the included/expanded location of the same FileID multiple times.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179435 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 00c96c3da0..f82b196929 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -646,6 +646,13 @@ class SourceManager : public RefCountedBase<SourceManager> { // Statistics for -print-stats. mutable unsigned NumLinearScans, NumBinaryProbes; + /// \brief Associates a FileID with its "included/expanded in" decomposed + /// location. + /// + /// Used to cache results from and speed-up \c getDecomposedIncludedLoc + /// function. + mutable llvm::DenseMap<FileID, std::pair<FileID, unsigned> > IncludedLocMap; + /// The key value into the IsBeforeInTUCache table. typedef std::pair<FileID, FileID> IsBeforeInTUCacheKey; @@ -1127,6 +1134,10 @@ public: return getDecomposedSpellingLocSlowCase(E, Offset); } + /// \brief Returns the "included/expanded in" decomposed location of the given + /// FileID. + std::pair<FileID, unsigned> getDecomposedIncludedLoc(FileID FID) const; + /// \brief Returns the offset from the start of the file that the /// specified SourceLocation represents. /// |