Skip to content

Commit 3081cf7

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I24e7181c6d2e700e1b54b27389442bf498debc83
2 parents e471d65 + 297b6de commit 3081cf7

File tree

325 files changed

+12646
-3106
lines changed

Some content is hidden

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

325 files changed

+12646
-3106
lines changed

clang-tools-extra/test/pp-trace/pp-trace-macro.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ X
3131
// CHECK: MacroNameTok: __STDC_UTF_32__
3232
// CHECK-NEXT: MacroDirective: MD_Define
3333
// CHECK: - Callback: MacroDefined
34+
// CHECK-NEXT: MacroNameTok: __STDC_EMBED_NOT_FOUND__
35+
// CHECK-NEXT: MacroDirective: MD_Define
36+
// CHECK: - Callback: MacroDefined
37+
// CHECK-NEXT: MacroNameTok: __STDC_EMBED_FOUND__
38+
// CHECK-NEXT: MacroDirective: MD_Define
39+
// CHECK: - Callback: MacroDefined
40+
// CHECK-NEXT: MacroNameTok: __STDC_EMBED_EMPTY__
41+
// CHECK-NEXT: MacroDirective: MD_Define
42+
// CHECK: - Callback: MacroDefined
3443
// CHECK: - Callback: MacroDefined
3544
// CHECK-NEXT: MacroNameTok: MACRO
3645
// CHECK-NEXT: MacroDirective: MD_Define

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,24 @@ foreach(target armv6m-unknown-eabi)
328328
endforeach()
329329
set(RUNTIMES_${target}_LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
330330
set(RUNTIMES_${target}_LIBC_ENABLE_USE_BY_CLANG ON CACHE BOOL "")
331+
set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
332+
set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
333+
set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
334+
set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
335+
set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
336+
set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
337+
set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
338+
set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
339+
set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
340+
set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
341+
set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
342+
set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
343+
set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
344+
set(RUNTIMES_${target}_LIBCXX_INSTALL_LIBRARY OFF CACHE BOOL "")
345+
set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
331346
set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
332347
set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
333-
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc" CACHE STRING "")
348+
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
334349
endforeach()
335350

336351
foreach(target riscv32-unknown-elf)
@@ -361,9 +376,24 @@ foreach(target riscv32-unknown-elf)
361376
endforeach()
362377
set(RUNTIMES_${target}_LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
363378
set(RUNTIMES_${target}_LIBC_ENABLE_USE_BY_CLANG ON CACHE BOOL "")
379+
set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
380+
set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
381+
set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
382+
set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
383+
set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
384+
set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
385+
set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
386+
set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
387+
set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
388+
set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
389+
set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
390+
set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
391+
set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
392+
set(RUNTIMES_${target}_LIBCXX_INSTALL_LIBRARY OFF CACHE BOOL "")
393+
set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
364394
set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
365395
set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
366-
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc" CACHE STRING "")
396+
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
367397
endforeach()
368398

369399
set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")

clang/docs/LanguageExtensions.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,7 @@ Attributes on Structured Bindings __cpp_structured_bindings C+
15021502
Designated initializers (N494) C99 C89
15031503
Array & element qualification (N2607) C23 C89
15041504
Attributes (N2335) C23 C89
1505+
``#embed`` (N3017) C23 C89, C++
15051506
============================================ ================================ ============= =============
15061507

15071508
Type Trait Primitives
@@ -5664,3 +5665,26 @@ Compiling different TUs depending on these flags (including use of
56645665
``std::hardware_destructive_interference``) with different compilers, macro
56655666
definitions, or architecture flags will lead to ODR violations and should be
56665667
avoided.
5668+
5669+
``#embed`` Parameters
5670+
=====================
5671+
5672+
``clang::offset``
5673+
-----------------
5674+
The ``clang::offset`` embed parameter may appear zero or one time in the
5675+
embed parameter sequence. Its preprocessor argument clause shall be present and
5676+
have the form:
5677+
5678+
..code-block: text
5679+
5680+
( constant-expression )
5681+
5682+
and shall be an integer constant expression. The integer constant expression
5683+
shall not evaluate to a value less than 0. The token ``defined`` shall not
5684+
appear within the constant expression.
5685+
5686+
The offset will be used when reading the contents of the embedded resource to
5687+
specify the starting offset to begin embedding from. The resources is treated
5688+
as being empty if the specified offset is larger than the number of bytes in
5689+
the resource. The offset will be applied *before* any ``limit`` parameters are
5690+
applied.

clang/include/clang/AST/Expr.h

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4799,6 +4799,166 @@ class SourceLocExpr final : public Expr {
47994799
friend class ASTStmtReader;
48004800
};
48014801

4802+
/// Stores data related to a single #embed directive.
4803+
struct EmbedDataStorage {
4804+
StringLiteral *Filename;
4805+
StringLiteral *BinaryData;
4806+
size_t getDataElementCount() const { return BinaryData->getByteLength(); }
4807+
};
4808+
4809+
/// Represents a reference to #emded data. By default, this references the whole
4810+
/// range. Otherwise it represents a subrange of data imported by #embed
4811+
/// directive. Needed to handle nested initializer lists with #embed directives.
4812+
/// Example:
4813+
/// struct S {
4814+
/// int x, y;
4815+
/// };
4816+
///
4817+
/// struct T {
4818+
/// int x[2];
4819+
/// struct S s
4820+
/// };
4821+
///
4822+
/// struct T t[] = {
4823+
/// #embed "data" // data contains 10 elements;
4824+
/// };
4825+
///
4826+
/// The resulting semantic form of initializer list will contain (EE stands
4827+
/// for EmbedExpr):
4828+
/// { {EE(first two data elements), {EE(3rd element), EE(4th element) }},
4829+
/// { {EE(5th and 6th element), {EE(7th element), EE(8th element) }},
4830+
/// { {EE(9th and 10th element), { zeroinitializer }}}
4831+
///
4832+
/// EmbedExpr inside of a semantic initializer list and referencing more than
4833+
/// one element can only appear for arrays of scalars.
4834+
class EmbedExpr final : public Expr {
4835+
SourceLocation EmbedKeywordLoc;
4836+
IntegerLiteral *FakeChildNode = nullptr;
4837+
const ASTContext *Ctx = nullptr;
4838+
EmbedDataStorage *Data;
4839+
unsigned Begin = 0;
4840+
unsigned NumOfElements;
4841+
4842+
public:
4843+
EmbedExpr(const ASTContext &Ctx, SourceLocation Loc, EmbedDataStorage *Data,
4844+
unsigned Begin, unsigned NumOfElements);
4845+
explicit EmbedExpr(EmptyShell Empty) : Expr(SourceLocExprClass, Empty) {}
4846+
4847+
SourceLocation getLocation() const { return EmbedKeywordLoc; }
4848+
SourceLocation getBeginLoc() const { return EmbedKeywordLoc; }
4849+
SourceLocation getEndLoc() const { return EmbedKeywordLoc; }
4850+
4851+
StringLiteral *getFilenameStringLiteral() const { return Data->Filename; }
4852+
StringLiteral *getDataStringLiteral() const { return Data->BinaryData; }
4853+
EmbedDataStorage *getData() const { return Data; }
4854+
4855+
unsigned getStartingElementPos() const { return Begin; }
4856+
size_t getDataElementCount() const { return NumOfElements; }
4857+
4858+
// Allows accessing every byte of EmbedExpr data and iterating over it.
4859+
// An Iterator knows the EmbedExpr that it refers to, and an offset value
4860+
// within the data.
4861+
// Dereferencing an Iterator results in construction of IntegerLiteral AST
4862+
// node filled with byte of data of the corresponding EmbedExpr within offset
4863+
// that the Iterator currently has.
4864+
template <bool Const>
4865+
class ChildElementIter
4866+
: public llvm::iterator_facade_base<
4867+
ChildElementIter<Const>, std::random_access_iterator_tag,
4868+
std::conditional_t<Const, const IntegerLiteral *,
4869+
IntegerLiteral *>> {
4870+
friend class EmbedExpr;
4871+
4872+
EmbedExpr *EExpr = nullptr;
4873+
unsigned long long CurOffset = ULLONG_MAX;
4874+
using BaseTy = typename ChildElementIter::iterator_facade_base;
4875+
4876+
ChildElementIter(EmbedExpr *E) : EExpr(E) {
4877+
if (E)
4878+
CurOffset = E->getStartingElementPos();
4879+
}
4880+
4881+
public:
4882+
ChildElementIter() : CurOffset(ULLONG_MAX) {}
4883+
typename BaseTy::reference operator*() const {
4884+
assert(EExpr && CurOffset != ULLONG_MAX &&
4885+
"trying to dereference an invalid iterator");
4886+
IntegerLiteral *N = EExpr->FakeChildNode;
4887+
StringRef DataRef = EExpr->Data->BinaryData->getBytes();
4888+
N->setValue(*EExpr->Ctx,
4889+
llvm::APInt(N->getValue().getBitWidth(), DataRef[CurOffset],
4890+
N->getType()->isSignedIntegerType()));
4891+
// We want to return a reference to the fake child node in the
4892+
// EmbedExpr, not the local variable N.
4893+
return const_cast<typename BaseTy::reference>(EExpr->FakeChildNode);
4894+
}
4895+
typename BaseTy::pointer operator->() const { return **this; }
4896+
using BaseTy::operator++;
4897+
ChildElementIter &operator++() {
4898+
assert(EExpr && "trying to increment an invalid iterator");
4899+
assert(CurOffset != ULLONG_MAX &&
4900+
"Already at the end of what we can iterate over");
4901+
if (++CurOffset >=
4902+
EExpr->getDataElementCount() + EExpr->getStartingElementPos()) {
4903+
CurOffset = ULLONG_MAX;
4904+
EExpr = nullptr;
4905+
}
4906+
return *this;
4907+
}
4908+
bool operator==(ChildElementIter Other) const {
4909+
return (EExpr == Other.EExpr && CurOffset == Other.CurOffset);
4910+
}
4911+
}; // class ChildElementIter
4912+
4913+
public:
4914+
using fake_child_range = llvm::iterator_range<ChildElementIter<false>>;
4915+
using const_fake_child_range = llvm::iterator_range<ChildElementIter<true>>;
4916+
4917+
fake_child_range underlying_data_elements() {
4918+
return fake_child_range(ChildElementIter<false>(this),
4919+
ChildElementIter<false>());
4920+
}
4921+
4922+
const_fake_child_range underlying_data_elements() const {
4923+
return const_fake_child_range(
4924+
ChildElementIter<true>(const_cast<EmbedExpr *>(this)),
4925+
ChildElementIter<true>());
4926+
}
4927+
4928+
child_range children() {
4929+
return child_range(child_iterator(), child_iterator());
4930+
}
4931+
4932+
const_child_range children() const {
4933+
return const_child_range(const_child_iterator(), const_child_iterator());
4934+
}
4935+
4936+
static bool classof(const Stmt *T) {
4937+
return T->getStmtClass() == EmbedExprClass;
4938+
}
4939+
4940+
ChildElementIter<false> begin() { return ChildElementIter<false>(this); }
4941+
4942+
ChildElementIter<true> begin() const {
4943+
return ChildElementIter<true>(const_cast<EmbedExpr *>(this));
4944+
}
4945+
4946+
template <typename Call, typename... Targs>
4947+
bool doForEachDataElement(Call &&C, unsigned &StartingIndexInArray,
4948+
Targs &&...Fargs) const {
4949+
for (auto It : underlying_data_elements()) {
4950+
if (!std::invoke(std::forward<Call>(C), const_cast<IntegerLiteral *>(It),
4951+
StartingIndexInArray, std::forward<Targs>(Fargs)...))
4952+
return false;
4953+
StartingIndexInArray++;
4954+
}
4955+
return true;
4956+
}
4957+
4958+
private:
4959+
friend class ASTStmtReader;
4960+
};
4961+
48024962
/// Describes an C or C++ initializer list.
48034963
///
48044964
/// InitListExpr describes an initializer list, which can be used to

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,6 +2864,11 @@ DEF_TRAVERSE_STMT(ShuffleVectorExpr, {})
28642864
DEF_TRAVERSE_STMT(ConvertVectorExpr, {})
28652865
DEF_TRAVERSE_STMT(StmtExpr, {})
28662866
DEF_TRAVERSE_STMT(SourceLocExpr, {})
2867+
DEF_TRAVERSE_STMT(EmbedExpr, {
2868+
for (IntegerLiteral *IL : S->underlying_data_elements()) {
2869+
TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(IL);
2870+
}
2871+
})
28672872

28682873
DEF_TRAVERSE_STMT(UnresolvedLookupExpr, {
28692874
TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ class TextNodeDumper
409409
void VisitHLSLBufferDecl(const HLSLBufferDecl *D);
410410
void VisitOpenACCConstructStmt(const OpenACCConstructStmt *S);
411411
void VisitOpenACCLoopConstruct(const OpenACCLoopConstruct *S);
412+
void VisitEmbedExpr(const EmbedExpr *S);
412413
};
413414

414415
} // namespace clang

clang/include/clang/Basic/BuiltinsWebAssembly.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ TARGET_BUILTIN(__builtin_wasm_relaxed_madd_f32x4, "V4fV4fV4fV4f", "nc", "relaxed
170170
TARGET_BUILTIN(__builtin_wasm_relaxed_nmadd_f32x4, "V4fV4fV4fV4f", "nc", "relaxed-simd")
171171
TARGET_BUILTIN(__builtin_wasm_relaxed_madd_f64x2, "V2dV2dV2dV2d", "nc", "relaxed-simd")
172172
TARGET_BUILTIN(__builtin_wasm_relaxed_nmadd_f64x2, "V2dV2dV2dV2d", "nc", "relaxed-simd")
173+
TARGET_BUILTIN(__builtin_wasm_relaxed_madd_f16x8, "V8hV8hV8hV8h", "nc", "half-precision")
174+
TARGET_BUILTIN(__builtin_wasm_relaxed_nmadd_f16x8, "V8hV8hV8hV8h", "nc", "half-precision")
173175

174176
TARGET_BUILTIN(__builtin_wasm_relaxed_laneselect_i8x16, "V16ScV16ScV16ScV16Sc", "nc", "relaxed-simd")
175177
TARGET_BUILTIN(__builtin_wasm_relaxed_laneselect_i16x8, "V8sV8sV8sV8s", "nc", "relaxed-simd")

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ def err_too_large_for_fixed_point : Error<
275275
def err_unimplemented_conversion_with_fixed_point_type : Error<
276276
"conversion between fixed point and %0 is not yet supported">;
277277

278+
def err_requires_positive_value : Error<
279+
"%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
280+
278281
// SEH
279282
def err_seh_expected_handler : Error<
280283
"expected '__except' or '__finally' block">;

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,4 +826,7 @@ def warn_android_unversioned_fallback : Warning<
826826

827827
def err_drv_triple_version_invalid : Error<
828828
"version '%0' in target triple '%1' is invalid">;
829+
830+
def warn_missing_include_dirs : Warning<
831+
"no such include directory: '%0'">, InGroup<MissingIncludeDirs>, DefaultIgnore;
829832
}

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def MaxUnsignedZero : DiagGroup<"max-unsigned-zero">;
506506
def MissingBraces : DiagGroup<"missing-braces">;
507507
def MissingDeclarations: DiagGroup<"missing-declarations">;
508508
def : DiagGroup<"missing-format-attribute">;
509-
def : DiagGroup<"missing-include-dirs">;
509+
def MissingIncludeDirs : DiagGroup<"missing-include-dirs">;
510510
def MissingNoreturn : DiagGroup<"missing-noreturn">;
511511
def MultiChar : DiagGroup<"multichar">;
512512
def : DiagGroup<"nested-externs">;

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,14 @@ def warn_cxx23_compat_warning_directive : Warning<
436436
def warn_c23_compat_warning_directive : Warning<
437437
"#warning is incompatible with C standards before C23">,
438438
InGroup<CPre23Compat>, DefaultIgnore;
439+
def ext_pp_embed_directive : ExtWarn<
440+
"#embed is a %select{C23|Clang}0 extension">,
441+
InGroup<C23>;
442+
def warn_compat_pp_embed_directive : Warning<
443+
"#embed is incompatible with C standards before C23">,
444+
InGroup<CPre23Compat>, DefaultIgnore;
445+
def err_pp_embed_dup_params : Error<
446+
"cannot specify parameter '%0' twice in the same '#embed' directive">;
439447

440448
def ext_pp_extra_tokens_at_eol : ExtWarn<
441449
"extra tokens at end of #%0 directive">, InGroup<ExtraTokens>;
@@ -505,6 +513,8 @@ def err_pp_invalid_directive : Error<
505513
"invalid preprocessing directive%select{|, did you mean '#%1'?}0">;
506514
def warn_pp_invalid_directive : Warning<
507515
err_pp_invalid_directive.Summary>, InGroup<DiagGroup<"unknown-directives">>;
516+
def err_pp_unknown_parameter : Error<
517+
"unknown%select{ | embed}0 preprocessor parameter '%1'">;
508518
def err_pp_directive_required : Error<
509519
"%0 must be used within a preprocessing directive">;
510520
def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
@@ -719,6 +729,8 @@ def err_pp_module_build_missing_end : Error<
719729
"no matching '#pragma clang module endbuild' for this '#pragma clang module build'">;
720730

721731
def err_defined_macro_name : Error<"'defined' cannot be used as a macro name">;
732+
def err_defined_in_pp_embed : Error<
733+
"'defined' cannot appear within this context">;
722734
def err_paste_at_start : Error<
723735
"'##' cannot appear at start of macro expansion">;
724736
def err_paste_at_end : Error<"'##' cannot appear at end of macro expansion">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,6 @@ def note_surrounding_namespace_starts_here : Note<
10971097
"surrounding namespace with visibility attribute starts here">;
10981098
def err_pragma_loop_invalid_argument_type : Error<
10991099
"invalid argument of type %0; expected an integer type">;
1100-
def err_pragma_loop_invalid_argument_value : Error<
1101-
"%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
11021100
def err_pragma_loop_compatibility : Error<
11031101
"%select{incompatible|duplicate}0 directives '%1' and '%2'">;
11041102
def err_pragma_loop_precedes_nonloop : Error<

clang/include/clang/Basic/FileManager.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,15 @@ class FileManager : public RefCountedBase<FileManager> {
286286
/// MemoryBuffer if successful, otherwise returning null.
287287
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
288288
getBufferForFile(FileEntryRef Entry, bool isVolatile = false,
289-
bool RequiresNullTerminator = true);
289+
bool RequiresNullTerminator = true,
290+
std::optional<int64_t> MaybeLimit = std::nullopt);
290291
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
291292
getBufferForFile(StringRef Filename, bool isVolatile = false,
292-
bool RequiresNullTerminator = true) const {
293-
return getBufferForFileImpl(Filename, /*FileSize=*/-1, isVolatile,
294-
RequiresNullTerminator);
293+
bool RequiresNullTerminator = true,
294+
std::optional<int64_t> MaybeLimit = std::nullopt) const {
295+
return getBufferForFileImpl(Filename,
296+
/*FileSize=*/(MaybeLimit ? *MaybeLimit : -1),
297+
isVolatile, RequiresNullTerminator);
295298
}
296299

297300
private:

clang/include/clang/Basic/StmtNodes.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def OpaqueValueExpr : StmtNode<Expr>;
204204
def TypoExpr : StmtNode<Expr>;
205205
def RecoveryExpr : StmtNode<Expr>;
206206
def BuiltinBitCastExpr : StmtNode<ExplicitCastExpr>;
207+
def EmbedExpr : StmtNode<Expr>;
207208

208209
// Microsoft Extensions.
209210
def MSPropertyRefExpr : StmtNode<Expr>;

0 commit comments

Comments
 (0)