[PATCH] D19959: [scan-build] fix warning emitted on Clang Driver code baseFix a "logic error" warning of the type Called c++ object pointer isnull" reported by Clang Static Analyzer on the file:- lib/Driver/Tools.cpp.

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Thu May 5 13:04:37 PDT 2016


Apelete Seketeli via cfe-commits <cfe-commits at lists.llvm.org> writes:
> apelete created this revision.
> apelete added reviewers: kevin.qin, rsmith.
> apelete added a subscriber: cfe-commits.
>
> Signed-off-by: Apelete Seketeli <apelete at seketeli.net>
>
> http://reviews.llvm.org/D19959
>
> Files:
>   lib/Driver/Tools.cpp
>
> Index: lib/Driver/Tools.cpp
> ===================================================================
> --- lib/Driver/Tools.cpp
> +++ lib/Driver/Tools.cpp
> @@ -2346,7 +2346,7 @@
>      success = getAArch64MicroArchFeaturesFromMcpu(D, getAArch64TargetCPU(Args),
>                                                    Args, Features);
>  
> -  if (!success)
> +  if (!success && A)
>      D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
>  
>    if (Args.getLastArg(options::OPT_mgeneral_regs_only)) {

This doesn't look right. The case where (!Success && !A) needs *some*
kind of diagnosic, doesn't it? I guess the value of OPT_arch was invalid
in that case.

I think this change just papers over a real diagnostic bug.


More information about the cfe-commits mailing list