Skip to content

Commit 950076c

Browse files
committed
Vendor import of llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.
1 parent aca2e42 commit 950076c

File tree

241 files changed

+5209
-2318
lines changed

Some content is hidden

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

241 files changed

+5209
-2318
lines changed

clang/include/clang/AST/DeclBase.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "clang/AST/SelectorLocationsKind.h"
2020
#include "clang/Basic/IdentifierTable.h"
2121
#include "clang/Basic/LLVM.h"
22+
#include "clang/Basic/LangOptions.h"
2223
#include "clang/Basic/SourceLocation.h"
2324
#include "clang/Basic/Specifiers.h"
2425
#include "llvm/ADT/ArrayRef.h"
@@ -488,6 +489,15 @@ class alignas(8) Decl {
488489
// Return true if this is a FileContext Decl.
489490
bool isFileContextDecl() const;
490491

492+
/// Whether it resembles a flexible array member. This is a static member
493+
/// because we want to be able to call it with a nullptr. That allows us to
494+
/// perform non-Decl specific checks based on the object's type and strict
495+
/// flex array level.
496+
static bool isFlexibleArrayMemberLike(
497+
ASTContext &Context, const Decl *D, QualType Ty,
498+
LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel,
499+
bool IgnoreTemplateOrMacroSubstitution);
500+
491501
ASTContext &getASTContext() const LLVM_READONLY;
492502

493503
/// Helper to get the language options from the ASTContext.

clang/include/clang/AST/DeclCXX.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,9 @@ class CXXRecordDecl : public RecordDecl {
14251425
/// (C++11 [class]p6).
14261426
bool isTriviallyCopyable() const;
14271427

1428+
/// Determine whether this class is considered trivially copyable per
1429+
bool isTriviallyCopyConstructible() const;
1430+
14281431
/// Determine whether this class is considered trivial.
14291432
///
14301433
/// C++11 [class]p6:

clang/include/clang/AST/Stmt.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,8 +1631,10 @@ class CompoundStmt final
16311631
SourceLocation RB);
16321632

16331633
// Build an empty compound statement with a location.
1634-
explicit CompoundStmt(SourceLocation Loc)
1635-
: Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(Loc) {
1634+
explicit CompoundStmt(SourceLocation Loc) : CompoundStmt(Loc, Loc) {}
1635+
1636+
CompoundStmt(SourceLocation Loc, SourceLocation EndLoc)
1637+
: Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(EndLoc) {
16361638
CompoundStmtBits.NumStmts = 0;
16371639
CompoundStmtBits.HasFPFeatures = 0;
16381640
}

clang/include/clang/AST/Type.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,9 @@ class QualType {
917917
/// Return true if this is a trivially copyable type (C++0x [basic.types]p9)
918918
bool isTriviallyCopyableType(const ASTContext &Context) const;
919919

920+
/// Return true if this is a trivially copyable type
921+
bool isTriviallyCopyConstructibleType(const ASTContext &Context) const;
922+
920923
/// Return true if this is a trivially relocatable type.
921924
bool isTriviallyRelocatableType(const ASTContext &Context) const;
922925

clang/include/clang/Basic/Attr.td

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4372,3 +4372,21 @@ def CodeAlign: StmtAttr {
43724372
static constexpr int MaximumAlignment = 4096;
43734373
}];
43744374
}
4375+
4376+
def CountedBy : InheritableAttr {
4377+
let Spellings = [Clang<"counted_by">];
4378+
let Subjects = SubjectList<[Field]>;
4379+
let Args = [IdentifierArgument<"CountedByField">];
4380+
let Documentation = [CountedByDocs];
4381+
let LangOpts = [COnly];
4382+
// FIXME: This is ugly. Let using a DeclArgument would be nice, but a Decl
4383+
// isn't yet available due to the fact that we're still parsing the
4384+
// structure. Maybe that code could be changed sometime in the future.
4385+
code AdditionalMembers = [{
4386+
private:
4387+
SourceRange CountedByFieldLoc;
4388+
public:
4389+
SourceRange getCountedByFieldLoc() const { return CountedByFieldLoc; }
4390+
void setCountedByFieldLoc(SourceRange Loc) { CountedByFieldLoc = Loc; }
4391+
}];
4392+
}

clang/include/clang/Basic/AttrDocs.td

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7749,3 +7749,81 @@ but do not pass them to the underlying coroutine or pass them by value.
77497749
.. _`CRT`: https://clang.llvm.org/docs/AttributeReference.html#coro-return-type
77507750
}];
77517751
}
7752+
7753+
def CountedByDocs : Documentation {
7754+
let Category = DocCatField;
7755+
let Content = [{
7756+
Clang supports the ``counted_by`` attribute on the flexible array member of a
7757+
structure in C. The argument for the attribute is the name of a field member
7758+
holding the count of elements in the flexible array. This information can be
7759+
used to improve the results of the array bound sanitizer and the
7760+
``__builtin_dynamic_object_size`` builtin. The ``count`` field member must be
7761+
within the same non-anonymous, enclosing struct as the flexible array member.
7762+
7763+
This example specifies that the flexible array member ``array`` has the number
7764+
of elements allocated for it in ``count``:
7765+
7766+
.. code-block:: c
7767+
7768+
struct bar;
7769+
7770+
struct foo {
7771+
size_t count;
7772+
char other;
7773+
struct bar *array[] __attribute__((counted_by(count)));
7774+
};
7775+
7776+
This establishes a relationship between ``array`` and ``count``. Specifically,
7777+
``array`` must have at least ``count`` number of elements available. It's the
7778+
user's responsibility to ensure that this relationship is maintained through
7779+
changes to the structure.
7780+
7781+
In the following example, the allocated array erroneously has fewer elements
7782+
than what's specified by ``p->count``. This would result in an out-of-bounds
7783+
access not being detected.
7784+
7785+
.. code-block:: c
7786+
7787+
#define SIZE_INCR 42
7788+
7789+
struct foo *p;
7790+
7791+
void foo_alloc(size_t count) {
7792+
p = malloc(MAX(sizeof(struct foo),
7793+
offsetof(struct foo, array[0]) + count * sizeof(struct bar *)));
7794+
p->count = count + SIZE_INCR;
7795+
}
7796+
7797+
The next example updates ``p->count``, but breaks the relationship requirement
7798+
that ``p->array`` must have at least ``p->count`` number of elements available:
7799+
7800+
.. code-block:: c
7801+
7802+
#define SIZE_INCR 42
7803+
7804+
struct foo *p;
7805+
7806+
void foo_alloc(size_t count) {
7807+
p = malloc(MAX(sizeof(struct foo),
7808+
offsetof(struct foo, array[0]) + count * sizeof(struct bar *)));
7809+
p->count = count;
7810+
}
7811+
7812+
void use_foo(int index, int val) {
7813+
p->count += SIZE_INCR + 1; /* 'count' is now larger than the number of elements of 'array'. */
7814+
p->array[index] = val; /* The sanitizer can't properly check this access. */
7815+
}
7816+
7817+
In this example, an update to ``p->count`` maintains the relationship
7818+
requirement:
7819+
7820+
.. code-block:: c
7821+
7822+
void use_foo(int index, int val) {
7823+
if (p->count == 0)
7824+
return;
7825+
--p->count;
7826+
p->array[index] = val;
7827+
}
7828+
}];
7829+
}

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def err_verify_no_such_marker : Error<
167167
def err_verify_missing_start : Error<
168168
"cannot find start ('{{') of expected %0">;
169169
def err_verify_missing_end : Error<
170-
"cannot find end ('}}') of expected %0">;
170+
"cannot find end ('%1') of expected %0">;
171171
def err_verify_invalid_content : Error<
172172
"invalid expected %0: %1">;
173173
def err_verify_missing_regex : Error<

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,8 @@ def warn_cxx17_compat_aggregate_init_paren_list : Warning<
22532253
def err_reference_bind_to_bitfield : Error<
22542254
"%select{non-const|volatile}0 reference cannot bind to "
22552255
"bit-field%select{| %1}2">;
2256+
def err_reference_bind_to_bitfield_in_cce : Error<
2257+
"reference cannot bind to bit-field in converted constant expression">;
22562258
def err_reference_bind_to_vector_element : Error<
22572259
"%select{non-const|volatile}0 reference cannot bind to vector element">;
22582260
def err_reference_bind_to_matrix_element : Error<
@@ -6439,6 +6441,19 @@ def warn_superclass_variable_sized_type_not_at_end : Warning<
64396441
"field %0 can overwrite instance variable %1 with variable sized type %2"
64406442
" in superclass %3">, InGroup<ObjCFlexibleArray>;
64416443

