[PATCH] D19960: [scan-build] fix warnings emitted on Clang CodeGen code base
Apelete Seketeli via cfe-commits
cfe-commits at lists.llvm.org
Thu May 5 03:15:35 PDT 2016
apelete created this revision.
apelete added reviewers: dblaikie, pcc.
apelete added a subscriber: cfe-commits.
Fix "Logic error" warnings of the type "Called c++ object pointer is
null" reported by Clang Static Analyzer on the following files:
- lib/CodeGen/CGDebugInfo.cpp,
- lib/CodeGen/CodeGenModule.cpp.
Signed-off-by: Apelete Seketeli <apelete at seketeli.net>
http://reviews.llvm.org/D19960
Files:
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CodeGenModule.cpp
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2299,6 +2299,7 @@
unsigned CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D,
unsigned AddrSpace) {
+ assert(D && "variable declaration must be not NULL");
if (LangOpts.CUDA && LangOpts.CUDAIsDevice) {
if (D->hasAttr<CUDAConstantAttr>())
AddrSpace = getContext().getTargetAddressSpace(LangAS::cuda_constant);
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1314,6 +1314,7 @@
CGM.getContext().toCharUnitsFromBits((int64_t)fieldOffset);
V = CGM.getCXXABI().EmitMemberDataPointer(MPT, chars);
}
+ assert(V && "constant must be not NULL at this point");
TemplateParams.push_back(DBuilder.createTemplateValueParameter(
TheCU, Name, TTy,
cast_or_null<llvm::Constant>(V->stripPointerCasts())));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19960.56254.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160505/2ca2a562/attachment.bin>
More information about the cfe-commits
mailing list