[PATCH] D19972: [scan-build] fix warnings emitted on LLVM dsymutil code base

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 12:45:26 PDT 2016


+Fred

> On 2016-May-05, at 07:04, Apelete Seketeli <apelete at seketeli.net> wrote:
> 
> apelete created this revision.
> apelete added reviewers: dexonsmith, aprantl.
> apelete added a subscriber: llvm-commits.
> 
> Fix a logic error warning of the type "called C++ object pointer is
> null" emitted by Clang Static Analyzer on the following file:
> 
> - tools/dsymutil/DwarfLinker.cpp.

Maybe this hides the warning, but if the static analyzer is suggesting this
could be null, doesn't that indicate a real bug?

> 
> Signed-off-by: Apelete Seketeli <apelete at seketeli.net>
> 
> http://reviews.llvm.org/D19972
> 
> Files:
>  tools/dsymutil/DwarfLinker.cpp
> 
> Index: tools/dsymutil/DwarfLinker.cpp
> ===================================================================
> --- tools/dsymutil/DwarfLinker.cpp
> +++ tools/dsymutil/DwarfLinker.cpp
> @@ -2449,6 +2449,8 @@
>   Attr = Loc ? static_cast<DIEValueList *>(Loc)
>              : static_cast<DIEValueList *>(Block);
> 
> +  assert(Attr && "DIEValue list needs to be not NULL");
> +
>   if (Loc)
>     Value = DIEValue(dwarf::Attribute(AttrSpec.Attr),
>                      dwarf::Form(AttrSpec.Form), Loc);
> 
> 
> <D19972.56281.patch>



More information about the llvm-commits mailing list