[clang] 43606ef - Suppress an "unused variable" warning in release build

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 14:38:12 PDT 2020


Ah, thanks. (I'm going to see about renaming/restructuring that API - to
return Optional<APSInt> and be called 'get' rather than 'is' to make this
more clear)

On Mon, Mar 23, 2020 at 5:04 AM Mikhail Maltsev <Mikhail.Maltsev at arm.com>
wrote:

> Yes, it does. isIntegerConstantExpr assigns a value to CoprocNoAP.
>
> --
> Regards,
>    Mikhail Maltsev
>
> ________________________________________
> From: David Blaikie <dblaikie at gmail.com>
> Sent: Sunday, March 22, 2020 03:32
> To: Mikhail Maltsev; Mikhail Maltsev
> Cc: cfe-commits
> Subject: Re: [clang] 43606ef - Suppress an "unused variable" warning in
> release build
>
> Does "isIntegerConstantExpr" have side effects that are desired/necessary?
> Otherwise please change this to roll the isIntegerConstantExpr into the
> assert (so that it is only executed when asserts are enabled)
>
> On Tue, Mar 10, 2020 at 10:11 AM Mikhail Maltsev via cfe-commits <
> cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>> wrote:
>
> Author: Mikhail Maltsev
> Date: 2020-03-10T17:10:52Z
> New Revision: 43606efb6847fc9c79e7d93760a2a6191e8a8539
>
> URL:
> https://github.com/llvm/llvm-project/commit/43606efb6847fc9c79e7d93760a2a6191e8a8539
> DIFF:
> https://github.com/llvm/llvm-project/commit/43606efb6847fc9c79e7d93760a2a6191e8a8539.diff
>
> LOG: Suppress an "unused variable" warning in release build
>
> Added:
>
>
> Modified:
>     clang/lib/Sema/SemaChecking.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/clang/lib/Sema/SemaChecking.cpp
> b/clang/lib/Sema/SemaChecking.cpp
> index 24d0d9209a1d..8a2b4b019663 100644
> --- a/clang/lib/Sema/SemaChecking.cpp
> +++ b/clang/lib/Sema/SemaChecking.cpp
> @@ -2094,6 +2094,7 @@ bool Sema::CheckARMCoprocessorImmediate(const Expr
> *CoprocArg, bool WantCDE) {
>
>    llvm::APSInt CoprocNoAP;
>    bool IsICE = CoprocArg->isIntegerConstantExpr(CoprocNoAP, Context);
> +  (void)IsICE;
>    assert(IsICE && "Coprocossor immediate is not a constant expression");
>    int64_t CoprocNo = CoprocNoAP.getExtValue();
>    assert(CoprocNo >= 0 && "Coprocessor immediate must be non-negative");
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200323/0fa0411c/attachment.html>


More information about the cfe-commits mailing list