Skip to content

Commit 8e80b80

Browse files
Merge branch 'llvm:main' into gh-101657
2 parents c826a08 + d31fb26 commit 8e80b80

File tree

104 files changed

+921
-533
lines changed

Some content is hidden

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

104 files changed

+921
-533
lines changed

clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,13 @@ sizeof...($TemplateParameter[[Elements]]);
10921092
$Field_dependentName[[waldo]];
10931093
}
10941094
};
1095+
)cpp",
1096+
// Pointer-to-member with nested-name-specifiers
1097+
R"cpp(
1098+
struct $Class_def[[Outer]] {
1099+
struct $Class_def[[Inner]] {};
1100+
};
1101+
using $Typedef_decl[[Alias]] = void ($Class[[Outer]]::$Class[[Inner]]:: *)();
10951102
)cpp"};
10961103
for (const auto &TestCase : TestCases)
10971104
// Mask off scope modifiers to keep the tests manageable.

clang-tools-extra/test/clang-tidy/checkers/misc/redundant-expression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %check_clang_tidy %s misc-redundant-expression %t -- -- -fno-delayed-template-parsing
1+
// RUN: %check_clang_tidy %s misc-redundant-expression %t -- -- -fno-delayed-template-parsing -Wno-array-compare-cxx26
22

33
typedef __INT64_TYPE__ I64;
44

clang/docs/RealtimeSanitizer.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ A **partial** list of flags RealtimeSanitizer respects:
187187
* - ``abort_on_error``
188188
- OS dependent
189189
- boolean
190-
- If true, the tool calls abort() instead of _exit() after printing the error report. On some OSes (OSX, for exmple) this is beneficial because a better stack trace is emitted on crash.
190+
- If true, the tool calls ``abort()`` instead of ``_exit()`` after printing the error report. On some OSes (MacOS, for exmple) this is beneficial because a better stack trace is emitted on crash.
191191
* - ``symbolize``
192192
- ``true``
193193
- boolean
194194
- If set, use the symbolizer to turn virtual addresses to file/line locations. If false, can greatly speed up the error reporting.
195195
* - ``suppressions``
196-
- ""
196+
- ``""``
197197
- path
198-
- If set to a valid suppressions file, will suppress issue reporting. See details in "Disabling", below.
198+
- If set to a valid suppressions file, will suppress issue reporting. See details in `Disabling and Suppressing`_.
199199

200200

201201
Some issues with flags can be debugged using the ``verbosity=$NUM`` flag:
@@ -244,6 +244,7 @@ To register a callback which will be invoked before a RTSan kills the process:
244244
...
245245
}
246246
247+
.. _disabling-and-suppressing:
247248

248249
Disabling and suppressing
249250
-------------------------

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ New Compiler Flags
428428
- The ``-Warray-compare`` warning has been added to warn about array comparison
429429
on versions older than C++20.
430430

431+
- The ``-Warray-compare-cxx26`` warning has been added to warn about array comparison
432+
starting from C++26, this warning is enabled as an error by default.
433+
431434
Deprecated Compiler Flags
432435
-------------------------
433436

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10274,6 +10274,11 @@ def warn_array_comparison : Warning<
1027410274
"to compare array addresses, use unary '+' to decay operands to pointers">,
1027510275
InGroup<DiagGroup<"array-compare">>;
1027610276

10277+
def warn_array_comparison_cxx26 : Warning<
10278+
"comparison between two arrays is ill-formed in C++26; "
10279+
"to compare array addresses, use unary '+' to decay operands to pointers">,
10280+
InGroup<DiagGroup<"array-compare-cxx26">>, DefaultError;
10281+
1027710282
def warn_stringcompare : Warning<
1027810283
"result of comparison against %select{a string literal|@encode}0 is "
1027910284
"unspecified (use an explicit string comparison function instead)">,

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,13 +789,12 @@ static void addSanitizers(const Triple &TargetTriple,
789789
}
790790

791791
if (LowerAllowCheckPass::IsRequested()) {
792-
// We can optimize after inliner, and PGO profile matching. The hook below
793-
// is called at the end `buildFunctionSimplificationPipeline`, which called
794-
// from `buildInlinerPipeline`, which called after profile matching.
795-
PB.registerScalarOptimizerLateEPCallback(
796-
[](FunctionPassManager &FPM, OptimizationLevel Level) {
797-
FPM.addPass(LowerAllowCheckPass());
798-
});
792+
// We want to call it after inline, which is about OptimizerEarlyEPCallback.
793+
PB.registerOptimizerEarlyEPCallback([](ModulePassManager &MPM,
794+
OptimizationLevel Level,
795+
ThinOrFullLTOPhase Phase) {
796+
MPM.addPass(createModuleToFunctionPassAdaptor(LowerAllowCheckPass()));
797+
});
799798
}
800799
}
801800

