commit 8fab4f98c4ee511ba56fec2f38e2d80535c327a9 (tree)
parent 28ac9f8b704951010a49e33f405c4265bf3077d2
Author: Garrett Beck <garrettlennoxbeck@gmail.com>
Date: Sat, 23 Sep 2023 16:56:00 -0500
Prevent hitting a clang assert when dealing with FullSourceLoc
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git 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();