-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clang patch to not crash on invalid sourcelocs for arrays as the last…
… field of a union (#1023)
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
ports/llvm-16/0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters