Skip to content

Commit

Permalink
[𝘀𝗽𝗿] changes introduced through rebase
Browse files Browse the repository at this point in the history
Created using spr 1.3.4

[skip ci]
  • Loading branch information
Dinistro authored and joker-eph committed Nov 3, 2023
1 parent 3289ecf commit e638fc1
Show file tree
Hide file tree
Showing 331 changed files with 13,200 additions and 3,269 deletions.
19 changes: 9 additions & 10 deletions clang-tools-extra/clang-doc/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,17 @@ llvm::Error decodeRecord(const Record &R, AccessSpecifier &Field,

llvm::Error decodeRecord(const Record &R, TagTypeKind &Field,
llvm::StringRef Blob) {
switch (R[0]) {
case TTK_Struct:
case TTK_Interface:
case TTK_Union:
case TTK_Class:
case TTK_Enum:
Field = (TagTypeKind)R[0];
switch (static_cast<TagTypeKind>(R[0])) {
case TagTypeKind::Struct:
case TagTypeKind::Interface:
case TagTypeKind::Union:
case TagTypeKind::Class:
case TagTypeKind::Enum:
Field = static_cast<TagTypeKind>(R[0]);
return llvm::Error::success();
default:
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"invalid value for TagTypeKind");
}
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"invalid value for TagTypeKind");
}

