aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-11-09 19:40:45 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-11-09 19:40:45 +0000
commit6566e23e131ae73c9724152ce9797cd9a6a4401f (patch)
tree6106007a53f25510486027c37506810fd3349fd6 /clang/lib/Frontend/CompilerInstance.cpp
parent873c8583e0f660ee0831751a9d105a57994159e1 (diff)
downloadllvm-6566e23e131ae73c9724152ce9797cd9a6a4401f.zip
llvm-6566e23e131ae73c9724152ce9797cd9a6a4401f.tar.gz
llvm-6566e23e131ae73c9724152ce9797cd9a6a4401f.tar.bz2
Add a FileCharacteristic parameter to SourceManager::createFileIDForMemBuffer
for completeness and use it in CompilerInstance::InitializeSourceManager if the input is a memory buffer. llvm-svn: 167628
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 9e7b630..22a74fc 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/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);