summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-19 23:25:44 +0000
committerChris Lattner <sabre@nondot.org>2008-04-19 23:25:44 +0000
commit1a44f7fce927e72efd2cfe781d4afb094a25fb04 (patch)
treee2fd103c4141610841e54730081f316c46c0a120 /clang
parentba1f37bfdf5e899f3c4a988fda94757d94540f96 (diff)
downloadbcm5719-llvm-1a44f7fce927e72efd2cfe781d4afb094a25fb04.tar.gz
bcm5719-llvm-1a44f7fce927e72efd2cfe781d4afb094a25fb04.zip
simplify the return of InitializePreprocessor to be bool instead of a fileid
llvm-svn: 49974
Diffstat (limited to 'clang')
-rw-r--r--clang/Driver/clang.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp
index 5ff30a4c5ba..144ab4e65ac 100644
--- a/clang/Driver/clang.cpp
+++ b/clang/Driver/clang.cpp
@@ -583,12 +583,11 @@ static void AddImplicitInclude(std::vector<char> &Buf, const std::string &File){
/// InitializePreprocessor - Initialize the preprocessor getting it and the
-/// environment ready to process a single file. This returns the file ID for the
-/// input file. If a failure happens, it returns 0.
+/// environment ready to process a single file. This returns true on error.
///
-static unsigned InitializePreprocessor(Preprocessor &PP,
- bool InitializeSourceMgr,
- const std::string &InFile) {
+static bool InitializePreprocessor(Preprocessor &PP,
+ bool InitializeSourceMgr,
+ const std::string &InFile) {
FileManager &FileMgr = PP.getFileManager();
// Figure out where to get and map in the main file.
@@ -600,14 +599,14 @@ static unsigned InitializePreprocessor(Preprocessor &PP,
if (File) SourceMgr.createMainFileID(File, SourceLocation());
if (SourceMgr.getMainFileID() == 0) {
fprintf(stderr, "Error reading '%s'!\n",InFile.c_str());
- return 0;
+ return true;
}
} else {
llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN();
if (SB) SourceMgr.createMainFileIDForMemBuffer(SB);
if (SourceMgr.getMainFileID() == 0) {
fprintf(stderr, "Error reading standard input! Empty?\n");
- return 0;
+ return true;
}
}
}
@@ -635,7 +634,7 @@ static unsigned InitializePreprocessor(Preprocessor &PP,
PP.setPredefines(&PredefineBuffer[0]);
// Once we've read this, we're done.
- return SourceMgr.getMainFileID();
+ return false;
}
//===----------------------------------------------------------------------===//
@@ -1043,7 +1042,7 @@ public:
Preprocessor* PP = new Preprocessor(Diags, LangInfo, Target,
SourceMgr, HeaderInfo);
- if (!InitializePreprocessor(*PP, InitializeSourceMgr, InFile)) {
+ if (InitializePreprocessor(*PP, InitializeSourceMgr, InFile)) {
delete PP;
return NULL;
}
@@ -1058,7 +1057,7 @@ public:
// Basic Parser driver
//===----------------------------------------------------------------------===//
-static void ParseFile(Preprocessor &PP, MinimalAction *PA){
+static void ParseFile(Preprocessor &PP, MinimalAction *PA) {
Parser P(PP, *PA);
PP.EnterMainSourceFile();
OpenPOWER on IntegriCloud