summaryrefslogtreecommitdiff
path: root/lib/Linker
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2014-02-06 18:01:56 +0000
committerEli Bendersky <eliben@google.com>2014-02-06 18:01:56 +0000
commit6984ee6aa262a0ab3b49a161066f4fab941a2ee6 (patch)
tree52fd4ac000f3cc3b4a9b8474267d29e39e53aa58 /lib/Linker
parentefcc73627022baf95d19101155ec106a0db55cef (diff)
downloadllvm-6984ee6aa262a0ab3b49a161066f4fab941a2ee6.tar.gz
llvm-6984ee6aa262a0ab3b49a161066f4fab941a2ee6.tar.bz2
llvm-6984ee6aa262a0ab3b49a161066f4fab941a2ee6.tar.xz
Add a -suppress-warnings option to bitcode linking.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200927 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r--lib/Linker/LinkModules.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 4c86a825c8..df9d9c9842 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -19,12 +19,18 @@
#include "llvm/IR/Constants.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/TypeFinder.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include <cctype>
using namespace llvm;
+
+static cl::opt<bool>
+SuppressWarnings("suppress-warnings", cl::desc("Suppress all linking warnings"),
+ cl::init(false));
+
//===----------------------------------------------------------------------===//
// TypeMap implementation.
//===----------------------------------------------------------------------===//
@@ -1134,8 +1140,10 @@ bool ModuleLinker::linkModuleFlagsMetadata() {
case Module::Warning: {
// Emit a warning if the values differ.
if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
- errs() << "WARNING: linking module flags '" << ID->getString()
- << "': IDs have conflicting values";
+ if (!SuppressWarnings) {
+ errs() << "WARNING: linking module flags '" << ID->getString()
+ << "': IDs have conflicting values";
+ }
}
continue;
}
@@ -1201,15 +1209,20 @@ bool ModuleLinker::run() {
DstM->setTargetTriple(SrcM->getTargetTriple());
if (!SrcM->getDataLayout().empty() && !DstM->getDataLayout().empty() &&
- SrcM->getDataLayout() != DstM->getDataLayout())
- errs() << "WARNING: Linking two modules of different data layouts!\n";
+ SrcM->getDataLayout() != DstM->getDataLayout()) {
+ if (!SuppressWarnings) {
+ errs() << "WARNING: Linking two modules of different data layouts!\n";
+ }
+ }
if (!SrcM->getTargetTriple().empty() &&
DstM->getTargetTriple() != SrcM->getTargetTriple()) {
- errs() << "WARNING: Linking two modules of different target triples: ";
- if (!SrcM->getModuleIdentifier().empty())
- errs() << SrcM->getModuleIdentifier() << ": ";
- errs() << "'" << SrcM->getTargetTriple() << "' and '"
- << DstM->getTargetTriple() << "'\n";
+ if (!SuppressWarnings) {
+ errs() << "WARNING: Linking two modules of different target triples: ";
+ if (!SrcM->getModuleIdentifier().empty())
+ errs() << SrcM->getModuleIdentifier() << ": ";
+ errs() << "'" << SrcM->getTargetTriple() << "' and '"
+ << DstM->getTargetTriple() << "'\n";
+ }
}
// Append the module inline asm string.