Skip to content

Commit 7faf341

Browse files
committed
[𝘀𝗽𝗿] landed version
Created using spr 1.3.6-beta.1
2 parents f000219 + a036d18 commit 7faf341

File tree

1,861 files changed

+53058
-30252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,861 files changed

+53058
-30252
lines changed

clang-tools-extra/clang-include-fixer/InMemorySymbolIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ InMemorySymbolIndex::InMemorySymbolIndex(
2121

2222
std::vector<SymbolAndSignals>
2323
InMemorySymbolIndex::search(llvm::StringRef Identifier) {
24-
auto I = LookupTable.find(std::string(Identifier));
24+
auto I = LookupTable.find(Identifier);
2525
if (I != LookupTable.end())
2626
return I->second;
2727
return {};

clang-tools-extra/clang-include-fixer/InMemorySymbolIndex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class InMemorySymbolIndex : public SymbolIndex {
2727
search(llvm::StringRef Identifier) override;
2828

2929
private:
30-
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>>
30+
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>,
31+
std::less<>>
3132
LookupTable;
3233
};
3334

clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ std::optional<DurationScale> getScaleForDurationInverse(llvm::StringRef Name) {
244244
{"ToDoubleNanoseconds", DurationScale::Nanoseconds},
245245
{"ToInt64Nanoseconds", DurationScale::Nanoseconds}});
246246

247-
auto ScaleIter = ScaleMap.find(std::string(Name));
247+
auto ScaleIter = ScaleMap.find(Name);
248248
if (ScaleIter == ScaleMap.end())
249249
return std::nullopt;
250250

@@ -260,7 +260,7 @@ std::optional<DurationScale> getScaleForTimeInverse(llvm::StringRef Name) {
260260
{"ToUnixMicros", DurationScale::Microseconds},
261261
{"ToUnixNanos", DurationScale::Nanoseconds}});
262262

263-
auto ScaleIter = ScaleMap.find(std::string(Name));
263+
auto ScaleIter = ScaleMap.find(Name);
264264
if (ScaleIter == ScaleMap.end())
265265
return std::nullopt;
266266

