From bc313ae9af58cc0f3c4355afba59759da2d25c52 Mon Sep 17 00:00:00 2001 From: varun-r-mallya 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 --- 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