aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-08-21 21:50:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-21 21:50:15 +0000
commit6eac8fbfa2d57780b982ac193e8195e8989dd6f2 (patch)
treeb5768f5112e820a0c721e30e188879db8aa55f51
parentbf560dcb480a90faca26121d44283fab78e81206 (diff)
parent2d504fd03c66be56ac3b4bb62c78cc72c75dd8b6 (diff)
downloadandroid_frameworks_compile_slang-6eac8fbfa2d57780b982ac193e8195e8989dd6f2.tar.gz
android_frameworks_compile_slang-6eac8fbfa2d57780b982ac193e8195e8989dd6f2.tar.bz2
android_frameworks_compile_slang-6eac8fbfa2d57780b982ac193e8195e8989dd6f2.zip
Merge "Suppress warnings on our second compilation (for 64-bit)." into lmp-dev
-rw-r--r--llvm-rs-cc.cpp5
-rw-r--r--slang.cpp13
-rw-r--r--slang.h2
-rw-r--r--slang_rs.cpp9
-rw-r--r--slang_rs.h2
5 files changed, 23 insertions, 8 deletions
diff --git a/llvm-rs-cc.cpp b/llvm-rs-cc.cpp
index 72db214..0b42894 100644
--- a/llvm-rs-cc.cpp
+++ b/llvm-rs-cc.cpp
@@ -142,12 +142,14 @@ static int compileFiles(NamePairList *IOFiles, NamePairList *IOFiles32,
std::set<std::string> *SavedStrings) {
NamePairList DepFiles;
std::string PathSuffix = "";
+ bool CompileSecondTimeFor64Bit = false;
// In our mixed 32/64-bit path, we need to suffix our files differently for
// both 32-bit and 64-bit versions.
if (Opts.mEmit3264) {
if (Opts.mBitWidth == 64) {
PathSuffix = "bc64";
+ CompileSecondTimeFor64Bit = true;
} else {
PathSuffix = "bc32";
}
@@ -182,7 +184,8 @@ static int compileFiles(NamePairList *IOFiles, NamePairList *IOFiles32,
std::unique_ptr<slang::SlangRS> Compiler(new slang::SlangRS());
Compiler->init(Opts.mBitWidth, DiagEngine, DiagClient);
int CompileFailed = !Compiler->compile(*IOFiles, *IOFiles32, DepFiles, Opts);
- Compiler->reset();
+ // We suppress warnings (via reset) if we are doing a second compilation.
+ Compiler->reset(CompileSecondTimeFor64Bit);
return CompileFailed;
}
diff --git a/slang.cpp b/slang.cpp
index 7810695..c3ab7e6 100644
--- a/slang.cpp
+++ b/slang.cpp
@@ -470,8 +470,17 @@ void Slang::setOptimizationLevel(llvm::CodeGenOpt::Level OptimizationLevel) {
CodeGenOpts.OptimizationLevel = OptimizationLevel;
}
-void Slang::reset() {
- llvm::errs() << mDiagClient->str();
+void Slang::reset(bool SuppressWarnings) {
+ // Always print diagnostics if we had an error occur, but don't print
+ // warnings if we suppressed them (i.e. we are doing the 64-bit compile after
+ // an existing 32-bit compile).
+ //
+ // TODO: This should really be removing duplicate identical warnings between
+ // the 32-bit and 64-bit compiles, but that is a more substantial feature.
+ // Bug: 17052573
+ if (!SuppressWarnings || mDiagEngine->hasErrorOccurred()) {
+ llvm::errs() << mDiagClient->str();
+ }
mDiagEngine->Reset();
mDiagClient->reset();
}
diff --git a/slang.h b/slang.h
index 39cfb56..6483c44 100644
--- a/slang.h
+++ b/slang.h
@@ -235,7 +235,7 @@ class Slang : public clang::ModuleLoader {
// Reset the slang compiler state such that it can be reused to compile
// another file
- virtual void reset();
+ virtual void reset(bool SuppressWarnings = false);
virtual ~Slang();
};
diff --git a/slang_rs.cpp b/slang_rs.cpp
index 6bb5798..e269e57 100644
--- a/slang_rs.cpp
+++ b/slang_rs.cpp
@@ -324,12 +324,15 @@ bool SlangRS::compile(
// a single pass over the input file.
bool SuppressAllWarnings = (Opts.mOutputType != Slang::OT_Dependency);
+ bool CompileSecondTimeFor64Bit = Opts.mEmit3264 && Opts.mBitWidth == 64;
+
for (unsigned i = 0, e = IOFiles32.size(); i != e; i++) {
InputFile = IOFile64Iter->first;
Output64File = IOFile64Iter->second;
Output32File = IOFile32Iter->second;
- reset();
+ // We suppress warnings (via reset) if we are doing a second compilation.
+ reset(CompileSecondTimeFor64Bit);
if (!setInputSource(InputFile))
return false;
@@ -433,11 +436,11 @@ bool SlangRS::compile(
return true;
}
-void SlangRS::reset() {
+void SlangRS::reset(bool SuppressWarnings) {
delete mRSContext;
mRSContext = NULL;
mGeneratedFileNames.clear();
- Slang::reset();
+ Slang::reset(SuppressWarnings);
}
SlangRS::~SlangRS() {
diff --git a/slang_rs.h b/slang_rs.h
index 3a04444..828b656 100644
--- a/slang_rs.h
+++ b/slang_rs.h
@@ -112,7 +112,7 @@ class SlangRS : public Slang {
const std::list<std::pair<const char*, const char*> > &DepFiles,
const RSCCOptions &Opts);
- virtual void reset();
+ virtual void reset(bool SuppressWarnings = false);
virtual ~SlangRS();