Skip to content

Commit 3f3c940

Browse files
authored
Update to LLVM 16.0.3. Update PASTA patch (#1020)
1 parent ba043dd commit 3f3c940

File tree

3 files changed

+65
-21
lines changed

3 files changed

+65
-21
lines changed

ports/llvm-16/0025-PASTA-patches.patch

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
From 9d2260a0e0fae9132206d2ff93378d3630743251 Mon Sep 17 00:00:00 2001
1+
From 663bfa3a1a437c1538fc43d9c0e1fcaefb3a8d09 Mon Sep 17 00:00:00 2001
22
From: Peter Goodman <peter.goodman@gmail.com>
3-
Date: Thu, 20 Apr 2023 00:23:41 -0400
4-
Subject: [PATCH] Patches for PASTA.
3+
Date: Mon, 8 May 2023 12:48:13 -0400
4+
Subject: [PATCH] PASTA patches for LLVM 16.0.3.
55

66
---
7+
clang/include/clang/AST/PrettyPrinter.h | 10 +-
78
clang/include/clang/Basic/TokenKinds.def | 7 +
89
clang/include/clang/Lex/PPCallbacks.h | 14 +
910
.../include/clang/Lex/PPCallbacksEventKind.h | 168 +++++++++++
1011
clang/include/clang/Lex/Preprocessor.h | 46 ++-
1112
clang/include/clang/Lex/TokenLexer.h | 7 +-
12-
clang/lib/AST/ASTContext.cpp | 130 +++++++--
13+
clang/lib/AST/ASTContext.cpp | 129 +++++++--
1314
clang/lib/AST/ExprConstant.cpp | 9 +
1415
clang/lib/AST/ItaniumMangle.cpp | 8 +
1516
clang/lib/AST/Type.cpp | 9 +-
17+
clang/lib/Basic/SourceManager.cpp | 3 +-
1618
clang/lib/Lex/Lexer.cpp | 9 +
1719
clang/lib/Lex/PPDirectives.cpp | 148 +++++++---
1820
clang/lib/Lex/PPExpressions.cpp | 29 ++
@@ -27,9 +29,37 @@ Subject: [PATCH] Patches for PASTA.
2729
clang/lib/Sema/SemaExpr.cpp | 32 ++-
2830
clang/lib/Sema/SemaExprCXX.cpp | 1 +
2931
clang/lib/Sema/TreeTransform.h | 24 ++
30-
23 files changed, 1223 insertions(+), 123 deletions(-)
32+
25 files changed, 1233 insertions(+), 125 deletions(-)
3133
create mode 100644 clang/include/clang/Lex/PPCallbacksEventKind.h
3234

35+
diff --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h
36+
index 5aeaca7be..643cd7e5d 100644
37+
--- a/clang/include/clang/AST/PrettyPrinter.h
38+
+++ b/clang/include/clang/AST/PrettyPrinter.h
39+
@@ -76,7 +76,8 @@ struct PrintingPolicy {
40+
PrintCanonicalTypes(false), PrintInjectedClassNameWithArguments(true),
41+
UsePreferredNames(true), AlwaysIncludeTypeForTemplateArgument(false),
42+
CleanUglifiedParameters(false), EntireContentsOfLargeArray(true),
43+
- UseEnumerators(true) {}
44+
+ UseEnumerators(true), PrintAdjustedArrayType(true),
45+
+ PrintSubstitutedTemplateParameters(false) {}
46+
47+
/// Adjust this printing policy for cases where it's known that we're
48+
/// printing C++ code (for instance, if AST dumping reaches a C++-only
49+
@@ -299,6 +300,13 @@ struct PrintingPolicy {
50+
/// enumerator name or via cast of an integer.
51+
unsigned UseEnumerators : 1;
52+
53+
+ /// PASTA PATCH: Should we print the adjusted array type, or the original
54+
+ /// array type?
55+
+ unsigned PrintAdjustedArrayType : 1;
56+
+
57+
+ /// PASTA PATCH: Should we print substituted template parameters?
58+
+ unsigned PrintSubstitutedTemplateParameters : 1;
59+
+
60+
/// Callbacks to use to allow the behavior of printing to be customized.
61+
const PrintingCallbacks *Callbacks = nullptr;
62+
};
3363
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
3464
index 96feae991..0fa2f84d5 100644
3565
--- a/clang/include/clang/Basic/TokenKinds.def
@@ -400,10 +430,10 @@ index 4d229ae61..923107b84 100644
400430
public:
401431
/// Create a TokenLexer for the specified macro with the specified actual
402432
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
403-
index 2884fe660..660887abc 100644
433+
index 2884fe660..3248f650d 100644
404434
--- a/clang/lib/AST/ASTContext.cpp
405435
+++ b/clang/lib/AST/ASTContext.cpp
406-
@@ -3545,49 +3545,99 @@ QualType ASTContext::getConstantArrayType(QualType EltTy,
436+
@@ -3545,49 +3545,98 @@ QualType ASTContext::getConstantArrayType(QualType EltTy,
407437
EltTy->isIncompleteType() || EltTy->isConstantSizeType()) &&
408438
"Constant array of VLAs is illegal!");
409439

@@ -447,8 +477,7 @@ index 2884fe660..660887abc 100644
447477
+ void *OrigInsertPos = nullptr;
448478
+ ConstantArrayType *OrigATP = nullptr;
449479
+ if (OrigSizeExpr) {
450-
+ ConstantArrayType::Profile(OrigID, *this, EltTy, ArySize, OrigSizeExpr, ASM,
451-
+ IndexTypeQuals);
480+
+ OrigID.AddPointer(OrigSizeExpr); // Want uniqueness.
452481
+ OrigATP = ConstantArrayTypes.FindNodeOrInsertPos(OrigID, OrigInsertPos);
453482
+ }
454483
+
@@ -531,7 +560,7 @@ index 2884fe660..660887abc 100644
531560
}
532561

533562
/// getVariableArrayDecayedType - Turns the given type, which may be
534-
@@ -3688,6 +3738,12 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const {
563+
@@ -3688,6 +3737,12 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const {
535564
cat->getSizeExpr(),
536565
cat->getSizeModifier(),
537566
cat->getIndexTypeCVRQualifiers());
@@ -544,7 +573,7 @@ index 2884fe660..660887abc 100644
544573
break;
545574
}
546575

547-
@@ -6867,11 +6923,23 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) const {
576+
@@ -6867,11 +6922,23 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) const {
548577
// qualifiers into the array element type and return a new array type.
549578
QualType NewEltTy = getQualifiedType(ATy->getElementType(), qs);
550579

@@ -631,6 +660,20 @@ index 54e62a193..324468784 100644
631660

632661
#define TYPE(Class,Base)
633662
#define DEPENDENT_TYPE(Class,Base) case Type::Class:
663+
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
664+
index 3d7a53879..8942ff1f7 100644
665+
--- a/clang/lib/Basic/SourceManager.cpp
666+
+++ b/clang/lib/Basic/SourceManager.cpp
667+
@@ -865,7 +865,8 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
668+
/// local one.
669+
FileID SourceManager::getFileIDLoaded(SourceLocation::UIntTy SLocOffset) const {
670+
if (SLocOffset < CurrentLoadedOffset) {
671+
- assert(0 && "Invalid SLocOffset or bad function choice");
672+
+ // PASTA PATCH: https://github.com/trailofbits/pasta/issues/57.
673+
+ // assert(0 && "Invalid SLocOffset or bad function choice");
674+
return FileID();
675+
}
676+
634677
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
635678
index d49d9e9e4..56a8dbe9e 100644
636679
--- a/clang/lib/Lex/Lexer.cpp
@@ -1957,7 +2000,7 @@ index 0d411abf8..03e08ac24 100644
19572000

19582001
if (Result.is(tok::unknown) && TheModuleLoader.HadFatalFailure)
19592002
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp
1960-
index ebe7dd66c..d3382d3c3 100644
2003+
index ebe7dd66c..6b6805e29 100644
19612004
--- a/clang/lib/Lex/TokenLexer.cpp
19622005
+++ b/clang/lib/Lex/TokenLexer.cpp
19632006
@@ -21,6 +21,7 @@
@@ -2344,7 +2387,7 @@ index ebe7dd66c..d3382d3c3 100644
23442387
+ Callbacks->Event(
23452388
+ TokenStream[CurIdx - 1u],
23462389
+ PPCallbacks::ConcatenationOperatorToken,
2347-
+ reinterpret_cast<uintptr_t>(&LHSTok));
2390+
+ reinterpret_cast<uintptr_t>(&LHSTok));
23482391
+ }
23492392
+ Callbacks->Event(
23502393
+ RHS,
@@ -2560,10 +2603,10 @@ index abf5a72e7..f6eb0ca11 100644
25602603
// GCC ignores cv-qualifiers on arrays for this builtin.
25612604
Qualifiers LhsQuals, RhsQuals;
25622605
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
2563-
index 48bb28b56..8e3243b86 100644
2606+
index 4244bbc1e..83046c48c 100644
25642607
--- a/clang/lib/Sema/TreeTransform.h
25652608
+++ b/clang/lib/Sema/TreeTransform.h
2566-
@@ -5309,6 +5309,12 @@ TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
2609+
@@ -5306,6 +5306,12 @@ TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
25672610
return QualType();
25682611
}
25692612

