Skip to content

Commit fe6c781

Browse files
authored
Merge branch 'llvm:main' into int_mma_block_scale
2 parents 83757d5 + 86b89a6 commit fe6c781

File tree

245 files changed

+7908
-4955
lines changed

Some content is hidden

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

245 files changed

+7908
-4955
lines changed

bolt/include/bolt/Passes/PLTCall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PLTCall : public BinaryFunctionPass {
2626
explicit PLTCall(const cl::opt<bool> &PrintPass)
2727
: BinaryFunctionPass(PrintPass) {}
2828

29-
const char *getName() const override { return "PLT call optimization"; }
29+
const char *getName() const override { return "plt-call-optimization"; }
3030
bool shouldPrint(const BinaryFunction &BF) const override {
3131
return BinaryFunctionPass::shouldPrint(BF);
3232
}

bolt/include/bolt/Passes/TailDuplication.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class TailDuplication : public BinaryFunctionPass {
143143

144144
explicit TailDuplication() : BinaryFunctionPass(false) {}
145145

146-
const char *getName() const override { return "tail duplication"; }
146+
const char *getName() const override { return "tail-duplication"; }
147147

148148
Error runOnFunctions(BinaryContext &BC) override;
149149
};

clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@ static unsigned getLength(const Expr *E,
6464
if (!E)
6565
return 0;
6666

67-
Expr::EvalResult Length;
6867
E = E->IgnoreImpCasts();
6968

7069
if (const auto *LengthDRE = dyn_cast<DeclRefExpr>(E))
7170
if (const auto *LengthVD = dyn_cast<VarDecl>(LengthDRE->getDecl()))
7271
if (!isa<ParmVarDecl>(LengthVD))
73-
if (const Expr *LengthInit = LengthVD->getInit())
72+
if (const Expr *LengthInit = LengthVD->getInit();
73+
LengthInit && !LengthInit->isValueDependent()) {
74+
Expr::EvalResult Length;
7475
if (LengthInit->EvaluateAsInt(Length, *Result.Context))
7576
return Length.Val.getInt().getZExtValue();
77+
}
7678

7779
if (const auto *LengthIL = dyn_cast<IntegerLiteral>(E))
7880
return LengthIL->getValue().getZExtValue();

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ Changes in existing checks
274274
<clang-tidy/checks/bugprone/narrowing-conversions>` check by fixing
275275
false positive from analysis of a conditional expression in C.
276276

277+
- Improved :doc:`bugprone-not-null-terminated-result
278+
<clang-tidy/checks/bugprone/not-null-terminated-result>` check by fixing
279+
a crash caused by certain value-dependent expressions.
280+
277281
- Improved :doc:`bugprone-reserved-identifier
278282
<clang-tidy/checks/bugprone/reserved-identifier>` check by ignoring
279283
declarations and macros in system headers.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %check_clang_tidy %s bugprone-not-null-terminated-result %t -- \
2+
// RUN: -- -std=c++17 -I %S/Inputs/not-null-terminated-result
3+
4+
// This test case reproduces the crash when the check tries to evaluate
5+
// a value-dependent expression using EvaluateAsInt() in
6+
// bugprone-not-null-terminated-result, where the src parameter of memcpy is
7+
// value-dependent, but the length is not.
8+
9+
// expected-no-diagnostics
10+
11+
#include "not-null-terminated-result-cxx.h"
12+
13+
template<size_t N>
14+
class ValueDependentClass {
15+
public:
16+
void copyData(char* Dst) {
17+
const char* Src = reinterpret_cast<const char*>(this);
18+
// The length parameter is arbitrary, but the crash is not reproduced if it is N.
19+
memcpy(Dst, Src, 32);
20+
}
21+
};
22+
23+
template class ValueDependentClass<42>; // The template parameter value is arbitrary.

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ New Compiler Flags
276276
- New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
277277
- New option ``-fsanitize-debug-trap-reasons=`` added to control emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
278278
- New options for enabling allocation token instrumentation: ``-fsanitize=alloc-token``, ``-falloc-token-max=``, ``-fsanitize-alloc-token-fast-abi``, ``-fsanitize-alloc-token-extended``.
279-
279+
- The ``-resource-dir`` option is now displayed in the list of options shown by ``--help``.
280280

281281
Lanai Support
282282
^^^^^^^^^^^^^^
@@ -413,6 +413,7 @@ Bug Fixes in This Version
413413
(#GH159080)
414414
- Fixed a failed assertion with empty filename arguments in ``__has_embed``. (#GH159898)
415415
- Fixed a failed assertion with empty filename in ``#embed`` directive. (#GH162951)
416+
- Fixed a crash triggered by unterminated ``__has_embed``. (#GH162953)
416417

417418
Bug Fixes to Compiler Builtins
418419
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -426,7 +427,8 @@ Bug Fixes to Attribute Support
426427
(#GH141504) and on types returned from indirect calls (#GH142453).
427428
- Fixes some late parsed attributes, when applied to function definitions, not being parsed
428429
in function try blocks, and some situations where parsing of the function body
429-
is skipped, such as error recovery and code completion. (#GH153551)
430+
is skipped, such as error recovery, code completion, and msvc-compatible delayed
431+
template parsing. (#GH153551)
430432
- Using ``[[gnu::cleanup(some_func)]]`` where some_func is annotated with
431433
``[[gnu::error("some error")]]`` now correctly triggers an error. (#GH146520)
432434
- Fix a crash when the function name is empty in the `swift_name` attribute. (#GH157075)

clang/docs/UsersManual.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,7 +2325,7 @@ are listed below.
23252325
devirtualization and virtual constant propagation, for classes with
23262326
:doc:`hidden LTO visibility <LTOVisibility>`. Requires ``-flto``.
23272327

2328-
.. option:: -f[no]split-lto-unit
2328+
.. option:: -f[no-]split-lto-unit
23292329

23302330
Controls splitting the :doc:`LTO unit <LTOVisibility>` into regular LTO and
23312331
:doc:`ThinLTO` portions, when compiling with -flto=thin. Defaults to false
@@ -2518,7 +2518,7 @@ are listed below.
25182518

25192519
.. _funique_internal_linkage_names:
25202520

2521-
.. option:: -f[no]-unique-internal-linkage-names
2521+
.. option:: -f[no-]unique-internal-linkage-names
25222522

25232523
Controls whether Clang emits a unique (best-effort) symbol name for internal
25242524
linkage symbols. When this option is set, compiler hashes the main source
@@ -2539,7 +2539,7 @@ are listed below.
25392539
$ cd $P/bar && clang -c -funique-internal-linkage-names name_conflict.c
25402540
$ cd $P && clang foo/name_conflict.o && bar/name_conflict.o
25412541
2542-
.. option:: -f[no]-basic-block-address-map:
2542+
.. option:: -f[no-]basic-block-address-map:
25432543
Emits a ``SHT_LLVM_BB_ADDR_MAP`` section which includes address offsets for each
25442544
basic block in the program, relative to the parent function address.
25452545

clang/include/clang/Basic/LangOptions.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,15 @@ class LangOptions : public LangOptionsBase {
756756
bool isTargetDevice() const {
757757
return OpenMPIsTargetDevice || CUDAIsDevice || SYCLIsDevice;
758758
}
759+
760+
/// Returns the most applicable C standard-compliant language version code.
761+
/// If none could be determined, returns \ref std::nullopt.
762+
std::optional<uint32_t> getCLangStd() const;
763+
764+
/// Returns the most applicable C++ standard-compliant language
765+
/// version code.
766+
/// If none could be determined, returns \ref std::nullopt.
767+
std::optional<uint32_t> getCPlusPlusLangStd() const;
759768
};
760769

761770
/// Floating point control options

clang/include/clang/Basic/LangStandard.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ enum LangFeatures {
7070
/// standard.
7171
struct LangStandard {
7272
enum Kind {
73-
#define LANGSTANDARD(id, name, lang, desc, features) \
74-
lang_##id,
73+
#define LANGSTANDARD(id, name, lang, desc, features, version) lang_##id,
7574
#include "clang/Basic/LangStandards.def"
7675
lang_unspecified
7776
};
@@ -80,6 +79,7 @@ struct LangStandard {
8079
const char *Description;
8180
unsigned Flags;
8281
clang::Language Language;
82+
std::optional<uint32_t> Version;
8383

8484
public:
8585
/// getName - Get the name of this standard.
@@ -91,6 +91,9 @@ struct LangStandard {
9191
/// Get the language that this standard describes.
9292
clang::Language getLanguage() const { return Language; }
9393

94+
/// Get the version code for this language standard.
95+
std::optional<uint32_t> getVersion() const { return Version; }
96+
9497
/// Language supports '//' comments.
9598
bool hasLineComments() const { return Flags & LineComment; }
9699

0 commit comments

Comments
 (0)