summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-cc
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-14 07:53:04 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-14 07:53:04 +0000
commit409e890f8d705ec7b2ee7aff8508dfe1ac835eae (patch)
treed60267c124c14574132a10e9a502497cec683e4e /clang/tools/clang-cc
parent7935bcb0fec94f243c26220b9bc4cdd393b65377 (diff)
downloadbcm5719-llvm-409e890f8d705ec7b2ee7aff8508dfe1ac835eae.tar.gz
bcm5719-llvm-409e890f8d705ec7b2ee7aff8508dfe1ac835eae.zip
Add CompilerInstance::InitializeSourceManager.
llvm-svn: 88764
Diffstat (limited to 'clang/tools/clang-cc')
-rw-r--r--clang/tools/clang-cc/clang-cc.cpp33
1 files changed, 1 insertions, 32 deletions
diff --git a/clang/tools/clang-cc/clang-cc.cpp b/clang/tools/clang-cc/clang-cc.cpp
index 6d2a59104b6..51a0084562f 100644
--- a/clang/tools/clang-cc/clang-cc.cpp
+++ b/clang/tools/clang-cc/clang-cc.cpp
@@ -164,37 +164,6 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
// Utility Methods
//===----------------------------------------------------------------------===//
-static bool InitializeSourceManager(Preprocessor &PP,
- const FrontendOptions &FEOpts,
- const std::string &InFile) {
- // Figure out where to get and map in the main file.
- SourceManager &SourceMgr = PP.getSourceManager();
- FileManager &FileMgr = PP.getFileManager();
-
- if (FEOpts.EmptyInputOnly) {
- const char *EmptyStr = "";
- llvm::MemoryBuffer *SB =
- llvm::MemoryBuffer::getMemBuffer(EmptyStr, EmptyStr, "<empty input>");
- SourceMgr.createMainFileIDForMemBuffer(SB);
- } else if (InFile != "-") {
- const FileEntry *File = FileMgr.getFile(InFile);
- if (File) SourceMgr.createMainFileID(File, SourceLocation());
- if (SourceMgr.getMainFileID().isInvalid()) {
- PP.getDiagnostics().Report(diag::err_fe_error_reading) << InFile.c_str();
- return true;
- }
- } else {
- llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN();
- SourceMgr.createMainFileIDForMemBuffer(SB);
- if (SourceMgr.getMainFileID().isInvalid()) {
- PP.getDiagnostics().Report(diag::err_fe_error_reading_stdin);
- return true;
- }
- }
-
- return false;
-}
-
std::string GetBuiltinIncludePath(const char *Argv0) {
llvm::sys::Path P =
llvm::sys::Path::GetMainExecutable(Argv0,
@@ -423,7 +392,7 @@ static void ProcessInputFile(CompilerInstance &CI, const std::string &InFile,
// Initialize the main file entry. This needs to be delayed until after PCH
// has loaded.
- if (InitializeSourceManager(PP, CI.getFrontendOpts(), InFile))
+ if (!CI.InitializeSourceManager(InFile))
return;
if (Consumer) {
OpenPOWER on IntegriCloud