[PATCH] D156274: [NFC] Avoid potential dereferencing of nullptr.

Sindhu Chittireddy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 16:23:39 PDT 2023


schittir created this revision.
schittir added reviewers: aaron.ballman, tahonermann, erichkeane.
Herald added a project: All.
schittir requested review of this revision.
Herald added subscribers: cfe-commits, wangpc.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156274

Files:
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/CodeGen/CGObjCMac.cpp
  clang/lib/Sema/SemaCodeComplete.cpp


Index: clang/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -6601,7 +6601,7 @@
   // The "template" keyword can follow "::" in the grammar, but only
   // put it into the grammar if the nested-name-specifier is dependent.
   // FIXME: results is always empty, this appears to be dead.
-  if (!Results.empty() && NNS->isDependent())
+  if (!Results.empty() && NNS && NNS->isDependent())
     Results.AddResult("template");
 
   // If the scope is a concept-constrained type parameter, infer nested
Index: clang/lib/CodeGen/CGObjCMac.cpp
===================================================================
--- clang/lib/CodeGen/CGObjCMac.cpp
+++ clang/lib/CodeGen/CGObjCMac.cpp
@@ -1803,6 +1803,7 @@
     }
 
     // Complex types.
+    assert(contBB);
     CGF.EmitBlock(contBB);
     CodeGenFunction::ComplexPairTy callResult = result.getComplexVal();
 
Index: clang/lib/AST/ItaniumMangle.cpp
===================================================================
--- clang/lib/AST/ItaniumMangle.cpp
+++ clang/lib/AST/ItaniumMangle.cpp
@@ -1656,6 +1656,7 @@
       // Otherwise, use the complete destructor name. This is relevant if a
       // class with a destructor is declared within a destructor.
       mangleCXXDtorType(Dtor_Complete);
+    assert(ND);
     writeAbiTags(ND, AdditionalAbiTags);
     break;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156274.544140.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230725/c8424977/attachment.bin>


More information about the cfe-commits mailing list