Skip to content

Commit e9a3a0f

Browse files
authored
Merge branch 'main' into p/libc-hdrgen-yaml-template
2 parents ca019f7 + bf274b3 commit e9a3a0f

File tree

332 files changed

+18233
-6442
lines changed

Some content is hidden

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

332 files changed

+18233
-6442
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6843,6 +6843,45 @@ the configuration (without a prefix: ``Auto``).
68436843
68446844
For example: BOOST_PP_STRINGIZE
68456845

6846+
.. _WrapNamespaceBodyWithEmptyLines:
6847+
6848+
**WrapNamespaceBodyWithEmptyLines** (``WrapNamespaceBodyWithEmptyLinesStyle``) :versionbadge:`clang-format 20` :ref:`<WrapNamespaceBodyWithEmptyLines>`
6849+
Wrap namespace body with empty lines.
6850+
6851+
Possible values:
6852+
6853+
* ``WNBWELS_Never`` (in configuration: ``Never``)
6854+
Remove all empty lines at the beginning and the end of namespace body.
6855+
6856+
.. code-block:: c++
6857+
6858+
namespace N1 {
6859+
namespace N2
6860+
function();
6861+
}
6862+
}
6863+
6864+
* ``WNBWELS_Always`` (in configuration: ``Always``)
6865+
Always have at least one empty line at the beginning and the end of
6866+
namespace body except that the number of empty lines between consecutive
6867+
nested namespace definitions is not increased.
6868+
6869+
.. code-block:: c++
6870+
6871+
namespace N1 {
6872+
namespace N2 {
6873+
6874+
function();
6875+
6876+
}
6877+
}
6878+
6879+
* ``WNBWELS_Leave`` (in configuration: ``Leave``)
6880+
Keep existing newlines at the beginning and the end of namespace body.
6881+
``MaxEmptyLinesToKeep`` still applies.
6882+
6883+
6884+
68466885
.. END_FORMAT_STYLE_OPTIONS
68476886
68486887
Adding additional style options

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3641,7 +3641,7 @@ program location should be executed. It is expected to be used to implement
36413641
<https://llvm.org/docs/LangRef.html#llvm-allow-runtime-check-intrinsic>`_
36423642
intrinsic.
36433643
3644-
The ``__builtin_allow_runtime_check()`` can be used within constrol structures
3644+
The ``__builtin_allow_runtime_check()`` can be used within control structures
36453645
like ``if`` to guard expensive runtime checks. The return value is determined
36463646
by the following compiler options and may differ per call site:
36473647

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ Bug Fixes to C++ Support
886886
out of a module (which is the case e.g. in MSVC's implementation of ``std`` module). (#GH118218)
887887
- Fixed a pack expansion issue in checking unexpanded parameter sizes. (#GH17042)
888888
- Fixed a bug where captured structured bindings were modifiable inside non-mutable lambda (#GH95081)
889+
- Clang now identifies unexpanded parameter packs within the type constraint on a non-type template parameter. (#GH88866)
889890
- Fixed an issue while resolving type of expression indexing into a pack of values of non-dependent type (#GH121242)
890891

891892
Bug Fixes to AST Handling
@@ -1127,6 +1128,7 @@ clang-format
11271128
- Adds ``AllowShortNamespacesOnASingleLine`` option.
11281129
- Adds ``VariableTemplates`` option.
11291130
- Adds support for bash globstar in ``.clang-format-ignore``.
1131+
- Adds ``WrapNamespaceBodyWithEmptyLines`` option.
11301132

11311133
libclang
11321134
--------

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
186186
std::string ProfileExcludeFiles;
187187

188188
/// The version string to put into coverage files.
189-
char CoverageVersion[4];
189+
char CoverageVersion[4] = {'0', '0', '0', '0'};
190190

191191
/// Enable additional debugging information.
192192
std::string DebugPass;

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ defm pseudo_probe_for_profiling : BoolFOption<"pseudo-probe-for-profiling",
18901890
" pseudo probes for sample profiling">>;
18911891
def forder_file_instrumentation : Flag<["-"], "forder-file-instrumentation">,
18921892
Group<f_Group>, Visibility<[ClangOption, CC1Option, CLOption]>,
1893-
HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;
1893+
HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var). Deprecated, please use temporal profiling.">;
18941894
def fprofile_list_EQ : Joined<["-"], "fprofile-list=">,
18951895
Group<f_Group>, Visibility<[ClangOption, CC1Option, CLOption]>,
18961896
HelpText<"Filename defining the list of functions/files to instrument. "

clang/include/clang/Format/Format.h

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5143,6 +5143,39 @@ struct FormatStyle {
51435143
/// \version 11
51445144
std::vector<std::string> WhitespaceSensitiveMacros;
51455145

5146+
/// Different styles for wrapping namespace body with empty lines.
5147+
enum WrapNamespaceBodyWithEmptyLinesStyle : int8_t {
5148+
/// Remove all empty lines at the beginning and the end of namespace body.
5149+
/// \code
5150+
/// namespace N1 {
5151+
/// namespace N2
5152+
/// function();
5153+
/// }
5154+
/// }
5155+
/// \endcode
5156+
WNBWELS_Never,
5157+
/// Always have at least one empty line at the beginning and the end of
5158+
/// namespace body except that the number of empty lines between consecutive
5159+
/// nested namespace definitions is not increased.
5160+
/// \code
5161+
/// namespace N1 {
5162+
/// namespace N2 {
5163+
///
5164+
/// function();
5165+
///
5166+
/// }
5167+
/// }
5168+
/// \endcode
5169+
WNBWELS_Always,
5170+
/// Keep existing newlines at the beginning and the end of namespace body.
5171+
/// ``MaxEmptyLinesToKeep`` still applies.
5172+
WNBWELS_Leave
5173+
};
5174+
5175+
/// Wrap namespace body with empty lines.
5176+
/// \version 20
5177+
WrapNamespaceBodyWithEmptyLinesStyle WrapNamespaceBodyWithEmptyLines;
5178+
51465179
bool operator==(const FormatStyle &R) const {
51475180
return AccessModifierOffset == R.AccessModifierOffset &&
51485181
AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
@@ -5326,7 +5359,8 @@ struct FormatStyle {
53265359
UseTab == R.UseTab && VariableTemplates == R.VariableTemplates &&
53275360
VerilogBreakBetweenInstancePorts ==
53285361
R.VerilogBreakBetweenInstancePorts &&
5329-
WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros;
5362+
WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros &&
5363+
WrapNamespaceBodyWithEmptyLines == R.WrapNamespaceBodyWithEmptyLines;
53305364
}
53315365

53325366
std::optional<FormatStyle> GetLanguageStyle(LanguageKind Language) const;

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -997,13 +997,15 @@ class CXX20ModulesGenerator : public PCHGenerator {
997997
virtual Module *getEmittingModule(ASTContext &Ctx) override;
998998

999999
CXX20ModulesGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1000-
StringRef OutputFile, bool GeneratingReducedBMI);
1000+
StringRef OutputFile, bool GeneratingReducedBMI,
1001+
bool AllowASTWithErrors);
10011002

10021003
public:
10031004
CXX20ModulesGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1004-
StringRef OutputFile)
1005+
StringRef OutputFile, bool AllowASTWithErrors = false)
10051006
: CXX20ModulesGenerator(PP, ModuleCache, OutputFile,
1006-
/*GeneratingReducedBMI=*/false) {}
1007+
/*GeneratingReducedBMI=*/false,
1008+
AllowASTWithErrors) {}
10071009

10081010
void HandleTranslationUnit(ASTContext &Ctx) override;
10091011
};
@@ -1013,9 +1015,10 @@ class ReducedBMIGenerator : public CXX20ModulesGenerator {
10131015

10141016
public:
10151017
ReducedBMIGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1016-
StringRef OutputFile)
1018+
StringRef OutputFile, bool AllowASTWithErrors = false)
10171019
: CXX20ModulesGenerator(PP, ModuleCache, OutputFile,
1018-
/*GeneratingReducedBMI=*/true) {}
1020+
/*GeneratingReducedBMI=*/true,
1021+
AllowASTWithErrors) {}
10191022
};
10201023

