From 8fab4f98c4ee511ba56fec2f38e2d80535c327a9 Mon Sep 17 00:00:00 2001 From: Garrett Beck Date: Sat, 23 Sep 2023 16:56:00 -0500 Subject: [PATCH] Prevent hitting a clang assert when dealing with FullSourceLoc --- src/zig_clang.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp index 015e1a42c7..6930827a7a 100644 --- a/src/zig_clang.cpp +++ b/src/zig_clang.cpp @@ -3053,6 +3053,11 @@ ZigClangASTUnit *ZigClangLoadFromCommandLine(const char **args_begin, const char msg->msg_len = msg_str_ref.size(); clang::FullSourceLoc fsl = it->getLocation(); + + // Ensure the source location is valid before expanding it + if (fsl.isInvalid()) { + continue; + } // Expand the location if possible fsl = fsl.getFileLoc();