clang/docs/OpenMPSupport.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ implementation.
284284
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
285285
| memory management | alignment for allocate directive and clause | :good:`done` | D115683 |
286286
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
287+
| memory management | 'allocator' modifier for allocate clause | :good:`done` | https://github.com/llvm/llvm-project/pull/114883 |
288+
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
287289
| memory management | new memory management routines | :none:`unclaimed` | |
288290
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
289291
| memory management | changes to omp_alloctrait_key enum | :none:`unclaimed` | |

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,6 @@ Bug Fixes to C++ Support
569569
in certain friend declarations. (#GH93099)
570570
- Clang now instantiates the correct lambda call operator when a lambda's class type is
571571
merged across modules. (#GH110401)
572-
- Clang now uses the correct set of template argument lists when comparing the constraints of
573-
out-of-line definitions and member templates explicitly specialized for a given implicit instantiation of
574-
a class template. (#GH102320)
575572
- Fix a crash when parsing a pseudo destructor involving an invalid type. (#GH111460)
576573
- Fixed an assertion failure when invoking recovery call expressions with explicit attributes
577574
and undeclared templates. (#GH107047), (#GH49093)
@@ -591,6 +588,7 @@ Bug Fixes to C++ Support
591588
- Clang now correctly ignores previous partial specializations of member templates explicitly specialized for
592589
an implicitly instantiated class template specialization. (#GH51051)
593590
- Fixed an assertion failure caused by invalid enum forward declarations. (#GH112208)
591+
- Name independent data members were not correctly initialized from default member initializers. (#GH114069)
594592

595593
Bug Fixes to AST Handling
596594
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -888,6 +886,7 @@ OpenMP Support
888886
--------------
889887
- Added support for 'omp assume' directive.
890888
- Added support for 'omp scope' directive.
889+
- Added support for allocator-modifier in 'allocate' clause.
891890

892891
Improvements
893892
^^^^^^^^^^^^

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
10411041
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst,
10421042
UsingShadowDecl *Pattern);
10431043

1044-
FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field);
1044+
FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field) const;
10451045

10461046
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl);
10471047

clang/include/clang/AST/DeclTemplate.h

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,15 @@ class RedeclarableTemplateDecl : public TemplateDecl,
787787
EntryType *Entry, void *InsertPos);
788788

789789
struct CommonBase {
790-
CommonBase() {}
790+
CommonBase() : InstantiatedFromMember(nullptr, false) {}
791791

792792
/// The template from which this was most
793793
/// directly instantiated (or null).
794-
RedeclarableTemplateDecl *InstantiatedFromMember = nullptr;
794+
///
795+
/// The boolean value indicates whether this template
796+
/// was explicitly specialized.
797+
llvm::PointerIntPair<RedeclarableTemplateDecl *, 1, bool>
798+
InstantiatedFromMember;
795799

796800
/// If non-null, points to an array of specializations (including
797801
/// partial specializations) known only by their external declaration IDs.
@@ -802,19 +806,14 @@ class RedeclarableTemplateDecl : public TemplateDecl,
802806
};
803807

804808
/// Pointer to the common data shared by all declarations of this
805-
/// template, and a flag indicating if the template is a member
806-
/// specialization.
807-
mutable llvm::PointerIntPair<CommonBase *, 1, bool> Common;
808-
809-
CommonBase *getCommonPtrInternal() const { return Common.getPointer(); }
809+
/// template.
810+
mutable CommonBase *Common = nullptr;
810811

811812
/// Retrieves the "common" pointer shared by all (re-)declarations of
812813
/// the same template. Calling this routine may implicitly allocate memory
813814
/// for the common pointer.
814815
CommonBase *getCommonPtr() const;
815816

816-
void setCommonPtr(CommonBase *C) const { Common.setPointer(C); }
817-
818817
virtual CommonBase *newCommon(ASTContext &C) const = 0;
819818

820819
// Construct a template decl with name, parameters, and templated element.
@@ -855,12 +854,15 @@ class RedeclarableTemplateDecl : public TemplateDecl,
855854
/// template<> template<typename T>
856855
/// struct X<int>::Inner { /* ... */ };
857856
/// \endcode
858-
bool isMemberSpecialization() const { return Common.getInt(); }
857+
bool isMemberSpecialization() const {
858+
return getCommonPtr()->InstantiatedFromMember.getInt();
859+
}
859860

860861
/// Note that this member template is a specialization.
861862
void setMemberSpecialization() {
862-
assert(!isMemberSpecialization() && "already a member specialization");
863-
Common.setInt(true);
863+
assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
864+
"Only member templates can be member template specializations");
865+
getCommonPtr()->InstantiatedFromMember.setInt(true);
864866
}
865867

866868
/// Retrieve the member template from which this template was
@@ -900,12 +902,12 @@ class RedeclarableTemplateDecl : public TemplateDecl,
900902
/// void X<T>::f(T, U);
901903
/// \endcode
902904
RedeclarableTemplateDecl *getInstantiatedFromMemberTemplate() const {
903-
return getCommonPtr()->InstantiatedFromMember;
905+
return getCommonPtr()->InstantiatedFromMember.getPointer();
904906
}
905907

906908
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD) {
907-
assert(!getCommonPtr()->InstantiatedFromMember);
908-
getCommonPtr()->InstantiatedFromMember = TD;
909+
assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
910+
getCommonPtr()->InstantiatedFromMember.setPointer(TD);
909911
}
910912

911913
/// Retrieve the "injected" template arguments that correspond to the
@@ -1955,7 +1957,13 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
19551957
/// specialization which was specialized by this.
19561958
llvm::PointerUnion<ClassTemplateDecl *,
19571959
ClassTemplatePartialSpecializationDecl *>
1958-
getSpecializedTemplateOrPartial() const;
1960+
getSpecializedTemplateOrPartial() const {
1961+
if (const auto *PartialSpec =
1962+
SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1963+
return PartialSpec->PartialSpecialization;
1964+
1965+
return SpecializedTemplate.get<ClassTemplateDecl*>();
1966+
}
19591967

19601968
/// Retrieve the set of template arguments that should be used
19611969
/// to instantiate members of the class template or class template partial
@@ -1981,8 +1989,6 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
19811989
/// template arguments have been deduced.
19821990
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
19831991
const TemplateArgumentList *TemplateArgs) {
1984-
assert(!isa<ClassTemplatePartialSpecializationDecl>(this) &&
1985-
"A partial specialization cannot be instantiated from a template");
19861992
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
19871993
"Already set to a class template partial specialization!");
19881994
auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
@@ -1994,8 +2000,6 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
19942000
/// Note that this class template specialization is an instantiation
19952001
/// of the given class template.
19962002
void setInstantiationOf(ClassTemplateDecl *TemplDecl) {
1997-
assert(!isa<ClassTemplatePartialSpecializationDecl>(this) &&
1998-
"A partial specialization cannot be instantiated from a template");
19992003
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
20002004
"Previously set to a class template partial specialization!");
20012005
SpecializedTemplate = TemplDecl;
@@ -2189,11 +2193,18 @@ class ClassTemplatePartialSpecializationDecl
21892193
/// struct X<int>::Inner<T*> { /* ... */ };
21902194
/// \endcode
21912195
bool isMemberSpecialization() const {
2192-
return InstantiatedFromMember.getInt();
2196+
const auto *First =
2197+
cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2198+
return First->InstantiatedFromMember.getInt();
21932199
}
21942200

21952201
/// Note that this member template is a specialization.
2196-
void setMemberSpecialization() { return InstantiatedFromMember.setInt(true); }
2202+
void setMemberSpecialization() {
2203+
auto *First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2204+
assert(First->InstantiatedFromMember.getPointer() &&
2205+
"Only member templates can be member template specializations");
2206+
return First->InstantiatedFromMember.setInt(true);
2207+
}
21972208

21982209
/// Retrieves the injected specialization type for this partial
21992210
/// specialization. This is not the same as the type-decl-type for
@@ -2263,6 +2274,8 @@ class ClassTemplateDecl : public RedeclarableTemplateDecl {
22632274
return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
22642275
}
22652276

2277+
void setCommonPtr(Common *C) { RedeclarableTemplateDecl::Common = C; }
2278+
22662279
public:
22672280

22682281
friend class ASTDeclReader;
@@ -2713,7 +2726,13 @@ class VarTemplateSpecializationDecl : public VarDecl,
27132726
/// Retrieve the variable template or variable template partial
27142727
/// specialization which was specialized by this.
27152728
llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2716-
getSpecializedTemplateOrPartial() const;
2729+
getSpecializedTemplateOrPartial() const {
2730+
if (const auto *PartialSpec =
2731+
SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2732+
return PartialSpec->PartialSpecialization;
2733+
2734+
return SpecializedTemplate.get<VarTemplateDecl *>();
2735+
}
27172736

27182737
/// Retrieve the set of template arguments that should be used
27192738
/// to instantiate the initializer of the variable template or variable
@@ -2739,8 +2758,6 @@ class VarTemplateSpecializationDecl : public VarDecl,
27392758
/// template arguments have been deduced.
27402759
void setInstantiationOf(VarTemplatePartialSpecializationDecl *PartialSpec,
27412760
const TemplateArgumentList *TemplateArgs) {
2742-
assert(!isa<VarTemplatePartialSpecializationDecl>(this) &&
2743-
"A partial specialization cannot be instantiated from a template");
27442761
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
27452762
"Already set to a variable template partial specialization!");
27462763
auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
@@ -2752,8 +2769,6 @@ class VarTemplateSpecializationDecl : public VarDecl,
27522769
/// Note that this variable template specialization is an instantiation
27532770
/// of the given variable template.
27542771
void setInstantiationOf(VarTemplateDecl *TemplDecl) {
2755-
assert(!isa<VarTemplatePartialSpecializationDecl>(this) &&
2756-
"A partial specialization cannot be instantiated from a template");
27572772
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
27582773
"Previously set to a variable template partial specialization!");
27592774
SpecializedTemplate = TemplDecl;
@@ -2944,11 +2959,18 @@ class VarTemplatePartialSpecializationDecl
29442959
/// U* X<int>::Inner<T*> = (T*)(0) + 1;
29452960
/// \endcode
29462961
bool isMemberSpecialization() const {
2947-
return InstantiatedFromMember.getInt();
2962+
const auto *First =
2963+
cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2964+
return First->InstantiatedFromMember.getInt();
29482965
}
29492966

29502967
/// Note that this member template is a specialization.
2951-
void setMemberSpecialization() { return InstantiatedFromMember.setInt(true); }
2968+
void setMemberSpecialization() {
2969+
auto *First = cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2970+
assert(First->InstantiatedFromMember.getPointer() &&
2971+
"Only member templates can be member template specializations");
2972+
return First->InstantiatedFromMember.setInt(true);
2973+
}
29522974

29532975
SourceRange getSourceRange() const override LLVM_READONLY;
29542976

@@ -3119,9 +3141,6 @@ class VarTemplateDecl : public RedeclarableTemplateDecl {
31193141
return makeSpecIterator(getSpecializations(), true);
31203142
}
31213143

3122-
/// Merge \p Prev with our RedeclarableTemplateDecl::Common.
3123-
void mergePrevDecl(VarTemplateDecl *Prev);
3124-
31253144
// Implement isa/cast/dyncast support
31263145
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
31273146
static bool classofKind(Kind K) { return K == VarTemplate; }

clang/include/clang/AST/OpenMPClause.h

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ class OMPAlignClause final
486486
/// #pragma omp parallel private(a) allocate(omp_default_mem_alloc :a)
487487
/// \endcode
488488
/// In this example directive '#pragma omp parallel' has clause 'private'
489-
/// and clause 'allocate' for the variable 'a'.
489+
/// and clause 'allocate' for the variable 'a', which specifies an explicit
490+
/// memory allocator.
490491
class OMPAllocateClause final
491492
: public OMPVarListClause<OMPAllocateClause>,
492493
private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
@@ -499,6 +500,10 @@ class OMPAllocateClause final
499500
Expr *Allocator = nullptr;
500501
/// Position of the ':' delimiter in the clause;
501502
SourceLocation ColonLoc;
503+
/// Modifier of 'allocate' clause.
504+
OpenMPAllocateClauseModifier AllocatorModifier = OMPC_ALLOCATE_unknown;
505+
/// Location of allocator modifier if any.
506+
SourceLocation AllocatorModifierLoc;
502507

503508
/// Build clause with number of variables \a N.
504509
///
@@ -510,10 +515,14 @@ class OMPAllocateClause final
510515
/// \param N Number of the variables in the clause.
511516
OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
512517
Expr *Allocator, SourceLocation ColonLoc,
513-
SourceLocation EndLoc, unsigned N)
518+
OpenMPAllocateClauseModifier AllocatorModifier,
519+
SourceLocation AllocatorModifierLoc, SourceLocation EndLoc,
520+
unsigned N)
514521
: OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
515522
LParenLoc, EndLoc, N),
516-
Allocator(Allocator), ColonLoc(ColonLoc) {}
523+
Allocator(Allocator), ColonLoc(ColonLoc),
524+
AllocatorModifier(AllocatorModifier),
525+
AllocatorModifierLoc(AllocatorModifierLoc) {}
517526

