Commit 8fab4f98c4

Garrett Beck <garrettlennoxbeck@gmail.com>
2023-09-23 23:56:00
Prevent hitting a clang assert when dealing with FullSourceLoc
1 parent 28ac9f8
Changed files (1)
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();