[PATCH] D20141: Check for nullptr argument.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 11:06:42 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL270086: Check for nullptr argument. (authored by tra).

Changed prior to commit:
  http://reviews.llvm.org/D20141?vs=56832&id=57825#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20141

Files:
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -2082,7 +2082,7 @@
 
       // 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 @@
 
 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>())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20141.57825.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160519/8e6bdd14/attachment-0001.bin>


More information about the cfe-commits mailing list