Fix a minor error checking bug.
Change-Id: I26c809d361071eba06efb734ea2b54c4dc560981
diff --git a/slang.cpp b/slang.cpp
index 2744b05..6e89797 100644
--- a/slang.cpp
+++ b/slang.cpp
@@ -281,7 +281,6 @@
bool Slang::setOutput(const char *OutputFile) {
std::string Error;
-
switch (mOT) {
case OT_Dependency:
case OT_Assembly:
@@ -326,8 +325,10 @@
}
int Slang::generateDepFile() {
- if((mDiagnostics->getNumErrors() > 0) || (mOS.get() == NULL))
+ if(mDiagnostics->getNumErrors() > 0)
return mDiagnostics->getNumErrors();
+ if (mOS.get() == NULL)
+ return 1;
/* Initialize options for generating dependency file */
clang::DependencyOutputOptions DepOpts;
@@ -361,8 +362,10 @@
if (mOT == OT_Dependency)
return generateDepFile();
- if ((mDiagnostics->getNumErrors() > 0) || (mOS.get() == NULL))
+ if (mDiagnostics->getNumErrors() > 0)
return mDiagnostics->getNumErrors();
+ if (mOS.get() == NULL)
+ return 1;
// Here is per-compilation needed initialization
createPreprocessor();