Skip to content

Commit c59d43b

Browse files
authored
Merge branch 'main' into dag-always-push-freeze
2 parents 710f5f2 + b989c76 commit c59d43b

File tree

266 files changed

+9035
-4548
lines changed

Some content is hidden

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

266 files changed

+9035
-4548
lines changed

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 56 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -800,11 +800,39 @@ llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T I) {
800800
}
801801
}
802802

803-
// TODO: Create a helper that can receive a function to reduce repetition for
804-
// most blocks.
803+
// TODO: fix inconsistentent returning of errors in add callbacks.
804+
// Once that's fixed, we only need one handleSubBlock.
805+
template <typename InfoType, typename T, typename Callback>
806+
llvm::Error ClangDocBitcodeReader::handleSubBlock(unsigned ID, T Parent,
807+
Callback Function) {
808+
InfoType Info;
809+
if (auto Err = readBlock(ID, &Info))
810+
return Err;
811+
Function(Parent, std::move(Info));
812+
return llvm::Error::success();
813+
}
814+
815+
template <typename InfoType, typename T, typename Callback>
816+
llvm::Error ClangDocBitcodeReader::handleTypeSubBlock(unsigned ID, T Parent,
817+
Callback Function) {
818+
InfoType Info;
819+
if (auto Err = readBlock(ID, &Info))
820+
return Err;
821+
if (auto Err = Function(Parent, std::move(Info)))
822+
return Err;
823+
return llvm::Error::success();
824+
}
825+
805826
template <typename T>
806827
llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) {
807828
llvm::TimeTraceScope("Reducing infos", "readSubBlock");
829+
830+
static auto CreateAddFunc = [](auto AddFunc) {
831+
return [AddFunc](auto Parent, auto Child) {
832+
return AddFunc(Parent, std::move(Child));
833+
};
834+
};
835+
808836
switch (ID) {
809837
// Blocks can only have certain types of sub blocks.
810838
case BI_COMMENT_BLOCK_ID: {
@@ -816,28 +844,16 @@ llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) {
816844
return llvm::Error::success();
817845
}
818846
case BI_TYPE_BLOCK_ID: {
819-
TypeInfo TI;
820-
if (auto Err = readBlock(ID, &TI))
821-
return Err;
822-
if (auto Err = addTypeInfo(I, std::move(TI)))
823-
return Err;
824-
return llvm::Error::success();
847+
return handleTypeSubBlock<TypeInfo>(
848+
ID, I, CreateAddFunc(addTypeInfo<T, TypeInfo>));
825849
}
826850
case BI_FIELD_TYPE_BLOCK_ID: {
827-
FieldTypeInfo TI;
828-
if (auto Err = readBlock(ID, &TI))
829-
return Err;
830-
if (auto Err = addTypeInfo(I, std::move(TI)))
831-
return Err;
832-
return llvm::Error::success();
851+
return handleTypeSubBlock<FieldTypeInfo>(
852+
ID, I, CreateAddFunc(addTypeInfo<T, FieldTypeInfo>));
833853
}
834854
case BI_MEMBER_TYPE_BLOCK_ID: {
835-
MemberTypeInfo TI;
836-
if (auto Err = readBlock(ID, &TI))
837-
return Err;
838-
if (auto Err = addTypeInfo(I, std::move(TI)))
839-
return Err;
840-
return llvm::Error::success();
855+
return handleTypeSubBlock<MemberTypeInfo>(
856+
ID, I, CreateAddFunc(addTypeInfo<T, MemberTypeInfo>));
841857
}
842858
case BI_REFERENCE_BLOCK_ID: {
843859
Reference R;
@@ -848,81 +864,46 @@ llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) {
848864
return llvm::Error::success();
849865
}
850866
case BI_FUNCTION_BLOCK_ID: {
851-
FunctionInfo F;
852-
if (auto Err = readBlock(ID, &F))
853-
return Err;
854-
addChild(I, std::move(F));
855-
return llvm::Error::success();
867+
return handleSubBlock<FunctionInfo>(
868+
ID, I, CreateAddFunc(addChild<T, FunctionInfo>));
856869
}
857870
case BI_BASE_RECORD_BLOCK_ID: {
858-
BaseRecordInfo BR;
859-
if (auto Err = readBlock(ID, &BR))
860-
return Err;
861-
addChild(I, std::move(BR));
862-
return llvm::Error::success();
871+
return handleSubBlock<BaseRecordInfo>(
872+
ID, I, CreateAddFunc(addChild<T, BaseRecordInfo>));
863873
}
864874
case BI_ENUM_BLOCK_ID: {
865-
EnumInfo E;
866-
if (auto Err = readBlock(ID, &E))
867-
return Err;
868-
addChild(I, std::move(E));
869-
return llvm::Error::success();
875+
return handleSubBlock<EnumInfo>(ID, I,
876+
CreateAddFunc(addChild<T, EnumInfo>));
870877
}
871878
case BI_ENUM_VALUE_BLOCK_ID: {
872-
EnumValueInfo EV;
873-
if (auto Err = readBlock(ID, &EV))
874-
return Err;
875-
addChild(I, std::move(EV));
876-
return llvm::Error::success();
879+
return handleSubBlock<EnumValueInfo>(
880+
ID, I, CreateAddFunc(addChild<T, EnumValueInfo>));
877881
}
878882
case BI_TEMPLATE_BLOCK_ID: {
879-
TemplateInfo TI;
880-
if (auto Err = readBlock(ID, &TI))
881-
return Err;
882-
addTemplate(I, std::move(TI));
883-
return llvm::Error::success();
883+
return handleSubBlock<TemplateInfo>(ID, I, CreateAddFunc(addTemplate<T>));
884884
}
885885
case BI_TEMPLATE_SPECIALIZATION_BLOCK_ID: {
886-
TemplateSpecializationInfo TSI;
887-
if (auto Err = readBlock(ID, &TSI))
888-
return Err;
889-
addTemplateSpecialization(I, std::move(TSI));
890-
return llvm::Error::success();
886+
return handleSubBlock<TemplateSpecializationInfo>(
887+
ID, I, CreateAddFunc(addTemplateSpecialization<T>));
891888
}
892889
case BI_TEMPLATE_PARAM_BLOCK_ID: {
893-
TemplateParamInfo TPI;
894-
if (auto Err = readBlock(ID, &TPI))
895-
return Err;
896-
addTemplateParam(I, std::move(TPI));
897-
return llvm::Error::success();
890+
return handleSubBlock<TemplateParamInfo>(
891+
ID, I, CreateAddFunc(addTemplateParam<T>));
898892
}
899893
case BI_TYPEDEF_BLOCK_ID: {
900-
TypedefInfo TI;
901-
if (auto Err = readBlock(ID, &TI))
902-
return Err;
903-
addChild(I, std::move(TI));
904-
return llvm::Error::success();
894+
return handleSubBlock<TypedefInfo>(ID, I,
895+
CreateAddFunc(addChild<T, TypedefInfo>));
905896
}
906897
case BI_CONSTRAINT_BLOCK_ID: {
907-
ConstraintInfo CI;
908-
if (auto Err = readBlock(ID, &CI))
909-
return Err;
910-
addConstraint(I, std::move(CI));
911-
return llvm::Error::success();
898+
return handleSubBlock<ConstraintInfo>(ID, I,
899+
CreateAddFunc(addConstraint<T>));
912900
}
913901
case BI_CONCEPT_BLOCK_ID: {
914-
ConceptInfo CI;
915-
if (auto Err = readBlock(ID, &CI))
916-
return Err;
917-
addChild(I, std::move(CI));
918-
return llvm::Error::success();
902+
return handleSubBlock<ConceptInfo>(ID, I,
903+
CreateAddFunc(addChild<T, ConceptInfo>));
919904
}
920905
case BI_VAR_BLOCK_ID: {
921-
VarInfo VI;
922-
if (auto Err = readBlock(ID, &VI))
923-
return Err;
924-
addChild(I, std::move(VI));
925-
return llvm::Error::success();
906+
return handleSubBlock<VarInfo>(ID, I, CreateAddFunc(addChild<T, VarInfo>));
926907
}
927908
default:
928909
return llvm::createStringError(llvm::inconvertibleErrorCode(),

clang-tools-extra/clang-doc/BitcodeReader.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ class ClangDocBitcodeReader {
6464
// Helper function to set up the appropriate type of Info.
6565
llvm::Expected<std::unique_ptr<Info>> readBlockToInfo(unsigned ID);
6666

67+
template <typename InfoType, typename T, typename CallbackFunction>
68+
llvm::Error handleSubBlock(unsigned ID, T Parent, CallbackFunction Function);
69+
70+
template <typename InfoType, typename T, typename CallbackFunction>
71+
llvm::Error handleTypeSubBlock(unsigned ID, T Parent,
72+
CallbackFunction Function);
73+
6774
llvm::BitstreamCursor &Stream;
6875
std::optional<llvm::BitstreamBlockInfo> BlockInfo;
6976
FieldId CurrentReferenceField;

clang/docs/APINotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PrivateHeaders directory as well, though it does not need an additional
4242
"_private" suffix on its name.
4343

4444
Clang will search for API notes files next to module maps only when passed the
45-
``-fapi-notes-modules`` option.
45+
``-fapinotes-modules`` option.
4646

4747

4848
Limitations

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,9 +1702,9 @@ the configuration (without a prefix: ``Auto``).
17021702
.. _AllowAllArgumentsOnNextLine:
17031703

17041704
**AllowAllArgumentsOnNextLine** (``Boolean``) :versionbadge:`clang-format 9` :ref:`<AllowAllArgumentsOnNextLine>`
1705-
If a function call or braced initializer list doesn't fit on a
1706-
line, allow putting all arguments onto the next line, even if
1707-
``BinPackArguments`` is ``false``.
1705+
If a function call or braced initializer list doesn't fit on a line, allow
1706+
putting all arguments onto the next line, even if ``BinPackArguments`` is
1707+
``false``.
17081708

17091709
.. code-block:: c++
17101710

@@ -5528,8 +5528,7 @@ the configuration (without a prefix: ``Auto``).
55285528
.. _ReferenceAlignment:
55295529

55305530
**ReferenceAlignment** (``ReferenceAlignmentStyle``) :versionbadge:`clang-format 13` :ref:`<ReferenceAlignment>`
5531-
Reference alignment style (overrides ``PointerAlignment`` for
5532-
references).
5531+
Reference alignment style (overrides ``PointerAlignment`` for references).
55335532

55345533
Possible values:
55355534

@@ -6885,8 +6884,8 @@ the configuration (without a prefix: ``Auto``).
68856884
.. _TypenameMacros:
68866885

68876886
**TypenameMacros** (``List of Strings``) :versionbadge:`clang-format 9` :ref:`<TypenameMacros>`
6888-
A vector of macros that should be interpreted as type declarations
6889-
instead of as function calls.
6887+
A vector of macros that should be interpreted as type declarations instead
6888+
of as function calls.
68906889

68916890
These are expected to be macros of the form:
68926891

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ C Language Changes
223223
224224
char buf1[3] = "foo"; // -Wunterminated-string-initialization
225225
char buf2[3] = "flarp"; // -Wexcess-initializers
226+
char buf3[3] = "fo\0"; // This is fine, no warning.
226227
227228
This diagnostic can be suppressed by adding the new ``nonstring`` attribute
228229
to the field or variable being initialized. #GH137705

clang/include/clang/Basic/Builtins.td

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,6 +2588,24 @@ def InterlockedBittestAndReset_rel : MSLangBuiltin {
25882588
let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
25892589
}
25902590

2591+
def InterlockedBittestAndReset64_acq : MSLangBuiltin {
2592+
let Spellings = ["_interlockedbittestandreset64_acq"];
2593+
let Attributes = [NoThrow];
2594+
let Prototype = "unsigned char(int64_t volatile*, int64_t)";
2595+
}
2596+
2597+
def InterlockedBittestAndReset64_nf : MSLangBuiltin {
2598+
let Spellings = ["_interlockedbittestandreset64_nf"];
2599+
let Attributes = [NoThrow];
2600+
let Prototype = "unsigned char(int64_t volatile*, int64_t)";
2601+
}
2602+
2603+
def InterlockedBittestAndReset64_rel : MSLangBuiltin {
2604+
let Spellings = ["_interlockedbittestandreset64_rel"];
2605+
let Attributes = [NoThrow];
2606+
let Prototype = "unsigned char(int64_t volatile*, int64_t)";
2607+
}
2608+
25912609
def InterlockedBittestAndSet : MSLangBuiltin, MSInt32_64Template {
25922610
let Spellings = ["_interlockedbittestandset"];
25932611
let Attributes = [NoThrow];
@@ -2612,6 +2630,24 @@ def InterlockedBittestAndSet_rel : MSLangBuiltin {
26122630
let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
26132631
}
26142632

2633+
def InterlockedBittestAndSet64_acq : MSLangBuiltin {
2634+
let Spellings = ["_interlockedbittestandset64_acq"];
2635+
let Attributes = [NoThrow];
2636+
let Prototype = "unsigned char(int64_t volatile*, int64_t)";
2637+
}
2638+
2639+
def InterlockedBittestAndSet64_nf : MSLangBuiltin {
2640+
let Spellings = ["_interlockedbittestandset64_nf"];
2641+
let Attributes = [NoThrow];
2642+
let Prototype = "unsigned char(int64_t volatile*, int64_t)";
2643+
}
2644+
2645+
def InterlockedBittestAndSet64_rel : MSLangBuiltin {
2646+
let Spellings = ["_interlockedbittestandset64_rel"];
2647+
let Attributes = [NoThrow];
2648+
let Prototype = "unsigned char(int64_t volatile*, int64_t)";
2649+
}
2650+
26152651
def IsoVolatileLoad : MSLangBuiltin, Int8_16_32_64Template {
26162652
let Spellings = ["__iso_volatile_load"];
26172653
let Attributes = [NoThrow];

0 commit comments

Comments
 (0)