[cfe-commits] r49974 - /cfe/trunk/Driver/clang.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 19 16:25:45 PDT 2008
Author: lattner
Date: Sat Apr 19 18:25:44 2008
New Revision: 49974
URL: http://llvm.org/viewvc/llvm-project?rev=49974&view=rev
Log:
simplify the return of InitializePreprocessor to be bool instead of a fileid
Modified:
cfe/trunk/Driver/clang.cpp
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=49974&r1=49973&r2=49974&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Sat Apr 19 18:25:44 2008
@@ -583,12 +583,11 @@
/// 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 @@
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 @@
PP.setPredefines(&PredefineBuffer[0]);
// Once we've read this, we're done.
- return SourceMgr.getMainFileID();
+ return false;
}
//===----------------------------------------------------------------------===//
@@ -1043,7 +1042,7 @@
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 @@
// Basic Parser driver
//===----------------------------------------------------------------------===//
-static void ParseFile(Preprocessor &PP, MinimalAction *PA){
+static void ParseFile(Preprocessor &PP, MinimalAction *PA) {
Parser P(PP, *PA);
PP.EnterMainSourceFile();
More information about the cfe-commits
mailing list