@@ -2576,7 +2619,7 @@ index 48bb28b56..8e3243b86 100644
25762619
// We might have either a ConstantArrayType or a VariableArrayType now:
25772620
// a ConstantArrayType is allowed to have an element type which is a
25782621
// VariableArrayType if the type is dependent. Fortunately, all array
2579-
@@ -5341,6 +5347,12 @@ QualType TreeTransform<Derived>::TransformIncompleteArrayType(
2622+
@@ -5338,6 +5344,12 @@ QualType TreeTransform<Derived>::TransformIncompleteArrayType(
25802623
return QualType();
25812624
}
25822625

@@ -2589,7 +2632,7 @@ index 48bb28b56..8e3243b86 100644
25892632
IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(Result);
25902633
NewTL.setLBracketLoc(TL.getLBracketLoc());
25912634
NewTL.setRBracketLoc(TL.getRBracketLoc());
2592-
@@ -5386,6 +5398,12 @@ TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
2635+
@@ -5383,6 +5395,12 @@ TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
25932636
return QualType();
25942637
}
25952638

@@ -2602,7 +2645,7 @@ index 48bb28b56..8e3243b86 100644
26022645
// We might have constant size array now, but fortunately it has the same
26032646
// location layout.
26042647
ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(Result);
2605-
@@ -5434,6 +5452,12 @@ TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
2648+
@@ -5431,6 +5449,12 @@ TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
26062649
return QualType();
26072650
}
26082651