clang/lib/Format/CMakeLists.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,39 @@ foreach(file IN LISTS files)
4848
COMMENT "Checking format of ${file}"
4949
)
5050
list(APPEND check_format_depends check_format_depend_${i})
51-
5251
math(EXPR i ${i}+1)
5352
endforeach()
54-
5553
add_custom_target(clang-format-check-format DEPENDS ${check_format_depends})
5654

57-
set(style_options_depends ${CMAKE_CURRENT_BINARY_DIR}/dummy_output)
5855
set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools)
56+
57+
set(format_style_depend ${CMAKE_CURRENT_BINARY_DIR}/format_style_depend)
58+
set(dump_style dump_format_style.py)
5959
set(style_options_rst ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst)
60-
add_custom_command(OUTPUT ${style_options_depends}
61-
COMMAND ${Python3_EXECUTABLE} dump_format_style.py &&
62-
touch ${style_options_depends}
60+
add_custom_command(OUTPUT ${format_style_depend}
61+
COMMAND ${Python3_EXECUTABLE} ${dump_style} && touch ${format_style_depend}
6362
WORKING_DIRECTORY ${docs_tools_dir}
6463
VERBATIM
6564
COMMENT "Updating ${style_options_rst}"
6665
DEPENDS ${CLANG_SOURCE_DIR}/include/clang/Format/Format.h
6766
${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h
6867
${style_options_rst}
6968
${docs_tools_dir}/plurals.txt
70-
${docs_tools_dir}/dump_format_style.py
69+
${docs_tools_dir}/${dump_style}
7170
)
71+
add_custom_target(clang-format-style DEPENDS ${format_style_depend})
7272

73-
add_custom_target(clang-format-style-options DEPENDS ${style_options_depends})
73+
set(format_help_depend ${CMAKE_CURRENT_BINARY_DIR}/format_help_depend)
74+
set(dump_help dump_format_help.py)
75+
set(clang_format_rst ${CLANG_SOURCE_DIR}/docs/ClangFormat.rst)
76+
add_custom_command(OUTPUT ${format_help_depend}
77+
COMMAND ${Python3_EXECUTABLE} ${dump_help} -d ${CMAKE_BINARY_DIR}/bin &&
78+
touch ${format_help_depend}
79+
WORKING_DIRECTORY ${docs_tools_dir}
80+
VERBATIM
81+
COMMENT "Updating ${clang_format_rst}"
82+
DEPENDS clang-format
83+
${clang_format_rst}
84+
${docs_tools_dir}/${dump_help}
85+
)
86+
add_custom_target(clang-format-help DEPENDS ${format_help_depend})

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3901,6 +3901,11 @@ bool TokenAnnotator::mustBreakForReturnType(const AnnotatedLine &Line) const {
39013901
}
39023902

39033903
void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
3904+
if (Line.Computed)
3905+
return;
3906+
3907+
Line.Computed = true;
3908+
39043909
for (AnnotatedLine *ChildLine : Line.Children)
39053910
calculateFormattingInformation(*ChildLine);
39063911

clang/lib/Format/TokenAnnotator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ class AnnotatedLine {
182182
/// \c True if this line contains a macro call for which an expansion exists.
183183
bool ContainsMacroCall = false;
184184

185+
/// \c True if calculateFormattingInformation() has been called on this line.
186+
bool Computed = false;
187+
185188
/// \c True if this line should be formatted, i.e. intersects directly or
186189
/// indirectly with one of the input ranges.
187190
bool Affected;

clang/lib/Sema/SemaExpr.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11843,7 +11843,9 @@ static void diagnoseTautologicalComparison(Sema &S, SourceLocation Loc,
1184311843
RHSStripped->getType()->isArrayType()) {
1184411844
auto IsDeprArrayComparionIgnored =
1184511845
S.getDiagnostics().isIgnored(diag::warn_depr_array_comparison, Loc);
11846-
auto DiagID = !S.getLangOpts().CPlusPlus20 || IsDeprArrayComparionIgnored
11846+
auto DiagID = S.getLangOpts().CPlusPlus26
11847+
? diag::warn_array_comparison_cxx26
11848+
: !S.getLangOpts().CPlusPlus20 || IsDeprArrayComparionIgnored
1184711849
? diag::warn_array_comparison
1184811850
: diag::warn_depr_array_comparison;
1184911851
S.Diag(Loc, DiagID) << LHS->getSourceRange() << RHS->getSourceRange()

0 commit comments

Comments
 (0)