diff options
| author | Alp Toker <alp@nuanti.com> | 2014-05-21 01:12:41 +0000 |
|---|---|---|
| committer | Alp Toker <alp@nuanti.com> | 2014-05-21 01:12:41 +0000 |
| commit | b671e34c36463f972a3984e407f91484ad6e5806 (patch) | |
| tree | cc9796f60ac6ea4e73fc15bc58642210a590e7b6 /clang/lib/Frontend | |
| parent | 80fd10e6e10d23fed1a78cc3755ce06bcc2cb9d8 (diff) | |
| download | bcm5719-llvm-b671e34c36463f972a3984e407f91484ad6e5806.tar.gz bcm5719-llvm-b671e34c36463f972a3984e407f91484ad6e5806.zip | |
SourceManager: Use setMainFileID() consistently
Eliminate createMainFileID() / createMainFileIDForMemBuffer() utility
functions. These didn't add much convenience and conflated two distinct
operations.
This change makes things easier to follow by providing a consistent interface
and getting rid of a bunch of cast-to-voids.
llvm-svn: 209266
Diffstat (limited to 'clang/lib/Frontend')
| -rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 9e07e747e87..822b44e442c 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -621,7 +621,7 @@ bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input, Kind = Input.isSystem() ? SrcMgr::C_System : SrcMgr::C_User; if (Input.isBuffer()) { - SourceMgr.createMainFileIDForMemBuffer(Input.getBuffer(), Kind); + SourceMgr.setMainFileID(SourceMgr.createFileID(Input.getBuffer(), Kind)); assert(!SourceMgr.getMainFileID().isInvalid() && "Couldn't establish MainFileID!"); return true; @@ -655,7 +655,8 @@ bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input, } } - SourceMgr.createMainFileID(File, Kind); + SourceMgr.setMainFileID( + SourceMgr.createFileID(File, SourceLocation(), Kind)); } else { std::unique_ptr<llvm::MemoryBuffer> SB; if (llvm::error_code ec = llvm::MemoryBuffer::getSTDIN(SB)) { @@ -664,7 +665,8 @@ bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input, } const FileEntry *File = FileMgr.getVirtualFile(SB->getBufferIdentifier(), SB->getBufferSize(), 0); - SourceMgr.createMainFileID(File, Kind); + SourceMgr.setMainFileID( + SourceMgr.createFileID(File, SourceLocation(), Kind)); SourceMgr.overrideFileContents(File, SB.release()); } |

