diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-21 05:06:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-21 05:06:04 +0000 |
commit | 7ee5d5f97b3fa709038ff7fd640dc775efaadc26 (patch) | |
tree | 94ad4c8268c7b77b3b828c9cc0f0c868930c20aa /include | |
parent | 8070ea3f068980d08cc10381f4c9369d19a91353 (diff) | |
download | external_llvm-7ee5d5f97b3fa709038ff7fd640dc775efaadc26.zip external_llvm-7ee5d5f97b3fa709038ff7fd640dc775efaadc26.tar.gz external_llvm-7ee5d5f97b3fa709038ff7fd640dc775efaadc26.tar.bz2 |
move include searching logic from TGLexer to SourceMgr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/SourceMgr.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/llvm/Support/SourceMgr.h b/include/llvm/Support/SourceMgr.h index 953cf89..53e7dd8 100644 --- a/include/llvm/Support/SourceMgr.h +++ b/include/llvm/Support/SourceMgr.h @@ -57,12 +57,20 @@ class SourceMgr { /// Buffers - This is all of the buffers that we are reading from. std::vector<SrcBuffer> Buffers; + // IncludeDirectories - This is the list of directories we should search for + // include files in. + std::vector<std::string> IncludeDirectories; + SourceMgr(const SourceMgr&); // DO NOT IMPLEMENT void operator=(const SourceMgr&); // DO NOT IMPLEMENT public: SourceMgr() {} ~SourceMgr(); + void setIncludeDirs(const std::vector<std::string> &Dirs) { + IncludeDirectories = Dirs; + } + const SrcBuffer &getBufferInfo(unsigned i) const { assert(i < Buffers.size() && "Invalid Buffer ID!"); return Buffers[i]; @@ -86,6 +94,11 @@ public: return Buffers.size()-1; } + /// AddIncludeFile - Search for a file with the specified name in the current + /// directory or in one of the IncludeDirs. If no file is found, this returns + /// ~0, otherwise it returns the buffer ID of the stacked file. + unsigned AddIncludeFile(const std::string &Filename, SMLoc IncludeLoc); + /// FindBufferContainingLoc - Return the ID of the buffer containing the /// specified location, returning -1 if not found. int FindBufferContainingLoc(SMLoc Loc) const; |