[PATCH] D146634: [clang][USR] Prevent crashes when parameter lists have nulls

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 08:20:57 PDT 2023


kadircet created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
kadircet requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Similar to D146426 <https://reviews.llvm.org/D146426>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146634

Files:
  clang/lib/Index/USRGeneration.cpp


Index: clang/lib/Index/USRGeneration.cpp
===================================================================
--- clang/lib/Index/USRGeneration.cpp
+++ clang/lib/Index/USRGeneration.cpp
@@ -262,6 +262,12 @@
 
   // Mangle in type information for the arguments.
   for (auto *PD : D->parameters()) {
+    // FIXME: Make sure we don't have nullptrs in parameter lists of function
+    // decls.
+    if (!PD) {
+      IgnoreResults = true;
+      return;
+    }
     Out << '#';
     VisitType(PD->getType());
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146634.507369.patch
Type: text/x-patch
Size: 512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230322/25ea42f9/attachment.bin>


More information about the cfe-commits mailing list