summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2016-02-03 21:13:23 +0000
committerTodd Fiala <todd.fiala@gmail.com>2016-02-03 21:13:23 +0000
commit675bdcedff0879e14dae42383d9b25fc6fd25861 (patch)
tree389a7e60fa3704bb0f336c991989a8e204186ba4
parentba043143a9fc9d59977d9c4bc54465603e43cecd (diff)
downloadbcm5719-llvm-675bdcedff0879e14dae42383d9b25fc6fd25861.tar.gz
bcm5719-llvm-675bdcedff0879e14dae42383d9b25fc6fd25861.zip
Address NDEBUG-related linkage issues for Value::assertModuleIsMaterialized()
The IR/Value class had a linkage issue present when LLVM was built as a library, and the LLVM library build time had different settings for NDEBUG than the client of the LLVM library. Clients could get into a state where the LLVM lib expected Value::assertModuleIsMaterialized() to be inline-defined in the header but clients expected that method to be defined in the LLVM library. See this llvm-commits thread for more details: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160201/329667.html llvm-svn: 259695
-rw-r--r--llvm/include/llvm/IR/Value.h4
-rw-r--r--llvm/lib/IR/Value.cpp4
2 files changed, 3 insertions, 5 deletions
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h
index 348ad977c09..c2997e9a4d1 100644
--- a/llvm/include/llvm/IR/Value.h
+++ b/llvm/include/llvm/IR/Value.h
@@ -280,11 +280,7 @@ public:
// when using them since you might not get all uses.
// The methods that don't start with materialized_ assert that modules is
// fully materialized.
-#ifdef NDEBUG
- void assertModuleIsMaterialized() const {}
-#else
void assertModuleIsMaterialized() const;
-#endif
bool use_empty() const {
assertModuleIsMaterialized();
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 250f451b6b4..955204a1bc2 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -314,8 +314,8 @@ void Value::takeName(Value *V) {
ST->reinsertValue(this);
}
-#ifndef NDEBUG
void Value::assertModuleIsMaterialized() const {
+#ifndef NDEBUG
const GlobalValue *GV = dyn_cast<GlobalValue>(this);
if (!GV)
return;
@@ -323,8 +323,10 @@ void Value::assertModuleIsMaterialized() const {
if (!M)
return;
assert(M->isMaterialized());
+#endif
}
+#ifndef NDEBUG
static bool contains(SmallPtrSetImpl<ConstantExpr *> &Cache, ConstantExpr *Expr,
Constant *C) {
if (!Cache.insert(Expr).second)
OpenPOWER on IntegriCloud