[llvm] r230169 - RewriteStatepointsForGC.cpp: Fix for -Asserts to mark isNullConstant() as LLVM_ATTRIBUTE_UNUSED. [-Wunused-function]

David Blaikie dblaikie at gmail.com
Sun Feb 22 13:03:39 PST 2015


On Sun, Feb 22, 2015 at 1:58 AM, NAKAMURA Takumi <geek4civic at gmail.com>
wrote:

> Author: chapuni
> Date: Sun Feb 22 03:58:19 2015
> New Revision: 230169
>
> URL: http://llvm.org/viewvc/llvm-project?rev=230169&view=rev
> Log:
> RewriteStatepointsForGC.cpp: Fix for -Asserts to mark isNullConstant() as
> LLVM_ATTRIBUTE_UNUSED. [-Wunused-function]
>
> Modified:
>     llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=230169&r1=230168&r2=230169&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Sun Feb
> 22 03:58:19 2015
> @@ -300,7 +300,7 @@ analyzeParsePointLiveness(DominatorTree
>  }
>
>  /// True iff this value is the null pointer constant (of any pointer type)
> -static bool isNullConstant(Value *V) {
> +static bool LLVM_ATTRIBUTE_UNUSED isNullConstant(Value *V) {
>

I'm inclined to wrap such functions in 'ifndef NDEBUG' rather than use
LLVM_ATTRIBUTE_UNUSED to ensure that if this becomes unused in assertions,
we can remove it (rather than it lying around unused indefinitiely). How do
other people feel about this?

Perhaps we could change LLVM_ATTRIBUTE_UNUSED to only expand to the
attribute in non-asserts builds so we'd still get the warning in an asserts
build that no longer called the function? (at which point maybe have a
different macro name for this purpose?)


>    return isa<Constant>(V) && isa<PointerType>(V->getType()) &&
>           cast<Constant>(V)->isNullValue();
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150222/c989f42f/attachment.html>


More information about the llvm-commits mailing list