518527
/// Build an empty clause.
519528
///
@@ -527,6 +536,9 @@ class OMPAllocateClause final
527536
void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
528537

529538
void setAllocator(Expr *A) { Allocator = A; }
539+
void setAllocatorModifier(OpenMPAllocateClauseModifier AM) {
540+
AllocatorModifier = AM;
541+
}
530542

531543
public:
532544
/// Creates clause with a list of variables \a VL.
@@ -536,18 +548,31 @@ class OMPAllocateClause final
536548
/// \param LParenLoc Location of '('.
537549
/// \param Allocator Allocator expression.
538550
/// \param ColonLoc Location of ':' delimiter.
551+
/// \param AllocatorModifier Allocator modifier.
552+
/// \param SourceLocation Allocator modifier location.
539553
/// \param EndLoc Ending location of the clause.
540554
/// \param VL List of references to the variables.
541-
static OMPAllocateClause *Create(const ASTContext &C, SourceLocation StartLoc,
542-
SourceLocation LParenLoc, Expr *Allocator,
543-
SourceLocation ColonLoc,
544-
SourceLocation EndLoc, ArrayRef<Expr *> VL);
555+
static OMPAllocateClause *
556+
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
557+
Expr *Allocator, SourceLocation ColonLoc,
558+
OpenMPAllocateClauseModifier AllocatorModifier,
559+
SourceLocation AllocatorModifierLoc, SourceLocation EndLoc,
560+
ArrayRef<Expr *> VL);
545561