llvm::Error decodeRecord(const Record &R, std::optional<Location> &Field,
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-doc/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void ClangDocBitcodeWriter::emitBlock(const RecordInfo &I) {
emitRecord(*I.DefLoc, RECORD_DEFLOCATION);
for (const auto &L : I.Loc)
emitRecord(L, RECORD_LOCATION);
emitRecord(I.TagType, RECORD_TAG_TYPE);
emitRecord(llvm::to_underlying(I.TagType), RECORD_TAG_TYPE);
emitRecord(I.IsTypeDef, RECORD_IS_TYPE_DEF);
for (const auto &N : I.Members)
emitBlock(N);
Expand All @@ -578,7 +578,7 @@ void ClangDocBitcodeWriter::emitBlock(const BaseRecordInfo &I) {
emitRecord(I.USR, BASE_RECORD_USR);
emitRecord(I.Name, BASE_RECORD_NAME);
emitRecord(I.Path, BASE_RECORD_PATH);
emitRecord(I.TagType, BASE_RECORD_TAG_TYPE);
emitRecord(llvm::to_underlying(I.TagType), BASE_RECORD_TAG_TYPE);
emitRecord(I.IsVirtual, BASE_RECORD_IS_VIRTUAL);
emitRecord(I.Access, BASE_RECORD_ACCESS);
emitRecord(I.IsParent, BASE_RECORD_IS_PARENT);
Expand Down
10 changes: 5 additions & 5 deletions clang-tools-extra/clang-doc/Generators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ findGeneratorByName(llvm::StringRef Format) {

std::string getTagType(TagTypeKind AS) {
switch (AS) {
case TagTypeKind::TTK_Class:
case TagTypeKind::Class:
return "class";
case TagTypeKind::TTK_Union:
case TagTypeKind::Union:
return "union";
case TagTypeKind::TTK_Interface:
case TagTypeKind::Interface:
return "interface";
case TagTypeKind::TTK_Struct:
case TagTypeKind::Struct:
return "struct";
case TagTypeKind::TTK_Enum:
case TagTypeKind::Enum:
return "enum";
}
llvm_unreachable("Unknown TagTypeKind");
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-doc/Representation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ RecordInfo::RecordInfo(SymbolID USR, StringRef Name, StringRef Path)

void RecordInfo::merge(RecordInfo &&Other) {
assert(mergeable(Other));
if (!TagType)
if (!llvm::to_underlying(TagType))
TagType = Other.TagType;
IsTypeDef = IsTypeDef || Other.IsTypeDef;
if (Members.empty())
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-doc/Representation.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ struct RecordInfo : public SymbolInfo {
void merge(RecordInfo &&I);

// Type of this record (struct, class, union, interface).
TagTypeKind TagType = TagTypeKind::TTK_Struct;
TagTypeKind TagType = TagTypeKind::Struct;

// Full qualified name of this record, including namespaces and template
// specializations.
Expand Down
10 changes: 5 additions & 5 deletions clang-tools-extra/clang-doc/YAMLGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ template <> struct ScalarEnumerationTraits<clang::AccessSpecifier> {

template <> struct ScalarEnumerationTraits<clang::TagTypeKind> {
static void enumeration(IO &IO, clang::TagTypeKind &Value) {
IO.enumCase(Value, "Struct", clang::TagTypeKind::TTK_Struct);
IO.enumCase(Value, "Interface", clang::TagTypeKind::TTK_Interface);
IO.enumCase(Value, "Union", clang::TagTypeKind::TTK_Union);
IO.enumCase(Value, "Class", clang::TagTypeKind::TTK_Class);
IO.enumCase(Value, "Enum", clang::TagTypeKind::TTK_Enum);
IO.enumCase(Value, "Struct", clang::TagTypeKind::Struct);
IO.enumCase(Value, "Interface", clang::TagTypeKind::Interface);
IO.enumCase(Value, "Union", clang::TagTypeKind::Union);
IO.enumCase(Value, "Class", clang::TagTypeKind::Class);
IO.enumCase(Value, "Enum", clang::TagTypeKind::Enum);
}
};

Expand Down
20 changes: 12 additions & 8 deletions clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,18 @@ void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
this);

Finder->addMatcher(
traverse(TK_AsIs,
cxxMemberCallExpr(
thisPointerType(getSmartPointerTypeMatcher()),
callee(cxxMethodDecl(hasName("reset"))),
hasArgument(0, cxxNewExpr(CanCallCtor, unless(IsPlacement))
.bind(NewExpression)),
unless(isInTemplateInstantiation()))
.bind(ResetCall)),
traverse(
TK_AsIs,
cxxMemberCallExpr(
unless(isInTemplateInstantiation()),
hasArgument(0, cxxNewExpr(CanCallCtor, unless(IsPlacement))
.bind(NewExpression)),
callee(cxxMethodDecl(hasName("reset"))),
anyOf(thisPointerType(getSmartPointerTypeMatcher()),
on(ignoringImplicit(anyOf(
hasType(getSmartPointerTypeMatcher()),
hasType(pointsTo(getSmartPointerTypeMatcher())))))))
.bind(ResetCall)),
this);
}

Expand Down
3 changes: 2 additions & 1 deletion clang-tools-extra/clangd/refactor/InsertionPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ SourceLocation endLoc(const DeclContext &DC) {
}

AccessSpecifier getAccessAtEnd(const CXXRecordDecl &C) {
AccessSpecifier Spec = (C.getTagKind() == TTK_Class ? AS_private : AS_public);
AccessSpecifier Spec =
(C.getTagKind() == TagTypeKind::Class ? AS_private : AS_public);
for (const auto *D : C.decls())
if (const auto *ASD = llvm::dyn_cast<AccessSpecDecl>(D))
Spec = ASD->getAccess();
Expand Down
5 changes: 5 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ Changes in existing checks
iterators initialized by free functions like ``begin``, ``end``, or ``size``
and avoid crash for array of dependent array.

- Improved :doc:`modernize-make-shared
<clang-tidy/checks/modernize/make-shared>` check to support
``std::shared_ptr`` implementations that inherit the ``reset`` method from a
base class.

- Improved :doc:`modernize-return-braced-init-list
<clang-tidy/checks/modernize/return-braced-init-list>` check to ignore
false-positives when constructing the container with ``count`` copies of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
namespace std {

template <typename type>
class shared_ptr {
class __shared_ptr {
protected:
__shared_ptr();
__shared_ptr(type *ptr);
~__shared_ptr();
public:
shared_ptr();
shared_ptr(type *ptr);
shared_ptr(const shared_ptr<type> &t) {}
shared_ptr(shared_ptr<type> &&t) {}
~shared_ptr();
type &operator*() { return *ptr; }
type *operator->() { return ptr; }
type *release();
void reset();
void reset(type *pt);
shared_ptr &operator=(shared_ptr &&);
template <typename T>
shared_ptr &operator=(shared_ptr<T> &&);

private:
type *ptr;
};

template <typename type>
class shared_ptr : public __shared_ptr<type> {
public:
shared_ptr();
shared_ptr(type *ptr);
shared_ptr(const shared_ptr<type> &t);
shared_ptr(shared_ptr<type> &&t);
~shared_ptr();
shared_ptr &operator=(shared_ptr &&);
template <typename T>
shared_ptr &operator=(shared_ptr<T> &&);
};

} // namespace std
2 changes: 1 addition & 1 deletion clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ TEST(BitcodeTest, emitRecordInfoBitcode) {
I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});

I.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
I.TagType = TagTypeKind::TTK_Class;
I.TagType = TagTypeKind::Class;
I.IsTypeDef = true;
I.Bases.emplace_back(EmptySID, "F", "path/to/F", true,
AccessSpecifier::AS_public, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ TEST(HTMLGeneratorTest, emitRecordHTML) {
SmallString<16> PathTo;
llvm::sys::path::native("path/to", PathTo);
I.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
I.TagType = TagTypeKind::TTK_Class;
I.TagType = TagTypeKind::Class;
I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record, "F", PathTo);
I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ TEST(MDGeneratorTest, emitRecordMD) {
I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});

I.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
I.TagType = TagTypeKind::TTK_Class;
I.TagType = TagTypeKind::Class;
I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);

Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/unittests/clang-doc/MergeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TEST(MergeTest, mergeRecordInfos) {
One.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});

One.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
One.TagType = TagTypeKind::TTK_Class;
One.TagType = TagTypeKind::Class;
One.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
One.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);

Expand All @@ -105,7 +105,7 @@ TEST(MergeTest, mergeRecordInfos) {

Two.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});

Two.TagType = TagTypeKind::TTK_Class;
Two.TagType = TagTypeKind::Class;

Two.Children.Records.emplace_back(NonEmptySID, "SharedChildStruct",
InfoType::IT_record, "path");
Expand All @@ -128,7 +128,7 @@ TEST(MergeTest, mergeRecordInfos) {

Expected->Members.emplace_back(TypeInfo("int"), "X",
AccessSpecifier::AS_private);
Expected->TagType = TagTypeKind::TTK_Class;
Expected->TagType = TagTypeKind::Class;
Expected->Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
Expected->VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
Expected->Bases.emplace_back(EmptySID, "F", "path/to/F", true,
Expand Down
26 changes: 13 additions & 13 deletions clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ typedef struct {} G;)raw",
RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedE.TagType = TagTypeKind::TTK_Class;
ExpectedE.TagType = TagTypeKind::Class;
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedE.Members.emplace_back(TypeInfo("int"), "value",
AccessSpecifier::AS_public);
Expand Down Expand Up @@ -210,7 +210,7 @@ typedef struct {} G;)raw",
RecordInfo ExpectedF(EmptySID, /*Name=*/"F", /*Path=*/"GlobalNamespace");
ExpectedF.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedF.TagType = TagTypeKind::TTK_Struct;
ExpectedF.TagType = TagTypeKind::Struct;
ExpectedF.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
CheckRecordInfo(&ExpectedF, F);

Expand Down Expand Up @@ -253,7 +253,7 @@ typedef struct {} G;)raw",
RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"GlobalNamespace");
ExpectedG.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedG.TagType = TagTypeKind::TTK_Struct;
ExpectedG.TagType = TagTypeKind::Struct;
ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedG.IsTypeDef = true;
CheckRecordInfo(&ExpectedG, G);
Expand Down Expand Up @@ -295,7 +295,7 @@ TEST(SerializeTest, emitUndefinedRecordInfo) {
RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedE.TagType = TagTypeKind::TTK_Class;
ExpectedE.TagType = TagTypeKind::Class;
ExpectedE.Loc.emplace_back(0, llvm::SmallString<16>{"test.cpp"});
CheckRecordInfo(&ExpectedE, E);
}
Expand All @@ -308,7 +308,7 @@ TEST(SerializeTest, emitRecordMemberInfo) {
RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedE.TagType = TagTypeKind::TTK_Struct;
ExpectedE.TagType = TagTypeKind::Struct;
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedE.Members.emplace_back(TypeInfo("int"), "I",
AccessSpecifier::AS_public);
Expand All @@ -324,15 +324,15 @@ TEST(SerializeTest, emitInternalRecordInfo) {
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedE.TagType = TagTypeKind::TTK_Class;
ExpectedE.TagType = TagTypeKind::Class;
CheckRecordInfo(&ExpectedE, E);

RecordInfo *G = InfoAsRecord(Infos[2].get());
llvm::SmallString<128> ExpectedGPath("GlobalNamespace/E");
llvm::sys::path::native(ExpectedGPath);
RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/ExpectedGPath);
ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedG.TagType = TagTypeKind::TTK_Class;
ExpectedG.TagType = TagTypeKind::Class;
ExpectedG.Namespace.emplace_back(EmptySID, "E", InfoType::IT_record);
ExpectedG.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
Expand Down Expand Up @@ -391,15 +391,15 @@ class J : public I<int> {} ;)raw",
RecordInfo ExpectedF(EmptySID, /*Name=*/"F", /*Path=*/"GlobalNamespace");
ExpectedF.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace, "");
ExpectedF.TagType = TagTypeKind::TTK_Class;
ExpectedF.TagType = TagTypeKind::Class;
ExpectedF.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
CheckRecordInfo(&ExpectedF, F);

