diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-09 19:40:45 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-09 19:40:45 +0000 |
commit | ecd27bf256c92f56c7c7ede6f40ec5d31a40b35e (patch) | |
tree | c7318bae561a592d3ff8b282c7a864a175e0ac10 /lib/Frontend | |
parent | 8616f9af65b9a3662f2c9dfed38eeabc509f8446 (diff) |
Add a FileCharacteristic parameter to SourceManager::createFileIDForMemBuffer
for completeness and use it in CompilerInstance::InitializeSourceManager if
the input is a memory buffer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167628 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 9e7b630bf1..22a74fcc35 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -600,10 +600,18 @@ bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input, FileManager &FileMgr, SourceManager &SourceMgr, const FrontendOptions &Opts) { - StringRef InputFile = Input.getFile(); SrcMgr::CharacteristicKind Kind = Input.isSystem() ? SrcMgr::C_System : SrcMgr::C_User; + if (Input.isBuffer()) { + SourceMgr.createMainFileIDForMemBuffer(Input.getBuffer(), Kind); + assert(!SourceMgr.getMainFileID().isInvalid() && + "Couldn't establish MainFileID!"); + return true; + } + + StringRef InputFile = Input.getFile(); + // Figure out where to get and map in the main file. if (InputFile != "-") { const FileEntry *File = FileMgr.getFile(InputFile); |