[llvm] [BPF] Add null check for File in BTFDebug::populateFileContent (PR #165206)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 26 23:06:30 PDT 2025


https://github.com/varun-r-mallya updated https://github.com/llvm/llvm-project/pull/165206

>From bc313ae9af58cc0f3c4355afba59759da2d25c52 Mon Sep 17 00:00:00 2001
From: varun-r-mallya <varunrmallya at gmail.com>
Date: Mon, 27 Oct 2025 11:31:59 +0530
Subject: [PATCH] [BPF] Add null check for File in
 BTFDebug::populateFileContent

Fixes llvm#165202

Signed-off-by: varun-r-mallya <varunrmallya at gmail.com>
---
 llvm/lib/Target/BPF/BTFDebug.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index a652b7e9c537f..0da3ff908a490 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -1095,6 +1095,9 @@ void BTFDebug::visitMapDefType(const DIType *Ty, uint32_t &TypeId) {
 std::string BTFDebug::populateFileContent(const DIFile *File) {
   std::string FileName;
 
+  if (!File)
+    return "";
+
   if (!File->getFilename().starts_with("/") && File->getDirectory().size())
     FileName = File->getDirectory().str() + "/" + File->getFilename().str();
   else



More information about the llvm-commits mailing list