RecordInfo *G = InfoAsRecord(Infos[3].get());
RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"GlobalNamespace");
ExpectedG.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedG.TagType = TagTypeKind::TTK_Class;
ExpectedG.TagType = TagTypeKind::Class;
ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedG.Members.emplace_back(TypeInfo("int"), "I",
AccessSpecifier::AS_protected);
Expand Down Expand Up @@ -446,14 +446,14 @@ class J : public I<int> {} ;)raw",
ExpectedE.Bases.back().Members.emplace_back(TypeInfo("int"), "I",
AccessSpecifier::AS_private);
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedE.TagType = TagTypeKind::TTK_Class;
ExpectedE.TagType = TagTypeKind::Class;
CheckRecordInfo(&ExpectedE, E);

RecordInfo *H = InfoAsRecord(Infos[8].get());
RecordInfo ExpectedH(EmptySID, /*Name=*/"H", /*Path=*/"GlobalNamespace");
ExpectedH.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedH.TagType = TagTypeKind::TTK_Class;
ExpectedH.TagType = TagTypeKind::Class;
ExpectedH.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedH.Parents.emplace_back(EmptySID, /*Name=*/"E", InfoType::IT_record,
/*QualName=*/"E", /*Path=*/"GlobalNamespace");
Expand Down Expand Up @@ -500,7 +500,7 @@ class J : public I<int> {} ;)raw",
RecordInfo ExpectedI(EmptySID, /*Name=*/"I", /*Path=*/"GlobalNamespace");
ExpectedI.Namespace.emplace_back(EmptySID, "GlobalNamespace",
InfoType::IT_namespace);
ExpectedI.TagType = TagTypeKind::TTK_Class;
ExpectedI.TagType = TagTypeKind::Class;
ExpectedI.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
CheckRecordInfo(&ExpectedI, I);