546562
/// Returns the allocator expression or nullptr, if no allocator is specified.
547563
Expr *getAllocator() const { return Allocator; }
548564

565+
/// Return 'allocate' modifier.
566+
OpenMPAllocateClauseModifier getAllocatorModifier() const {
567+
return AllocatorModifier;
568+
}
569+
549570
/// Returns the location of the ':' delimiter.
550571
SourceLocation getColonLoc() const { return ColonLoc; }
572+
/// Return the location of the modifier.
573+
SourceLocation getAllocatorModifierLoc() const {
574+
return AllocatorModifierLoc;
575+
}
551576

552577
/// Creates an empty clause with the place for \a N variables.
553578
///

clang/include/clang/AST/SYCLKernelInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_CLANG_AST_SYCLKERNELINFO_H
1414
#define LLVM_CLANG_AST_SYCLKERNELINFO_H
1515

16+
#include "clang/AST/CanonicalType.h"
1617
#include "clang/AST/Decl.h"
1718
#include "clang/AST/Type.h"
1819

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3226,7 +3226,7 @@ AST_MATCHER_P(CXXDependentScopeMemberExpr, memberHasSameNameAsBoundNode,
32263226

32273227
return Builder->removeBindings(
32283228
[this, MemberName](const BoundNodesMap &Nodes) {
3229-
const auto &BN = Nodes.getNode(this->BindingID);
3229+
const DynTypedNode &BN = Nodes.getNode(this->BindingID);
32303230
if (const auto *ND = BN.get<NamedDecl>()) {
32313231
if (!isa<FieldDecl, CXXMethodDecl, VarDecl>(ND))
32323232
return true;

0 commit comments

Comments
 (0)