Skip to content

[AutoBump] Merge with ccd3defd (Feb 19) (58) #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 77 commits into
base: bump_to_c4f8da94
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
9072ba7
[libc] Add strftime_l (#127708)
petrhosek Feb 19, 2025
850062c
[AA] Consider extractvalue and extractelement as escape sources (#127…
nikic Feb 19, 2025
a2b4d4e
Revert "[libc] Add strftime_l" (#127766)
petrhosek Feb 19, 2025
b9a1e58
[RISCVISel] Compute leading zeros for RISCVISD::VCPOP_VL node (#127705)
vbe-sc Feb 19, 2025
99aea21
[Flang][OpenMP] Skip threadprivate HostAssoc symbols for default priv…
Thirumalai-Shaktivel Feb 19, 2025
a2f9ae1
[AMDGPU] Replace gfx940 and gfx941 with gfx942 in offload and libclc …
ritter-x2a Feb 19, 2025
55fb793
[AMDGPU] Add missing gfx architectures to AddFlangOffloadRuntime.cmak…
ritter-x2a Feb 19, 2025
d4cb75e
[mlir][bufferization] Module bufferization: Delete obsolete code (#12…
matthias-springer Feb 19, 2025
8900e41
[AMDGPU][MLIR] Replace gfx940 and gfx941 with gfx942 in MLIR (#125836)
ritter-x2a Feb 19, 2025
f3f4afe
[X86] matchUnaryShuffle - add support for matching 512-bit extension …
RKSimon Feb 19, 2025
029c8e7
[AMDGPU][clang] Replace gfx940 and gfx941 with gfx942 in clang (#126762)
ritter-x2a Feb 19, 2025
4af8c53
[BitcodeReader] Use `poison` instead of `undef` to represent unsuppor…
pedroclobo Feb 19, 2025
cc53913
[CodeGen] Use __extendhfsf2 and __truncsfhf2 by default (#126880)
nikic Feb 19, 2025
8615f9a
[AMDGPU] Replace gfx940 and gfx941 with gfx942 in llvm (#126763)
ritter-x2a Feb 19, 2025
1760289
[clang][bytecode] Fix three-way unordered non-pointer comparisions (#…
tbaederr Feb 19, 2025
2260d59
[AMDGPU] Remove FeatureForceStoreSC0SC1 (#126878)
ritter-x2a Feb 19, 2025
db59708
[AMDGPU][docs] Replace gfx940 and gfx941 with gfx942 in llvm/docs (#1…
ritter-x2a Feb 19, 2025
0607f94
[X86] getFauxShuffleMask - add support for vXi64/vXf64 concat_vectors…
RKSimon Feb 19, 2025
c442b39
[AMDGPU][docs][NFC] Replace gfx940 with gfx942 in the gfx940 ISA doc …
ritter-x2a Feb 19, 2025
160da73
[Flang] Check if two ArrayConstructor's are Equal (#121181)
Thirumalai-Shaktivel Feb 19, 2025
7781e10
[clang] Lower non-builtin sincos[f|l] calls to llvm.sincos.* when -fn…
MacDue Feb 19, 2025
1509b46
[libclc] Improve nextafter behaviour around zero (#127469)
frasercrmck Feb 19, 2025
3c938d0
[MLIR][Affine] Fix affine.parallel op verifier (#127611)
bondhugula Feb 19, 2025
0de2cca
[flang][OpenMP]Improve support for DECLARE REDUCTION (#127088)
Leporacanthicus Feb 19, 2025
404f94a
[AArch64] Add optional extensions enabled on Grace (#127620)
ElvinaYakubova Feb 19, 2025
fadbc33
[lldb] Add LineTable::{upper,lower}_bound (#127519)
labath Feb 19, 2025
c0a763d
[NFC][MLIR] Make file-local cl::opt global variables static (#126714)
DanielAugusto191 Feb 19, 2025
0f472e9
AMDGPU: Avoid double attribute lookup for register count attributes (…
arsenm Feb 19, 2025
73d0679
[libclc] Clean up directory search procedure (#127783)
frasercrmck Feb 19, 2025
3ce2e4d
[NVPTX] Add tcgen05.cp/shift intrinsics (#127669)
durga4github Feb 19, 2025
c6a907a
[mlir][dlti] Fix query keys preallocation (#127786)
adam-smnk Feb 19, 2025
2c8b124
[libc++] Guard include of <features.h> with __has_include (#127691)
ldionne Feb 19, 2025
43e83b9
[clang][bytecode] Fix allocating primitive arrays of unknown bound (#…
tbaederr Feb 19, 2025
7f69a39
[libc++] Deprecate and remove member types of `hash` in `<variant>` (…
frederick-vs-ja Feb 19, 2025
1ac0db4
[NFC] using isUndef() instead of getOpcode() == ISD::UNDEF (#127713)
diggerlin Feb 19, 2025
01d0793
[LAA] Make Ptr argument optional in isNoWrap. (#127410)
fhahn Feb 19, 2025
760ec2c
[MLIR][Linalg] Introduce Python API for linalg.batch_matmul Ops. (#12…
shahidact Feb 19, 2025
aa9e519
Revert "[PowerPC] Deprecate uses of ISD::ADDC/ISD::ADDE/ISD::SUBC/ISD…
daltenty Feb 19, 2025
d804c83
[clang] Lower modf builtin using `llvm.modf` intrinsic (#126750)
MacDue Feb 19, 2025
2b340c1
flang: Fix build with latest libc++ (#127362)
tstellar Feb 19, 2025
d6c6bde
[flang] Implement !DIR$ UNROLL_AND_JAM [N] (#125046)
JDPailleux Feb 19, 2025
0b63dfb
[MLIR][NFC] Use base alias for constructor inheritance (#127756)
chelini Feb 19, 2025
fb5a87e
[libclc][NFC] Reformat ep_log.cl
frasercrmck Feb 19, 2025
26a8399
[clang][Sema] Fix initialization of `NonTypeTemplateParmDecl`... (#12…
alejandro-alvarez-sonarsource Feb 19, 2025
4624087
[llvm-dwarfdump] Print number of out-of-line functions described by D…
jalopezg-git Feb 19, 2025
826af17
[libc] add `LLVM_LIBC_CAST` macro. (#127319)
c8ef Feb 19, 2025
80ccf01
[Clang] Do not try to transform invalid bindings (#125658)
cor3ntin Feb 19, 2025
888c099
[Clang] Add release note for #127623 (#127815)
Sirraide Feb 19, 2025
3e61c1a
[libc++] Avoid code duplication in strings operator+ overloads (#126048)
philnik777 Feb 19, 2025
2f2295c
[Analysis] Avoid repeated hash lookups (NFC) (#127743)
kazutakahirata Feb 19, 2025
c23256e
[AsmPrinter] Avoid repeated hash lookups (NFC) (#127744)
kazutakahirata Feb 19, 2025
af922cf
[CodeGen] Avoid repeated hash lookups (NFC) (#127745)
kazutakahirata Feb 19, 2025
1bb72f0
[Object] Avoid repeated hash lookups (NFC) (#127746)
kazutakahirata Feb 19, 2025
bb75a96
[Support] Avoid repeated hash lookups (NFC) (#127747)
kazutakahirata Feb 19, 2025
fc5849d
[X86] Avoid repeated hash lookups (NFC) (#127748)
kazutakahirata Feb 19, 2025
9743b99
[libclc] Explicitly qualify private address spaces (#127823)
frasercrmck Feb 19, 2025
65998ab
[lldb] Make GetOutputStreamSP and GetErrorStreamSP protected (#127682)
JDevlieghere Feb 19, 2025
e2ba1b6
Revert "Reapply [CaptureTracking][FunctionAttrs] Add support for Capt…
nico Feb 19, 2025
70e693c
[lldb] Gardening in StreamAsynchronousIO (NFC) (#127717)
JDevlieghere Feb 19, 2025
ab3d793
[libc++] Optimize ranges::move{,_backward} for vector<bool>::iterator…
winner245 Feb 19, 2025
210036a
[AMDGPU][True16][CodeGen] true16 codegen pattern for fma (#127240)
broxigarchen Feb 19, 2025
e7bf54d
[flang] AliasAnalysis: Handle fir.load on hlfir.designate (#127107)
jdenny-ornl Feb 19, 2025
fda0e63
[clang] handle fp options in __builtin_convertvector (#125522)
ficol Feb 19, 2025
ddf2408
[AMDGPU] Remove unused variables. NFC
d0k Feb 19, 2025
75ea7ae
[CIR] Add additional frontend actions (#127249)
andykaylor Feb 19, 2025
8fc03e4
[InstCombine] avoid extra instructions in foldSelectICmpAnd (#127398)
andjo403 Feb 19, 2025
0ffe270
[ELF,test] Remove unneeded -o /dev/null
MaskRay Feb 19, 2025
8ecd788
Remove header file spuriously added by 9905728e2fb4ebe9b7518dfd73a057…
TIFitis Feb 19, 2025
aa847ce
[InstCombine] handle trunc to i1 in foldSelectICmpAndBinOp (#127390)
andjo403 Feb 19, 2025
e1d1bb9
[ELF,test] Clean up aarch64-relocs.s
MaskRay Feb 19, 2025
3e8db13
[SLP][NFC]Replace undefs by zeroinitializer
alexey-bataev Feb 19, 2025
ad87d5f
[libc++][test] Refactor tests for std::{copy, move, fill} algorithms …
winner245 Feb 19, 2025
5450954
Include test folder in the Clang Static Analyzer team mentions (#127810)
Xazax-hun Feb 19, 2025
a96444a
[VPlan] Remove dead exit block handling code in HCFGBuilder.
fhahn Feb 19, 2025
d1889cf
[X86] combineX86ShuffleChain - provide list of combined shuffle nodes…
RKSimon Feb 19, 2025
ccd3def
[clangd] Avoid round-trip from SourceLocation to clangd::Range and ba…
HighCommander4 Feb 19, 2025
5e85473
[AutoBump] Merge with ccd3defd (Feb 19)
jorickert Jun 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/new-prs-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ clang:static analyzer:
- clang/tools/scan-build/**
- clang/utils/analyzer/**
- clang/docs/analyzer/**
- clang/test/Analysis/**

pgo:
- llvm/lib/Transforms/Instrumentation/CGProfile.cpp
Expand Down
9 changes: 6 additions & 3 deletions clang-tools-extra/clangd/CollectMacros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
namespace clang {
namespace clangd {

Range MacroOccurrence::toRange(const SourceManager &SM) const {
CharSourceRange MacroOccurrence::toSourceRange(const SourceManager &SM) const {
auto MainFile = SM.getMainFileID();
return halfOpenToRange(
SM, syntax::FileRange(MainFile, StartOffset, EndOffset).toCharRange(SM));
return syntax::FileRange(MainFile, StartOffset, EndOffset).toCharRange(SM);
}

Range MacroOccurrence::toRange(const SourceManager &SM) const {
return halfOpenToRange(SM, toSourceRange(SM));
}

void CollectMainFileMacros::add(const Token &MacroNameTok, const MacroInfo *MI,
Expand Down
1 change: 1 addition & 0 deletions clang-tools-extra/clangd/CollectMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct MacroOccurrence {
// True if the occurence is used in a conditional directive, e.g. #ifdef MACRO
bool InConditionalDirective;

CharSourceRange toSourceRange(const SourceManager &SM) const;
Range toRange(const SourceManager &SM) const;
};

Expand Down
7 changes: 3 additions & 4 deletions clang-tools-extra/clangd/index/SymbolCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ void SymbolCollector::handleMacros(const MainFileMacros &MacroRefsToIndex) {
// Add macro references.
for (const auto &IDToRefs : MacroRefsToIndex.MacroRefs) {
for (const auto &MacroRef : IDToRefs.second) {
const auto &Range = MacroRef.toRange(SM);
const auto &SR = MacroRef.toSourceRange(SM);
auto Range = halfOpenToRange(SM, SR);
bool IsDefinition = MacroRef.IsDefinition;
Ref R;
R.Location.Start.setLine(Range.start.line);
Expand All @@ -726,9 +727,7 @@ void SymbolCollector::handleMacros(const MainFileMacros &MacroRefsToIndex) {
if (IsDefinition) {
Symbol S;
S.ID = IDToRefs.first;
auto StartLoc = cantFail(sourceLocationInMainFile(SM, Range.start));
auto EndLoc = cantFail(sourceLocationInMainFile(SM, Range.end));
S.Name = toSourceCode(SM, SourceRange(StartLoc, EndLoc));
S.Name = toSourceCode(SM, SR.getAsRange());
S.SymInfo.Kind = index::SymbolKind::Macro;
S.SymInfo.SubKind = index::SymbolSubKind::None;
S.SymInfo.Properties = index::SymbolPropertySet();
Expand Down
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Bug Fixes to C++ Support
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
- The initialization kind of elements of structured bindings
direct-list-initialized from an array is corrected to direct-initialization.
- Clang no longer crashes when a coroutine is declared ``[[noreturn]]``. (#GH127327)

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
80 changes: 76 additions & 4 deletions clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4579,25 +4579,97 @@ class ShuffleVectorExpr : public Expr {
/// ConvertVectorExpr - Clang builtin function __builtin_convertvector
/// This AST node provides support for converting a vector type to another
/// vector type of the same arity.
class ConvertVectorExpr : public Expr {
class ConvertVectorExpr final
: public Expr,
private llvm::TrailingObjects<ConvertVectorExpr, FPOptionsOverride> {
private:
Stmt *SrcExpr;
TypeSourceInfo *TInfo;
SourceLocation BuiltinLoc, RParenLoc;

friend TrailingObjects;
friend class ASTReader;
friend class ASTStmtReader;
explicit ConvertVectorExpr(EmptyShell Empty) : Expr(ConvertVectorExprClass, Empty) {}
explicit ConvertVectorExpr(bool HasFPFeatures, EmptyShell Empty)
: Expr(ConvertVectorExprClass, Empty) {
ConvertVectorExprBits.HasFPFeatures = HasFPFeatures;
}

public:
ConvertVectorExpr(Expr *SrcExpr, TypeSourceInfo *TI, QualType DstType,
ExprValueKind VK, ExprObjectKind OK,
SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SourceLocation BuiltinLoc, SourceLocation RParenLoc,
FPOptionsOverride FPFeatures)
: Expr(ConvertVectorExprClass, DstType, VK, OK), SrcExpr(SrcExpr),
TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {
ConvertVectorExprBits.HasFPFeatures = FPFeatures.requiresTrailingStorage();
if (hasStoredFPFeatures())
setStoredFPFeatures(FPFeatures);
setDependence(computeDependence(this));
}

size_t numTrailingObjects(OverloadToken<FPOptionsOverride>) const {
return ConvertVectorExprBits.HasFPFeatures ? 1 : 0;
}

FPOptionsOverride &getTrailingFPFeatures() {
assert(ConvertVectorExprBits.HasFPFeatures);
return *getTrailingObjects<FPOptionsOverride>();
}

const FPOptionsOverride &getTrailingFPFeatures() const {
assert(ConvertVectorExprBits.HasFPFeatures);
return *getTrailingObjects<FPOptionsOverride>();
}

public:
static ConvertVectorExpr *CreateEmpty(const ASTContext &C,
bool hasFPFeatures);

static ConvertVectorExpr *Create(const ASTContext &C, Expr *SrcExpr,
TypeSourceInfo *TI, QualType DstType,
ExprValueKind VK, ExprObjectKind OK,
SourceLocation BuiltinLoc,
SourceLocation RParenLoc,
FPOptionsOverride FPFeatures);

/// Get the FP contractibility status of this operator. Only meaningful for
/// operations on floating point types.
bool isFPContractableWithinStatement(const LangOptions &LO) const {
return getFPFeaturesInEffect(LO).allowFPContractWithinStatement();
}

/// Is FPFeatures in Trailing Storage?
bool hasStoredFPFeatures() const {
return ConvertVectorExprBits.HasFPFeatures;
}

/// Get FPFeatures from trailing storage.
FPOptionsOverride getStoredFPFeatures() const {
return getTrailingFPFeatures();
}

/// Get the store FPOptionsOverride or default if not stored.
FPOptionsOverride getStoredFPFeaturesOrDefault() const {
return hasStoredFPFeatures() ? getStoredFPFeatures() : FPOptionsOverride();
}

/// Set FPFeatures in trailing storage, used by Serialization & ASTImporter.
void setStoredFPFeatures(FPOptionsOverride F) { getTrailingFPFeatures() = F; }

/// Get the FP features status of this operator. Only meaningful for
/// operations on floating point types.
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const {
if (ConvertVectorExprBits.HasFPFeatures)
return getStoredFPFeatures().applyOverrides(LO);
return FPOptions::defaultWithoutTrailingStorage(LO);
}

FPOptionsOverride getFPOptionsOverride() const {
if (ConvertVectorExprBits.HasFPFeatures)
return getStoredFPFeatures();
return FPOptionsOverride();
}

/// getSrcExpr - Return the Expr to be converted.
Expr *getSrcExpr() const { return cast<Expr>(SrcExpr); }

Expand Down
15 changes: 15 additions & 0 deletions clang/include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,20 @@ class alignas(void *) Stmt {
SourceLocation Loc;
};

class ConvertVectorExprBitfields {
friend class ConvertVectorExpr;

LLVM_PREFERRED_TYPE(ExprBitfields)
unsigned : NumExprBits;

//
/// This is only meaningful for operations on floating point
/// types when additional values need to be in trailing storage.
/// It is 0 otherwise.
LLVM_PREFERRED_TYPE(bool)
unsigned HasFPFeatures : 1;
};

union {
// Same order as in StmtNodes.td.
// Statements
Expand Down Expand Up @@ -1293,6 +1307,7 @@ class alignas(void *) Stmt {

// Clang Extensions
OpaqueValueExprBitfields OpaqueValueExprBits;
ConvertVectorExprBitfields ConvertVectorExprBits;
};

public:
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/AST/TextNodeDumper.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ class TextNodeDumper
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *S);
void VisitEmbedExpr(const EmbedExpr *S);
void VisitAtomicExpr(const AtomicExpr *AE);
void VisitConvertVectorExpr(const ConvertVectorExpr *S);
};

} // namespace clang
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Basic/Cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ enum class OffloadArch {
GFX90a,
GFX90c,
GFX9_4_GENERIC,
GFX940,
GFX941,
GFX942,
GFX950,
GFX10_1_GENERIC,
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIRDialect.td
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def CIR_Dialect : Dialect {
let useDefaultTypePrinterParser = 0;

let extraClassDeclaration = [{
static llvm::StringRef getTripleAttrName() { return "cir.triple"; }

void registerAttributes();
void registerTypes();

Expand Down
24 changes: 24 additions & 0 deletions clang/include/clang/CIR/FrontendAction/CIRGenAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ class CIRGenConsumer;
class CIRGenAction : public clang::ASTFrontendAction {
public:
enum class OutputType {
EmitAssembly,
EmitCIR,
EmitLLVM,
EmitBC,
EmitObj,
};

private:
Expand Down Expand Up @@ -63,6 +66,27 @@ class EmitLLVMAction : public CIRGenAction {
EmitLLVMAction(mlir::MLIRContext *MLIRCtx = nullptr);
};

class EmitBCAction : public CIRGenAction {
virtual void anchor();

public:
EmitBCAction(mlir::MLIRContext *MLIRCtx = nullptr);
};

class EmitAssemblyAction : public CIRGenAction {
virtual void anchor();

public:
EmitAssemblyAction(mlir::MLIRContext *MLIRCtx = nullptr);
};

class EmitObjAction : public CIRGenAction {
virtual void anchor();

public:
EmitObjAction(mlir::MLIRContext *MLIRCtx = nullptr);
};

} // namespace cir

#endif
7 changes: 4 additions & 3 deletions clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7386,9 +7386,10 @@ ExpectedStmt ASTNodeImporter::VisitConvertVectorExpr(ConvertVectorExpr *E) {
if (Err)
return std::move(Err);

return new (Importer.getToContext())
ConvertVectorExpr(ToSrcExpr, ToTSI, ToType, E->getValueKind(),
E->getObjectKind(), ToBuiltinLoc, ToRParenLoc);
return ConvertVectorExpr::Create(
Importer.getToContext(), ToSrcExpr, ToTSI, ToType, E->getValueKind(),
E->getObjectKind(), ToBuiltinLoc, ToRParenLoc,
E->getStoredFPFeaturesOrDefault());
}

ExpectedStmt ASTNodeImporter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3397,7 +3397,8 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
CtorFunc = getFunction(CE->getConstructor());
if (!CtorFunc)
return false;
}
} else if (!DynamicInit)
DynamicInit = Init;

LabelTy EndLabel = this->getLabel();
LabelTy StartLabel = this->getLabel();
Expand Down
15 changes: 8 additions & 7 deletions clang/lib/AST/ByteCode/Interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1132,13 +1132,14 @@ bool CMP3(InterpState &S, CodePtr OpPC, const ComparisonCategoryInfo *CmpInfo) {
const Pointer &P = S.Stk.peek<Pointer>();

ComparisonCategoryResult CmpResult = LHS.compare(RHS);
if (CmpResult == ComparisonCategoryResult::Unordered) {
// This should only happen with pointers.
const SourceInfo &Loc = S.Current->getSource(OpPC);
S.FFDiag(Loc, diag::note_constexpr_pointer_comparison_unspecified)
<< LHS.toDiagnosticString(S.getASTContext())
<< RHS.toDiagnosticString(S.getASTContext());
return false;
if constexpr (std::is_same_v<T, Pointer>) {
if (CmpResult == ComparisonCategoryResult::Unordered) {
const SourceInfo &Loc = S.Current->getSource(OpPC);
S.FFDiag(Loc, diag::note_constexpr_pointer_comparison_unspecified)
<< LHS.toDiagnosticString(S.getASTContext())
<< RHS.toDiagnosticString(S.getASTContext());
return false;
}
}

assert(CmpInfo);
Expand Down
45 changes: 29 additions & 16 deletions clang/lib/AST/DeclTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,16 @@ NonTypeTemplateParmDecl *NonTypeTemplateParmDecl::Create(
QualType T, bool ParameterPack, TypeSourceInfo *TInfo) {
AutoType *AT =
C.getLangOpts().CPlusPlus20 ? T->getContainedAutoType() : nullptr;
return new (C, DC,
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
Expr *>(0,
AT && AT->isConstrained() ? 1 : 0))
NonTypeTemplateParmDecl(DC, StartLoc, IdLoc, D, P, Id, T, ParameterPack,
TInfo);
const bool HasConstraint = AT && AT->isConstrained();
auto *NTTP =
new (C, DC,
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>, Expr *>(
0, HasConstraint ? 1 : 0))
NonTypeTemplateParmDecl(DC, StartLoc, IdLoc, D, P, Id, T,
ParameterPack, TInfo);
if (HasConstraint)
NTTP->setPlaceholderTypeConstraint(nullptr);
return NTTP;
}

NonTypeTemplateParmDecl *NonTypeTemplateParmDecl::Create(
Expand All @@ -800,23 +804,30 @@ NonTypeTemplateParmDecl *NonTypeTemplateParmDecl::Create(
QualType T, TypeSourceInfo *TInfo, ArrayRef<QualType> ExpandedTypes,
ArrayRef<TypeSourceInfo *> ExpandedTInfos) {
AutoType *AT = TInfo->getType()->getContainedAutoType();
return new (C, DC,
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
Expr *>(
ExpandedTypes.size(), AT && AT->isConstrained() ? 1 : 0))
NonTypeTemplateParmDecl(DC, StartLoc, IdLoc, D, P, Id, T, TInfo,
ExpandedTypes, ExpandedTInfos);
const bool HasConstraint = AT && AT->isConstrained();
auto *NTTP =
new (C, DC,
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>, Expr *>(
ExpandedTypes.size(), HasConstraint ? 1 : 0))
NonTypeTemplateParmDecl(DC, StartLoc, IdLoc, D, P, Id, T, TInfo,
ExpandedTypes, ExpandedTInfos);
if (HasConstraint)
NTTP->setPlaceholderTypeConstraint(nullptr);
return NTTP;
}

NonTypeTemplateParmDecl *
NonTypeTemplateParmDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
bool HasTypeConstraint) {
return new (C, ID, additionalSizeToAlloc<std::pair<QualType,
TypeSourceInfo *>,
Expr *>(0,
HasTypeConstraint ? 1 : 0))
auto *NTTP =
new (C, ID,
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>, Expr *>(
0, HasTypeConstraint ? 1 : 0))
NonTypeTemplateParmDecl(nullptr, SourceLocation(), SourceLocation(),
0, 0, nullptr, QualType(), false, nullptr);
if (HasTypeConstraint)
NTTP->setPlaceholderTypeConstraint(nullptr);
return NTTP;
}

NonTypeTemplateParmDecl *
Expand All @@ -830,6 +841,8 @@ NonTypeTemplateParmDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
NonTypeTemplateParmDecl(nullptr, SourceLocation(), SourceLocation(),
0, 0, nullptr, QualType(), nullptr, {}, {});
NTTP->NumExpandedTypes = NumExpandedTypes;
if (HasTypeConstraint)
NTTP->setPlaceholderTypeConstraint(nullptr);
return NTTP;
}

Expand Down
Loading