diff options
Diffstat (limited to 'include/llvm/Support/SourceMgr.h')
-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 953cf897b9..53e7dd8dfb 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; |