6444+
def err_flexible_array_count_not_in_same_struct : Error<
6445+
"'counted_by' field %0 isn't within the same struct as the flexible array">;
6446+
def err_counted_by_attr_not_on_flexible_array_member : Error<
6447+
"'counted_by' only applies to C99 flexible array members">;
6448+
def err_counted_by_attr_refers_to_flexible_array : Error<
6449+
"'counted_by' cannot refer to the flexible array %0">;
6450+
def err_counted_by_must_be_in_structure : Error<
6451+
"field %0 in 'counted_by' not inside structure">;
6452+
def err_flexible_array_counted_by_attr_field_not_integer : Error<
6453+
"field %0 in 'counted_by' must be a non-boolean integer type">;
6454+
def note_flexible_array_counted_by_attr_field : Note<
6455+
"field %0 declared here">;
6456+
64426457
let CategoryName = "ARC Semantic Issue" in {
64436458

64446459
// ARC-mode diagnostics.

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ ENUM_LANGOPT(SignReturnAddressKey, SignReturnAddressKeyKind, 1, SignReturnAddres
457457
"Key used for return address signing")
458458
LANGOPT(BranchTargetEnforcement, 1, 0, "Branch-target enforcement enabled")
459459
LANGOPT(BranchProtectionPAuthLR, 1, 0, "Use PC as a diversifier using PAuthLR NOP instructions.")
460+
LANGOPT(GuardedControlStack, 1, 0, "Guarded control stack enabled")
460461

461462
LANGOPT(SpeculativeLoadHardening, 1, 0, "Speculative load hardening enabled")
462463

clang/include/clang/Basic/TargetInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,7 @@ class TargetInfo : public TransferrableTargetInfo,
13731373
LangOptions::SignReturnAddressKeyKind::AKey;
13741374
bool BranchTargetEnforcement = false;
13751375
bool BranchProtectionPAuthLR = false;
1376+
bool GuardedControlStack = false;
13761377
};
13771378

