Suppress warnings on our second compilation (for 64-bit).
Bug: 16031597
Bug: 17052573
Without this patch the 64-bit compilation path will print duplicate warning
diagnostics, since we call the frontend twice (for 32-bit, and then 64-bit).
The simplest fix is to not print warnings for the second compilation. A bug
(17052573) has been filed to track fixing this a better way (actually printing
out all warning diagnostics, but removing duplicates explicitly).
Change-Id: I78ac0ebd2b132713ec0c86c2cf234da2b620eecf
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 @@
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 @@
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;
}