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

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 09:04:10 PST 2016


This looks straight-forward. r259801.

Thanks,
Hans

On Wed, Feb 3, 2016 at 8:30 PM, xiuli pan <xiulipan at outlook.com> wrote:
> Hi Hans,
> I think this should be merged in release 3.8 to avoid linkage fails on release version.
> Request to merge in release 3.8
>
> Thanks
> Xiuli
>
>
> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf Of Todd Fiala via llvm-commits
> Sent: Thursday, February 4, 2016 5:13 AM
> To: llvm-commits at lists.llvm.org
> Subject: [llvm] r259695 - Address NDEBUG-related linkage issues for Value::assertModuleIsMaterialized()
>
> 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


More information about the llvm-commits mailing list