13781379
/// Determine if the Architecture in this TargetInfo supports branch

clang/include/clang/Basic/arm_sve.td

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@ let TargetGuard = "sve,bf16" in {
454454

455455
let TargetGuard = "sve2p1" in {
456456
// Contiguous truncating store from quadword (single vector).
457-
def SVST1UWQ : MInst<"svst1uwq[_{d}]", "vPcd", "iUif", [IsStore], MemEltTyInt32, "aarch64_sve_st1uwq">;
458-
def SVST1UWQ_VNUM : MInst<"svst1uwq_vnum[_{d}]", "vPcld", "iUif", [IsStore], MemEltTyInt32, "aarch64_sve_st1uwq">;
457+
def SVST1UWQ : MInst<"svst1wq[_{d}]", "vPcd", "iUif", [IsStore], MemEltTyInt32, "aarch64_sve_st1wq">;
458+
def SVST1UWQ_VNUM : MInst<"svst1wq_vnum[_{d}]", "vPcld", "iUif", [IsStore], MemEltTyInt32, "aarch64_sve_st1wq">;
459459

460-
def SVST1UDQ : MInst<"svst1udq[_{d}]", "vPcd", "lUld", [IsStore], MemEltTyInt64, "aarch64_sve_st1udq">;
461-
def SVST1UDQ_VNUM : MInst<"svst1udq_vnum[_{d}]", "vPcld", "lUld", [IsStore], MemEltTyInt64, "aarch64_sve_st1udq">;
460+
def SVST1UDQ : MInst<"svst1dq[_{d}]", "vPcd", "lUld", [IsStore], MemEltTyInt64, "aarch64_sve_st1dq">;
461+
def SVST1UDQ_VNUM : MInst<"svst1dq_vnum[_{d}]", "vPcld", "lUld", [IsStore], MemEltTyInt64, "aarch64_sve_st1dq">;
462462

463463
// Store one vector (vector base + scalar offset)
464464
def SVST1Q_SCATTER_U64BASE_OFFSET : MInst<"svst1q_scatter[_{2}base]_offset[_{d}]", "vPgld", "cUcsUsiUilUlfhdb", [IsScatterStore, IsByteIndexed], MemEltTyDefault, "aarch64_sve_st1q_scatter_scalar_offset">;
@@ -2040,12 +2040,12 @@ let TargetGuard = "sve2p1|sme2" in {
20402040
}
20412041

20422042
let TargetGuard = "sve2p1" in {
2043-
def SVDOT_X2_S : SInst<"svdot[_{d}_{2}_{3}]", "ddhh", "i", MergeNone, "aarch64_sve_sdot_x2", [], []>;
2044-
def SVDOT_X2_U : SInst<"svdot[_{d}_{2}_{3}]", "ddhh", "Ui", MergeNone, "aarch64_sve_udot_x2", [], []>;
2045-
def SVDOT_X2_F : SInst<"svdot[_{d}_{2}_{3}]", "ddhh", "f", MergeNone, "aarch64_sve_fdot_x2", [], []>;
2046-
def SVDOT_LANE_X2_S : SInst<"svdot_lane[_{d}_{2}_{3}]", "ddhhi", "i", MergeNone, "aarch64_sve_sdot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
2047-
def SVDOT_LANE_X2_U : SInst<"svdot_lane[_{d}_{2}_{3}]", "ddhhi", "Ui", MergeNone, "aarch64_sve_udot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
2048-
def SVDOT_LANE_X2_F : SInst<"svdot_lane[_{d}_{2}_{3}]", "ddhhi", "f", MergeNone, "aarch64_sve_fdot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
2043+
def SVDOT_X2_S : SInst<"svdot[_{d}_{2}]", "ddhh", "i", MergeNone, "aarch64_sve_sdot_x2", [], []>;
2044+
def SVDOT_X2_U : SInst<"svdot[_{d}_{2}]", "ddhh", "Ui", MergeNone, "aarch64_sve_udot_x2", [], []>;
2045+
def SVDOT_X2_F : SInst<"svdot[_{d}_{2}]", "ddhh", "f", MergeNone, "aarch64_sve_fdot_x2", [], []>;
2046+
def SVDOT_LANE_X2_S : SInst<"svdot_lane[_{d}_{2}]", "ddhhi", "i", MergeNone, "aarch64_sve_sdot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
2047+
def SVDOT_LANE_X2_U : SInst<"svdot_lane[_{d}_{2}]", "ddhhi", "Ui", MergeNone, "aarch64_sve_udot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
2048+
def SVDOT_LANE_X2_F : SInst<"svdot_lane[_{d}_{2}]", "ddhhi", "f", MergeNone, "aarch64_sve_fdot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
20492049
}
20502050

20512051
let TargetGuard = "sve2p1|sme2" in {
@@ -2208,7 +2208,7 @@ let TargetGuard = "sve2p1" in {
22082208
def SVTBLQ : SInst<"svtblq[_{d}]", "ddu", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_tblq">;
22092209
def SVTBXQ : SInst<"svtbxq[_{d}]", "dddu", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_tbxq">;
22102210
// EXTQ
2211-
def EXTQ : SInst<"svextq_lane[_{d}]", "dddk", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_extq_lane", [], [ImmCheck<2, ImmCheck0_15>]>;
2211+
def EXTQ : SInst<"svextq[_{d}]", "dddk", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_extq", [], [ImmCheck<2, ImmCheck0_15>]>;
22122212
// PMOV
22132213
// Move to Pred
22142214
multiclass PMOV_TO_PRED<string name, string types, string intrinsic, list<FlagType> flags=[], ImmCheckType immCh > {

clang/include/clang/Driver/Options.td

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4267,7 +4267,7 @@ def iquote : JoinedOrSeparate<["-"], "iquote">, Group<clang_i_Group>,
42674267
Visibility<[ClangOption, CC1Option]>,
42684268
HelpText<"Add directory to QUOTE include search path">, MetaVarName<"<directory>">;
42694269
def isysroot : JoinedOrSeparate<["-"], "isysroot">, Group<clang_i_Group>,
4270-
Visibility<[ClangOption, CC1Option]>,
4270+
Visibility<[ClangOption, CC1Option, FlangOption]>,
42714271
HelpText<"Set the system root directory (usually /)">, MetaVarName<"<dir>">,
42724272
MarshallingInfoString<HeaderSearchOpts<"Sysroot">, [{"/"}]>;
42734273
def isystem : JoinedOrSeparate<["-"], "isystem">, Group<clang_i_Group>,
@@ -4585,11 +4585,13 @@ let Flags = [TargetSpecific] in {
45854585
def menable_experimental_extensions : Flag<["-"], "menable-experimental-extensions">, Group<m_Group>,
45864586
HelpText<"Enable use of experimental RISC-V extensions.">;
45874587
def mrvv_vector_bits_EQ : Joined<["-"], "mrvv-vector-bits=">, Group<m_Group>,
4588-
HelpText<"Specify the size in bits of an RVV vector register. Defaults to "
4589-
"the vector length agnostic value of \"scalable\". Accepts power of "
4590-
"2 values between 64 and 65536. Also accepts \"zvl\" "
4591-
"to use the value implied by -march/-mcpu. Value will be reflected "
4592-
"in __riscv_v_fixed_vlen preprocessor define (RISC-V only)">;
4588+
Visibility<[ClangOption, FlangOption]>,
4589+
HelpText<"Specify the size in bits of an RVV vector register">,
4590+
DocBrief<"Defaults to the vector length agnostic value of \"scalable\". "
4591+
"Accepts power of 2 values between 64 and 65536. Also accepts "
4592+
"\"zvl\" to use the value implied by -march/-mcpu. On Clang, value "
4593+
"will be reflected in __riscv_v_fixed_vlen preprocessor define "
4594+
"(RISC-V only)">;
45934595

45944596
def munaligned_access : Flag<["-"], "munaligned-access">, Group<m_Group>,
45954597
HelpText<"Allow memory accesses to be unaligned (AArch32/AArch64/LoongArch/RISC-V only)">;
@@ -5197,7 +5199,7 @@ def nohipwrapperinc : Flag<["-"], "nohipwrapperinc">, Group<IncludePath_Group>,
51975199
HelpText<"Do not include the default HIP wrapper headers and include paths">;
51985200
def : Flag<["-"], "nocudainc">, Alias<nogpuinc>;
51995201
def nogpulib : Flag<["-"], "nogpulib">, MarshallingInfoFlag<LangOpts<"NoGPULib">>,
5200-
Visibility<[ClangOption, CC1Option]>,
5202+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
52015203
HelpText<"Do not link device library for CUDA/HIP device compilation">;
52025204
def : Flag<["-"], "nocudalib">, Alias<nogpulib>;
52035205
def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
@@ -7010,6 +7012,8 @@ def mbranch_target_enforce : Flag<["-"], "mbranch-target-enforce">,
70107012
MarshallingInfoFlag<LangOpts<"BranchTargetEnforcement">>;
70117013
def mbranch_protection_pauth_lr : Flag<["-"], "mbranch-protection-pauth-lr">,
70127014
MarshallingInfoFlag<LangOpts<"BranchProtectionPAuthLR">>;
7015+
def mguarded_control_stack : Flag<["-"], "mguarded-control-stack">,
7016+
MarshallingInfoFlag<LangOpts<"GuardedControlStack">>;
70137017
def fno_dllexport_inlines : Flag<["-"], "fno-dllexport-inlines">,
70147018
MarshallingInfoNegativeFlag<LangOpts<"DllExportInlines">>;
70157019
def cfguard_no_checks : Flag<["-"], "cfguard-no-checks">,

clang/include/clang/Format/Format.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,22 @@ struct FormatStyle {
225225
/// bbb = 2;
226226
/// \endcode
227227
bool AlignCompound;
228+
/// Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
229+
/// aligned.
230+
/// \code
231+
/// true:
232+
/// unsigned i;
233+
/// int &r;
234+
/// int *p;
235+
/// int (*f)();
236+
///
237+
/// false:
238+
/// unsigned i;
239+
/// int &r;
240+
/// int *p;
241+
/// int (*f)();
242+
/// \endcode
243+
bool AlignFunctionPointers;
228244
/// Only for ``AlignConsecutiveAssignments``. Whether short assignment
229245
/// operators are left-padded to the same length as long ones in order to
230246
/// put all assignment operators to the right of the left hand side.
@@ -247,7 +263,9 @@ struct FormatStyle {
247263
bool operator==(const AlignConsecutiveStyle &R) const {
248264
return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
249265
AcrossComments == R.AcrossComments &&
250-
AlignCompound == R.AlignCompound && PadOperators == R.PadOperators;
266+
AlignCompound == R.AlignCompound &&
267+
AlignFunctionPointers == R.AlignFunctionPointers &&
268+
PadOperators == R.PadOperators;
251269
}
252270
bool operator!=(const AlignConsecutiveStyle &R) const {
253271
return !(*this == R);

clang/include/clang/Parse/Parser.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,26 @@ class Parser : public CodeCompletionHandler {
234234
/// Parsing OpenACC directive mode.
235235
bool OpenACCDirectiveParsing = false;
236236

237+
/// Currently parsing a situation where an OpenACC array section could be
238+
/// legal, such as a 'var-list'.
239+
bool AllowOpenACCArraySections = false;
240+
241+
/// RAII object to set reset OpenACC parsing a context where Array Sections
242+
/// are allowed.
243+
class OpenACCArraySectionRAII {
244+
Parser &P;
245+
246+
public:
247+
OpenACCArraySectionRAII(Parser &P) : P(P) {
248+
assert(!P.AllowOpenACCArraySections);
249+
P.AllowOpenACCArraySections = true;
250+
}
251+
~OpenACCArraySectionRAII() {
252+
assert(P.AllowOpenACCArraySections);
253+
P.AllowOpenACCArraySections = false;
254+
}
255+
};
256+
237257
/// When true, we are directly inside an Objective-C message
238258
/// send expression.
239259
///
@@ -3546,8 +3566,8 @@ class Parser : public CodeCompletionHandler {
35463566
ExprResult ParseOpenACCIDExpression();
35473567
/// Parses the variable list for the `cache` construct.
35483568
void ParseOpenACCCacheVarList();
3549-
/// Parses a single variable in a variable list for the 'cache' construct.
3550-
bool ParseOpenACCCacheVar();
3569+
/// Parses a single variable in a variable list for OpenACC.
3570+
bool ParseOpenACCVar();
35513571
bool ParseOpenACCWaitArgument();
35523572

35533573
private:

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4799,6 +4799,8 @@ class Sema final {
47994799
bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
48004800
const AttributeCommonInfo &A);
48014801

4802+
bool CheckCountedByAttr(Scope *Scope, const FieldDecl *FD);
4803+
48024804
/// Adjust the calling convention of a method to be the ABI default if it
48034805
/// wasn't specified explicitly. This handles method types formed from
48044806
/// function type typedefs and typename template arguments.
@@ -5642,6 +5644,7 @@ class Sema final {
56425644
CorrectionCandidateCallback &CCC,
56435645
TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
56445646
ArrayRef<Expr *> Args = std::nullopt,
5647+
DeclContext *LookupCtx = nullptr,
56455648
TypoExpr **Out = nullptr);
56465649

56475650
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S,

0 commit comments

Comments
 (0)