diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-26 08:01:50 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-26 08:01:50 +0000 |
commit | fb3612ef197cb8532c05f33889ec1aed7c26e5cb (patch) | |
tree | e043386d53e7c57379c5a28e7b672fdd95a72e2c /include/clang/Basic | |
parent | 527f98d65ff1e7c3ed6c8467ca7f516f3ea7ad9b (diff) |
Associate the macro arguments location map with a FileID instead
of a ContentCache, since multiple FileIDs can have the same ContentCache
but the expanded macro arguments locations will be different.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 2c6b8cde18..6aea0f95ac 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -104,11 +104,6 @@ namespace SrcMgr { /// if SourceLineCache is non-null. unsigned NumLines; - /// \brief Lazily computed map of macro argument chunks to their expanded - /// source location. - typedef std::map<unsigned, SourceLocation> MacroArgsMap; - MacroArgsMap *MacroArgsCache; - /// getBuffer - Returns the memory buffer for the associated content. /// /// \param Diag Object through which diagnostics will be emitted if the @@ -166,11 +161,11 @@ namespace SrcMgr { ContentCache(const FileEntry *Ent = 0) : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent), - SourceLineCache(0), NumLines(0), MacroArgsCache(0) {} + SourceLineCache(0), NumLines(0) {} ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt), - SourceLineCache(0), NumLines(0), MacroArgsCache(0) {} + SourceLineCache(0), NumLines(0) {} ~ContentCache(); @@ -178,14 +173,13 @@ namespace SrcMgr { /// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory /// is not transferred, so this is a logical error. ContentCache(const ContentCache &RHS) - : Buffer(0, false), SourceLineCache(0), MacroArgsCache(0) + : Buffer(0, false), SourceLineCache(0) { OrigEntry = RHS.OrigEntry; ContentsEntry = RHS.ContentsEntry; assert (RHS.Buffer.getPointer() == 0 && RHS.SourceLineCache == 0 && - RHS.MacroArgsCache == 0 - && "Passed ContentCache object cannot own a buffer."); + "Passed ContentCache object cannot own a buffer."); NumLines = RHS.NumLines; } @@ -571,6 +565,12 @@ class SourceManager : public llvm::RefCountedBase<SourceManager> { // Cache for the "fake" buffer used for error-recovery purposes. mutable llvm::MemoryBuffer *FakeBufferForRecovery; + /// \brief Lazily computed map of macro argument chunks to their expanded + /// source location. + typedef std::map<unsigned, SourceLocation> MacroArgsMap; + + mutable llvm::DenseMap<FileID, MacroArgsMap *> MacroArgsCacheMap; + // SourceManager doesn't support copy construction. explicit SourceManager(const SourceManager&); void operator=(const SourceManager&); @@ -1301,7 +1301,7 @@ private: std::pair<FileID, unsigned> getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E, unsigned Offset) const; - void computeMacroArgsCache(SrcMgr::ContentCache *Content, FileID FID) const; + void computeMacroArgsCache(MacroArgsMap *&MacroArgsCache, FileID FID) const; friend class ASTReader; friend class ASTWriter; |