Fix an ODR violation consisting of two 'struct Query' in the global namespace.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 12 Sep 2014 08:56:53 +0000 (08:56 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 12 Sep 2014 08:56:53 +0000 (08:56 +0000)
Put them in their own anonymous namespaces. Found by GCC's new -Wodr (PR20915).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217662 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/InstructionSimplify.cpp
lib/Analysis/ValueTracking.cpp

index cd795fdb7812d0373afa2932c5c0d2a1360b0158..32bc25ad8c8a362a3bf4a1dcd51938d6bc345058 100644 (file)
@@ -41,6 +41,7 @@ enum { RecursionLimit = 3 };
 STATISTIC(NumExpand,  "Number of expansions");
 STATISTIC(NumReassoc, "Number of reassociations");
 
+namespace {
 struct Query {
   const DataLayout *DL;
   const TargetLibraryInfo *TLI;
@@ -53,6 +54,7 @@ struct Query {
         const Instruction *cxti = nullptr)
     : DL(DL), TLI(tli), DT(dt), AT(at), CxtI(cxti) {}
 };
+} // end anonymous namespace
 
 static Value *SimplifyAndInst(Value *, Value *, const Query &, unsigned);
 static Value *SimplifyBinOp(unsigned, Value *, Value *, const Query &,
index 74c862a88dd69f81c9df7d6c0f6b27abf7184e99..f208bb72e2e7f0338a37b940e11587901919cec9 100644 (file)
@@ -58,6 +58,7 @@ static unsigned getBitWidth(Type *Ty, const DataLayout *TD) {
 // isKnownToBeAPowerOfTwo (all of which can call computeKnownBits), and so on.
 typedef SmallPtrSet<const Value *, 8> ExclInvsSet;
 
+namespace {
 // Simplifying using an assume can only be done in a particular control-flow
 // context (the context instruction provides that context). If an assume and
 // the context instruction are not in the same block then the DT helps in
@@ -77,6 +78,7 @@ struct Query {
     ExclInvs.insert(NewExcl);
   }
 };
+} // end anonymous namespace
 
 // Given the provided Value and, potentially, a context instruction, returned
 // the preferred context instruction (if any).