@@ -2617,3 +2660,4 @@ index 48bb28b56..8e3243b86 100644
26172660
ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(Result);
26182661
--
26192662
2.40.0
2663+

ports/llvm-16/portfile.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
set(LLVM_VERSION "16.0.2")
1+
set(LLVM_VERSION "16.0.3")
22

33
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
44

55
vcpkg_from_github(
66
OUT_SOURCE_PATH SOURCE_PATH
77
REPO llvm/llvm-project
88
REF llvmorg-${LLVM_VERSION}
9-
SHA512 56ddd825cf1470fc932dfa9b58ec37e37cffae368cf60a4ab20bc86525220ac1e8606cd0b925d59ecd239e42151e0776596c86ba4efae99ff50d2eaf0853d86b
9+
SHA512 a6ce82ab402a0360cad673561bc7bd53dfdff9230fcb63b3264a4fe28b5a347c4787b087da604a6e890958e6be22cbd3630657debda1ef3380e466b9d983a37f
1010
HEAD_REF release/16.x
1111
PATCHES
1212
0001-Fix-install-paths.patch

ports/llvm-16/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "llvm-16",
3-
"version": "16.0.2",
3+
"version": "16.0.3",
44
"description": "The LLVM Compiler Infrastructure.",
55
"homepage": "https://llvm.org",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)