10211024
/// If we can elide the definition of \param D in reduced BMI.

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6376,7 +6376,7 @@ ASTContext::getAutoType(QualType DeducedType, AutoTypeKeyword Keyword,
63766376
}
63776377

63786378
QualType ASTContext::getUnconstrainedType(QualType T) const {
6379-
QualType CanonT = T.getCanonicalType();
6379+
QualType CanonT = T.getNonPackExpansionType().getCanonicalType();
63806380

63816381
// Remove a type-constraint from a top-level auto or decltype(auto).
63826382
if (auto *AT = CanonT->getAs<AutoType>()) {

clang/lib/Basic/CodeGenOptions.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ CodeGenOptions::CodeGenOptions() {
1717
#include "clang/Basic/CodeGenOptions.def"
1818

1919
RelocationModel = llvm::Reloc::PIC_;
20-
memcpy(CoverageVersion, "408*", 4);
2120
}
2221

2322
void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
@@ -54,7 +53,6 @@ void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
5453
}
5554

5655
RelocationModel = llvm::Reloc::PIC_;
57-
memcpy(CoverageVersion, "408*", 4);
5856
}
5957

6058
} // end namespace clang

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8010,15 +8010,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
80108010
}
80118011
}
80128012

8013-
if (Args.hasArg(options::OPT_forder_file_instrumentation)) {
8014-
CmdArgs.push_back("-forder-file-instrumentation");
8015-
// Enable order file instrumentation when ThinLTO is not on. When ThinLTO is
8016-
// on, we need to pass these flags as linker flags and that will be handled
8017-
// outside of the compiler.
8018-
if (!IsUsingLTO) {
8019-
CmdArgs.push_back("-mllvm");
8020-
CmdArgs.push_back("-enable-order-file-instrumentation");
8021-
}
8013+
if (const Arg *A =
8014+
Args.getLastArg(options::OPT_forder_file_instrumentation)) {
8015+
D.Diag(diag::warn_drv_deprecated_arg)
8016+
<< A->getAsString(Args) << /*hasReplacement=*/true
8017+
<< "-mllvm -pgo-temporal-instrumentation";
8018+
CmdArgs.push_back("-forder-file-instrumentation");
8019+
// Enable order file instrumentation when ThinLTO is not on. When ThinLTO is
8020+
// on, we need to pass these flags as linker flags and that will be handled
8021+
// outside of the compiler.
8022+
if (!IsUsingLTO) {
8023+
CmdArgs.push_back("-mllvm");
8024+
CmdArgs.push_back("-enable-order-file-instrumentation");
8025+
}
80228026
}
80238027

80248028
if (Arg *A = Args.getLastArg(options::OPT_fforce_enable_int128,

0 commit comments

Comments
 (0)