aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2016-05-19 18:00:18 +0000
committerArtem Belevich <tra@google.com>2016-05-19 18:00:18 +0000
commit2c323a0eae5804086cbc420cd965163af66bbe6d (patch)
treee03a66b77d9972b7b2245e701645e20251dc966d /clang/lib/CodeGen/CodeGenModule.cpp
parent504c01cc67cf6d6217c43c97ffb4d1e512c594a2 (diff)
downloadllvm-2c323a0eae5804086cbc420cd965163af66bbe6d.zip
llvm-2c323a0eae5804086cbc420cd965163af66bbe6d.tar.gz
llvm-2c323a0eae5804086cbc420cd965163af66bbe6d.tar.bz2
Check for nullptr argument.
Addresses static analysis report in PR15492. Differential Revision: http://reviews.llvm.org/D20141 llvm-svn: 270086
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 57a6429..0c75cf1 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -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() &&
@@ -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>())