Skip to content

Commit

Permalink
clang patch to not crash on invalid sourcelocs for arrays as the last…
Browse files Browse the repository at this point in the history
… field of a union (#1023)
  • Loading branch information
2over12 authored May 31, 2023
1 parent 633ac47 commit 5992136
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From efcdeb698fe6a475d1eb0a8f4770ef974cefb0e1 Mon Sep 17 00:00:00 2001
From: 2over12 <[email protected]>
Date: Wed, 31 May 2023 08:57:45 -0400
Subject: [PATCH] Do not attempt to find macro expansions if there is invalid
source info for a decl

---
clang/lib/AST/Expr.cpp | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index e45ae68cd5fe..59a7d50d8ad3 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -263,6 +263,10 @@ bool Expr::isFlexibleArrayMemberLike(
TypeSourceInfo *TInfo = FD->getTypeSourceInfo();
while (TInfo) {
TypeLoc TL = TInfo->getTypeLoc();
+ if (TL.getSourceRange().isInvalid()) {
+ break;
+ }
+
// Look through typedefs.
if (TypedefTypeLoc TTL = TL.getAsAdjusted<TypedefTypeLoc>()) {
const TypedefNameDecl *TDL = TTL.getTypedefNameDecl();
--
2.39.2 (Apple Git-143)

1 change: 1 addition & 0 deletions ports/llvm-16/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ vcpkg_from_github(
0020-fix-FindZ3.cmake.patch
0021-fix-find_dependency.patch
0026-fix-prefix-path-calc.patch
0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch
)

if("pasta" IN_LIST FEATURES)
Expand Down

0 comments on commit 5992136

Please sign in to comment.