[llvm] r259695 - Address NDEBUG-related linkage issues for Value::assertModuleIsMaterialized()

Todd Fiala via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 19:20:13 PST 2016


My pleasure :-)

On Thu, Feb 4, 2016 at 7:19 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com
> wrote:

> Thanks a lot.
>
> So sorry I missed the patch when it first went out for review.
>
> Cheers,
> Rafael
>
>
> On 3 February 2016 at 16:13, Todd Fiala via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Author: tfiala
> > Date: Wed Feb  3 15:13:23 2016
> > New Revision: 259695
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=259695&view=rev
> > Log:
> > 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
> >
> > Modified:
> >     llvm/trunk/include/llvm/IR/Value.h
> >     llvm/trunk/lib/IR/Value.cpp
> >
> > Modified: llvm/trunk/include/llvm/IR/Value.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Value.h?rev=259695&r1=259694&r2=259695&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/IR/Value.h (original)
> > +++ llvm/trunk/include/llvm/IR/Value.h Wed Feb  3 15:13:23 2016
> > @@ -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();
> >
> > Modified: llvm/trunk/lib/IR/Value.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Value.cpp?rev=259695&r1=259694&r2=259695&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/IR/Value.cpp (original)
> > +++ llvm/trunk/lib/IR/Value.cpp Wed Feb  3 15:13:23 2016
> > @@ -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()
> >    if (!M)
> >      return;
> >    assert(M->isMaterialized());
> > +#endif
> >  }
> >
> > +#ifndef NDEBUG
> >  static bool contains(SmallPtrSetImpl<ConstantExpr *> &Cache,
> ConstantExpr *Expr,
> >                       Constant *C) {
> >    if (!Cache.insert(Expr).second)
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>



-- 
-Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160204/df6d7111/attachment.html>


More information about the llvm-commits mailing list