Expand All @@ -514,7 +514,7 @@ class J : public I<int> {} ;)raw",
/*Path=*/"GlobalNamespace", false,
AccessSpecifier::AS_public, true);
ExpectedJ.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedJ.TagType = TagTypeKind::TTK_Class;
ExpectedJ.TagType = TagTypeKind::Class;
CheckRecordInfo(&ExpectedJ, J);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ TEST(YAMLGeneratorTest, emitRecordYAML) {
Brief->Children.back()->Text = "Value of the thing.";
I.Members.back().Description.push_back(std::move(TopComment));

I.TagType = TagTypeKind::TTK_Class;
I.TagType = TagTypeKind::Class;
I.Bases.emplace_back(EmptySID, "F", "path/to/F", true,
AccessSpecifier::AS_public, true);
I.Bases.back().Children.Functions.emplace_back();
Expand Down
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ Arm and AArch64 Support
This affects C++ functions with SVE ACLE parameters. Clang will use the old
manglings if ``-fclang-abi-compat=17`` or lower is specified.

- New AArch64 asm constraints have been added for r8-r11(Uci) and r12-r15(Ucj).

Android Support
^^^^^^^^^^^^^^^

Expand Down
5 changes: 3 additions & 2 deletions clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -1197,8 +1197,9 @@ class ASTContext : public RefCountedBase<ASTContext> {

/// Create a new implicit TU-level CXXRecordDecl or RecordDecl
/// declaration.
RecordDecl *buildImplicitRecord(StringRef Name,
RecordDecl::TagKind TK = TTK_Struct) const;
RecordDecl *buildImplicitRecord(
StringRef Name,
RecordDecl::TagKind TK = RecordDecl::TagKind::Struct) const;

/// Create a new implicit TU-level typedef declaration.
TypedefDecl *buildImplicitTypedef(QualType T, StringRef Name) const;
Expand Down
Loading

0 comments on commit e638fc1

Please sign in to comment.