Skip to content

Commit

Permalink
Check for nullptr argument.
Browse files Browse the repository at this point in the history
Addresses static analysis report in PR15492.

Differential Revision: http://reviews.llvm.org/D20141

llvm-svn: 270086
  • Loading branch information
Artem-B committed May 19, 2016
1 parent 504c01c commit 2c323a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,

// Check that D is not yet in DiagnosedConflictingDefinitions is required
// to make sure that we issue an error only once.
if (lookupRepresentativeDecl(MangledName, OtherGD) &&
if (D && lookupRepresentativeDecl(MangledName, OtherGD) &&
(D->getCanonicalDecl() != OtherGD.getCanonicalDecl().getDecl()) &&
(OtherD = dyn_cast<VarDecl>(OtherGD.getDecl())) &&
OtherD->hasInit() &&
Expand Down Expand Up @@ -2301,7 +2301,7 @@ CharUnits CodeGenModule::GetTargetTypeStoreSize(llvm::Type *Ty) const {

unsigned CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D,
unsigned AddrSpace) {
if (LangOpts.CUDA && LangOpts.CUDAIsDevice) {
if (D && LangOpts.CUDA && LangOpts.CUDAIsDevice) {
if (D->hasAttr<CUDAConstantAttr>())
AddrSpace = getContext().getTargetAddressSpace(LangAS::cuda_constant);
else if (D->hasAttr<CUDASharedAttr>())
Expand Down

0 comments on commit 2c323a0

Please sign in to comment.