1- From bc45ac83e97e4bbe12ed431fc40b817b6d46b2e9 Mon Sep 17 00:00:00 2001
1+ From 50641c790360fde4e6dd518e76b5fdb3a08c8299 Mon Sep 17 00:00:00 2001
22From: Peter Goodman <
[email protected] >
33Date: Mon, 14 Nov 2022 14:51:27 -0500
44Subject: [PATCH] Patches for PASTA
@@ -8,7 +8,7 @@ Subject: [PATCH] Patches for PASTA
88 clang/include/clang/Lex/PPCallbacks.h | 120 ++++++++++
99 clang/include/clang/Lex/Preprocessor.h | 46 ++--
1010 clang/include/clang/Lex/TokenLexer.h | 7 +-
11- clang/lib/AST/ASTContext.cpp | 120 +++++++---
11+ clang/lib/AST/ASTContext.cpp | 124 + +++++++---
1212 clang/lib/AST/ExprConstant.cpp | 9 +
1313 clang/lib/AST/ItaniumMangle.cpp | 8 +
1414 clang/lib/AST/Type.cpp | 9 +-
@@ -26,7 +26,7 @@ Subject: [PATCH] Patches for PASTA
2626 clang/lib/Sema/SemaExpr.cpp | 32 ++-
2727 clang/lib/Sema/SemaExprCXX.cpp | 1 +
2828 clang/lib/Sema/TreeTransform.h | 24 ++
29- 22 files changed, 950 insertions(+), 114 deletions(-)
29+ 22 files changed, 953 insertions(+), 115 deletions(-)
3030
3131diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
3232index 84fc0893c..102e20a92 100644
@@ -330,7 +330,7 @@ index 4d229ae61..923107b84 100644
330330 public:
331331 /// Create a TokenLexer for the specified macro with the specified actual
332332diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
333- index cfd7bf604..6a384a35c 100644
333+ index cfd7bf604..c70ebd052 100644
334334--- a/clang/lib/AST/ASTContext.cpp
335335+++ b/clang/lib/AST/ASTContext.cpp
336336@@ -3519,48 +3519,94 @@ QualType ASTContext::getConstantArrayType(QualType EltTy,
@@ -459,7 +459,7 @@ index cfd7bf604..6a384a35c 100644
459459 cat->getSizeExpr(),
460460 cat->getSizeModifier(),
461461 cat->getIndexTypeCVRQualifiers());
462- +
462+ +
463463+ // PASTA PATCH: If we returned an adjusted type above, then we want to
464464+ // desugar it to the internal type.
465465+ if (auto AT = dyn_cast<AdjustedType>(result.getTypePtr())) {
@@ -468,11 +468,13 @@ index cfd7bf604..6a384a35c 100644
468468 break;
469469 }
470470
471- @@ -6793,10 +6845,20 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) const {
471+ @@ -6792,11 +6844,23 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) const {
472+ // qualifiers into the array element type and return a new array type.
472473 QualType NewEltTy = getQualifiedType(ATy->getElementType(), qs);
473474
474- if (const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
475+ - if (const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
475476- return cast<ArrayType>(getConstantArrayType(NewEltTy, CAT->getSize(),
477+ + if (const auto *CAT = dyn_cast<ConstantArrayType>(ATy)) {
476478+
477479+ // PASTA PATCH: `getConstantArrayType` might return an adjusted type.
478480+ QualType result = getConstantArrayType(NewEltTy, CAT->getSize(),
@@ -488,6 +490,8 @@ index cfd7bf604..6a384a35c 100644
488490+ }
489491+
490492+ return cast<ArrayType>(result);
493+ + }
494+ +
491495 if (const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
492496 return cast<ArrayType>(getIncompleteArrayType(NewEltTy,
493497 IAT->getSizeModifier(),
0 commit comments