Skip to content

Commit

Permalink
[NFC] Correct C++ standard names (#81421)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny authored Feb 11, 2024
1 parent b45de48 commit 00e80fb
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(
{"wctype.h", "cwctype"}})) {
CStyledHeaderToCxx.insert(KeyValue);
}
// Add C++ 11 headers.
// Add C++11 headers.
if (LangOpts.CPlusPlus11) {
for (const auto &KeyValue :
std::vector<std::pair<llvm::StringRef, std::string>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ modernize-deprecated-headers
============================

Some headers from C library were deprecated in C++ and are no longer welcome in
C++ codebases. Some have no effect in C++. For more details refer to the C++ 14
C++ codebases. Some have no effect in C++. For more details refer to the C++14
Standard [depr.c.headers] section.

This check replaces C standard library headers with their C++ alternatives and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ removes ``virtual`` from those functions as it is not required.
user that a function was virtual. C++ compilers did not use the presence of
this to signify an overridden function.

In C++ 11 ``override`` and ``final`` keywords were introduced to allow
In C++11 ``override`` and ``final`` keywords were introduced to allow
overridden functions to be marked appropriately. Their presence allows
compilers to verify that an overridden function correctly overrides a base
class implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
readability-container-contains
==============================

Finds usages of ``container.count()`` and ``container.find() == container.end()`` which should be replaced by a call to the ``container.contains()`` method introduced in C++ 20.
Finds usages of ``container.count()`` and ``container.find() == container.end()`` which should be replaced by a call to the ``container.contains()`` method introduced in C++20.

Whether an element is contained inside a container should be checked with ``contains`` instead of ``count``/``find`` because ``contains`` conveys the intent more clearly. Furthermore, for containers which permit multiple entries per key (``multimap``, ``multiset``, ...), ``contains`` is more efficient than ``count`` because ``count`` has to do unnecessary additional work.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ readability-use-anyofallof
==========================

Finds range-based for loops that can be replaced by a call to ``std::any_of`` or
``std::all_of``. In C++ 20 mode, suggests ``std::ranges::any_of`` or
``std::all_of``. In C++20 mode, suggests ``std::ranges::any_of`` or
``std::ranges::all_of``.

Example:
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/Basic/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class alignas(8) Module {
/// of header files.
ModuleMapModule,

/// This is a C++ 20 header unit.
/// This is a C++20 header unit.
ModuleHeaderUnit,

/// This is a C++20 module interface unit.
Expand All @@ -127,10 +127,10 @@ class alignas(8) Module {
/// This is a C++20 module implementation unit.
ModuleImplementationUnit,

/// This is a C++ 20 module partition interface.
/// This is a C++20 module partition interface.
ModulePartitionInterface,

/// This is a C++ 20 module partition implementation.
/// This is a C++20 module partition implementation.
ModulePartitionImplementation,

/// This is the explicit Global Module Fragment of a modular TU.
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Basic/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Module *Module::findOrInferSubmodule(StringRef Name) {

Module *Module::getGlobalModuleFragment() const {
assert(isNamedModuleUnit() && "We should only query the global module "
"fragment from the C++ 20 Named modules");
"fragment from the C++20 Named modules");

for (auto *SubModule : SubModules)
if (SubModule->isExplicitGlobalModule())
Expand All @@ -387,7 +387,7 @@ Module *Module::getGlobalModuleFragment() const {

Module *Module::getPrivateModuleFragment() const {
assert(isNamedModuleUnit() && "We should only query the private module "
"fragment from the C++ 20 Named modules");
"fragment from the C++20 Named modules");

for (auto *SubModule : SubModules)
if (SubModule->isPrivateModule())
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Headers/stdatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Exclude the MSVC path as well as the MSVC header as of the 14.31.30818
* explicitly disallows `stdatomic.h` in the C mode via an `#error`. Fallback
* to the clang resource header until that is fully supported. The
* `stdatomic.h` header requires C++ 23 or newer.
* `stdatomic.h` header requires C++23 or newer.
*/
#if __STDC_HOSTED__ && \
__has_include_next(<stdatomic.h>) && \
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/DependencyDirectivesScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static void skipBlockComment(const char *&First, const char *const End) {
}
}

/// \returns True if the current single quotation mark character is a C++ 14
/// \returns True if the current single quotation mark character is a C++14
/// digit separator.
static bool isQuoteCppDigitSeparator(const char *const Start,
const char *const Cur,
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/bitwise-shift-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ int expression_tracked_back(void) {
//===----------------------------------------------------------------------===//

int allow_overflows_and_negative_operands(void) {
// These are all legal under C++ 20 and many compilers accept them under
// These are all legal under C++20 and many compilers accept them under
// earlier standards as well.
int int_min = 1 << 31; // no-warning
int this_overflows = 1027 << 30; // no-warning
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,7 @@ TEST(TransferTest, TemporaryObject) {

TEST(TransferTest, ElidableConstructor) {
// This test is effectively the same as TransferTest.TemporaryObject, but
// the code is compiled as C++ 14.
// the code is compiled as C++14.
std::string Code = R"(
struct A {
int Bar;
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/Lex/DependencyDirectivesScannerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ TEST(MinimizeSourceToDependencyDirectivesTest, UnderscorePragma) {
R"(_Pragma(u"clang module import"))", Out));
EXPECT_STREQ("<TokBeforeEOF>\n", Out.data());

// FIXME: R"()" strings depend on using C++ 11 language mode
// FIXME: R"()" strings depend on using C++11 language mode
ASSERT_FALSE(minimizeSourceToDependencyDirectives(
R"(_Pragma(R"abc(clang module import)abc"))", Out));
EXPECT_STREQ("<TokBeforeEOF>\n", Out.data());
Expand Down
10 changes: 5 additions & 5 deletions libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Status
=================================================== =================
Macro Name Value
=================================================== =================
**C++ 14**
**C++14**
---------------------------------------------------------------------
``__cpp_lib_chrono_udls`` ``201304L``
--------------------------------------------------- -----------------
Expand Down Expand Up @@ -66,7 +66,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_tuples_by_type`` ``201304L``
--------------------------------------------------- -----------------
**C++ 17**
**C++17**
---------------------------------------------------------------------
``__cpp_lib_addressof_constexpr`` ``201603L``
--------------------------------------------------- -----------------
Expand Down Expand Up @@ -166,7 +166,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_void_t`` ``201411L``
--------------------------------------------------- -----------------
**C++ 20**
**C++20**
---------------------------------------------------------------------
``__cpp_lib_array_constexpr`` ``201811L``
--------------------------------------------------- -----------------
Expand Down Expand Up @@ -300,7 +300,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_unwrap_ref`` ``201811L``
--------------------------------------------------- -----------------
**C++ 23**
**C++23**
---------------------------------------------------------------------
``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
--------------------------------------------------- -----------------
Expand Down Expand Up @@ -388,7 +388,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_unreachable`` ``202202L``
--------------------------------------------------- -----------------
**C++ 26**
**C++26**
---------------------------------------------------------------------
``__cpp_lib_associative_heterogeneous_insertion`` *unimplemented*
--------------------------------------------------- -----------------
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__locale_dir/locale_base_api/ibm.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ inline _LIBCPP_HIDE_FROM_ABI int vasprintf(char** strp, const char* fmt, va_list
}

va_list ap_copy;
// va_copy may not be provided by the C library in C++ 03 mode.
// va_copy may not be provided by the C library in C++03 mode.
#if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy)
__builtin_va_copy(ap_copy, ap);
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//
// If the library was built in c++23 mode, this test would succeed.
//
// Older CMake passed -std:c++latest to set C++ 20 mode on clang-cl, which
// Older CMake passed -std:c++latest to set C++20 mode on clang-cl, which
// hid this issue. With newer CMake versions, it passes -std:c++20 which
// makes this fail.
//
Expand Down
2 changes: 1 addition & 1 deletion libcxx/utils/generate_feature_test_macro_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ def pad_cell(s, length, left_align=True):
def get_status_table():
table = [["Macro Name", "Value"]]
for std in get_std_dialects():
table += [["**" + std.replace("c++", "C++ ") + "**", ""]]
table += [["**" + std.replace("c++", "C++") + "**", ""]]
for tc in feature_test_macros:
if std not in tc["values"].keys():
continue
Expand Down
2 changes: 1 addition & 1 deletion llvm/docs/CMake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ manual, or execute ``cmake --help-variable VARIABLE_NAME``.

**CMAKE_CXX_STANDARD**:STRING
Sets the C++ standard to conform to when building LLVM. Possible values are
17 and 20. LLVM Requires C++ 17 or higher. This defaults to 17.
17 and 20. LLVM Requires C++17 or higher. This defaults to 17.

**CMAKE_INSTALL_BINDIR**:PATH
The path to install executables, relative to the *CMAKE_INSTALL_PREFIX*.
Expand Down

0 comments on commit 00e80fb

Please sign in to comment.