Skip to content

Commit 3a76826

Browse files
committed
merge main into amd-staging
Change-Id: Ie99318c221373f7c551826f882ce4f19bdba8f65
2 parents ee7dbf5 + fb79f80 commit 3a76826

File tree

2,172 files changed

+7133
-7508
lines changed

Some content is hidden

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

2,172 files changed

+7133
-7508
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ updates:
88
github-actions:
99
patterns:
1010
- "*"
11+
- package-ecosystem: "pip"
12+
directory: "/llvm/docs"
13+
schedule:
14+
interval: "monthly"
15+
groups:
16+
llvm-docs-requirements:
17+
patterns:
18+
- "*"
1119
- package-ecosystem: "pip" # See documentation for possible values
1220
directory: "/amd/hipcc/docs/sphinx" # Location of package manifests
1321
open-pull-requests-limit: 10

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ concurrency:
3535

3636

3737
env:
38-
CMAKE: "/opt/bin/cmake"
3938
# LLVM POST-BRANCH bump version
4039
# LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
4140
# LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
@@ -169,24 +168,18 @@ jobs:
169168
'bootstrapping-build'
170169
]
171170
machine: [ 'libcxx-runners-8-set' ]
172-
std_modules: [ 'OFF' ]
173171
include:
174172
- config: 'generic-cxx26'
175173
machine: libcxx-runners-8-set
176-
std_modules: 'ON'
177174
- config: 'generic-asan'
178175
machine: libcxx-runners-8-set
179-
std_modules: 'OFF'
180176
- config: 'generic-tsan'
181177
machine: libcxx-runners-8-set
182-
std_modules: 'OFF'
183178
- config: 'generic-ubsan'
184179
machine: libcxx-runners-8-set
185-
std_modules: 'OFF'
186180
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
187181
- config: 'generic-msan'
188182
machine: libcxx-runners-8-set
189-
std_modules: 'OFF'
190183
runs-on: ${{ matrix.machine }}
191184
steps:
192185
- uses: actions/checkout@v4
@@ -196,7 +189,6 @@ jobs:
196189
CC: clang-18
197190
CXX: clang++-18
198191
ENABLE_CLANG_TIDY: "OFF"
199-
ENABLE_STD_MODULES: ${{ matrix.std_modules }}
200192
- uses: actions/upload-artifact@v3
201193
if: always()
202194
with:

clang/docs/CommandGuide/clang.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Language Selection and Mode Options
302302
.. option:: -fmsc-version=
303303

304304
Set ``_MSC_VER``. When on Windows, this defaults to either the same value as
305-
the currently installed version of cl.exe, or ``1920``. Not set otherwise.
305+
the currently installed version of cl.exe, or ``1933``. Not set otherwise.
306306

307307
.. option:: -fborland-extensions
308308

clang/docs/LibASTMatchersTutorial.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ started guide <https://llvm.org/docs/GettingStarted.html>`_.
2222

2323
.. code-block:: console
2424
25-
cd ~/clang-llvm
25+
mkdir ~/clang-llvm && cd ~/clang-llvm
2626
git clone https://github.com/llvm/llvm-project.git
2727
2828
Next you need to obtain the CMake build system and Ninja build tool.
@@ -33,11 +33,11 @@ Next you need to obtain the CMake build system and Ninja build tool.
3333
git clone https://github.com/martine/ninja.git
3434
cd ninja
3535
git checkout release
36-
./bootstrap.py
36+
./configure.py --bootstrap
3737
sudo cp ninja /usr/bin/
3838
3939
cd ~/clang-llvm
40-
git clone git://cmake.org/stage/cmake.git
40+
git clone https://gitlab.kitware.com/cmake/cmake.git
4141
cd cmake
4242
git checkout next
4343
./bootstrap
@@ -50,7 +50,7 @@ Okay. Now we'll build Clang!
5050
5151
cd ~/clang-llvm
5252
mkdir build && cd build
53-
cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_TESTS=ON
53+
cmake -G Ninja ../llvm-project/llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_TESTS=ON
5454
ninja
5555
ninja check # Test LLVM only.
5656
ninja clang-test # Test Clang only.
@@ -65,7 +65,7 @@ Finally, we want to set Clang as its own compiler.
6565
.. code-block:: console
6666
6767
cd ~/clang-llvm/build
68-
ccmake ../llvm
68+
ccmake ../llvm-project/llvm
6969
7070
The second command will bring up a GUI for configuring Clang. You need
7171
to set the entry for ``CMAKE_CXX_COMPILER``. Press ``'t'`` to turn on
@@ -89,7 +89,7 @@ live in the ``clang-tools-extra`` repository.
8989

9090
.. code-block:: console
9191
92-
cd ~/clang-llvm
92+
cd ~/clang-llvm/llvm-project
9393
mkdir clang-tools-extra/loop-convert
9494
echo 'add_subdirectory(loop-convert)' >> clang-tools-extra/CMakeLists.txt
9595
vim clang-tools-extra/loop-convert/CMakeLists.txt
@@ -314,7 +314,7 @@ handiwork:
314314

315315
.. code-block:: console
316316
317-
cd ~/clang-llvm/llvm/llvm_build/
317+
cd ~/clang-llvm/build/
318318
ninja loop-convert
319319
vim ~/test-files/simple-loops.cc
320320
bin/loop-convert ~/test-files/simple-loops.cc

clang/docs/ReleaseNotes.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ C++2c Feature Support
232232
Resolutions to C++ Defect Reports
233233
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
234234

235+
- Implemented `CWG2598 <https://wg21.link/CWG2598>`_ and `CWG2096 <https://wg21.link/CWG2096>`_,
236+
making unions (that have either no members or at least one literal member) literal types.
237+
(`#77924: <https://github.com/llvm/llvm-project/issues/77924>`_).
238+
239+
235240
C Language Changes
236241
------------------
237242
- ``structs``, ``unions``, and ``arrays`` that are const may now be used as
@@ -618,6 +623,9 @@ Improvements to Clang's diagnostics
618623
- Clang now diagnoses unexpanded packs within the template argument lists of function template specializations.
619624
- Clang now diagnoses attempts to bind a bitfield to an NTTP of a reference type as erroneous
620625
converted constant expression and not as a reference to subobject.
626+
- Clang now diagnoses the requirement that non-template friend declarations with requires clauses
627+
and template friend declarations with a constraint that depends on a template parameter from an
628+
enclosing template must be a definition.
621629

622630

623631
Improvements to Clang's time-trace
@@ -975,6 +983,9 @@ Bug Fixes to C++ Support
975983
(`#64607 <https://github.com/llvm/llvm-project/issues/64607>`_)
976984
(`#64086 <https://github.com/llvm/llvm-project/issues/64086>`_)
977985

986+
- Fixed a crash where we lost uninstantiated constraints on placeholder NTTP packs. Fixes:
987+
(`#63837 <https://github.com/llvm/llvm-project/issues/63837>`_)
988+
978989
- Fixed a regression where clang forgets how to substitute into constraints on template-template
979990
parameters. Fixes:
980991
(`#57410 <https://github.com/llvm/llvm-project/issues/57410>`_) and

clang/docs/UsersManual.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4436,11 +4436,11 @@ Execute ``clang-cl /?`` to see a list of supported options:
44364436
-fmerge-all-constants Allow merging of constants
44374437
-fms-compatibility-version=<value>
44384438
Dot-separated value representing the Microsoft compiler version
4439-
number to report in _MSC_VER (0 = don't define it (default))
4439+
number to report in _MSC_VER (0 = don't define it; default is same value as installed cl.exe, or 1933)
44404440
-fms-compatibility Enable full Microsoft Visual C++ compatibility
44414441
-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler
44424442
-fmsc-version=<value> Microsoft compiler version number to report in _MSC_VER
4443-
(0 = don't define it (default))
4443+
(0 = don't define it; default is same value as installed cl.exe, or 1933)
44444444
-fno-addrsig Don't emit an address-significance table
44454445
-fno-builtin-<value> Disable implicit builtin knowledge of a specific function
44464446
-fno-builtin Disable implicit builtin knowledge of functions

clang/include/clang/AST/DeclCXX.h

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,31 +1439,20 @@ class CXXRecordDecl : public RecordDecl {
14391439

14401440
/// Determine whether this class is a literal type.
14411441
///
1442-
/// C++11 [basic.types]p10:
1442+
/// C++20 [basic.types]p10:
14431443
/// A class type that has all the following properties:
1444-
/// - it has a trivial destructor
1445-
/// - every constructor call and full-expression in the
1446-
/// brace-or-equal-intializers for non-static data members (if any) is
1447-
/// a constant expression.
1448-
/// - it is an aggregate type or has at least one constexpr constructor
1449-
/// or constructor template that is not a copy or move constructor, and
1450-
/// - all of its non-static data members and base classes are of literal
1451-
/// types
1452-
///
1453-
/// We resolve DR1361 by ignoring the second bullet. We resolve DR1452 by
1454-
/// treating types with trivial default constructors as literal types.
1455-
///
1456-
/// Only in C++17 and beyond, are lambdas literal types.
1457-
bool isLiteral() const {
1458-
const LangOptions &LangOpts = getLangOpts();
1459-
return (LangOpts.CPlusPlus20 ? hasConstexprDestructor()
1460-
: hasTrivialDestructor()) &&
1461-
(!isLambda() || LangOpts.CPlusPlus17) &&
1462-
!hasNonLiteralTypeFieldsOrBases() &&
1463-
(isAggregate() || isLambda() ||
1464-
hasConstexprNonCopyMoveConstructor() ||
1465-
hasTrivialDefaultConstructor());
1466-
}
1444+
/// - it has a constexpr destructor
1445+
/// - all of its non-static non-variant data members and base classes
1446+
/// are of non-volatile literal types, and it:
1447+
/// - is a closure type
1448+
/// - is an aggregate union type that has either no variant members
1449+
/// or at least one variant member of non-volatile literal type
1450+
/// - is a non-union aggregate type for which each of its anonymous
1451+
/// union members satisfies the above requirements for an aggregate
1452+
/// union type, or
1453+
/// - has at least one constexpr constructor or constructor template
1454+
/// that is not a copy or move constructor.
1455+
bool isLiteral() const;
14671456

14681457
/// Determine whether this is a structural type.
14691458
bool isStructural() const {

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7006,6 +7006,11 @@ def err_member_decl_does_not_match : Error<
70067006
"does not match any declaration in %1">;
70077007
def err_friend_decl_with_def_arg_must_be_def : Error<
70087008
"friend declaration specifying a default argument must be a definition">;
7009+
def err_friend_decl_with_enclosing_temp_constraint_must_be_def : Error<
7010+
"friend declaration with a constraint that depends on an enclosing "
7011+
"template parameter must be a definition">;
7012+
def err_non_temp_friend_decl_with_requires_clause_must_be_def : Error<
7013+
"non-template friend declaration with a requires clause must be a definition">;
70097014
def err_friend_decl_with_def_arg_redeclared : Error<
70107015
"friend declaration specifying a default argument must be the only declaration">;
70117016
def err_friend_decl_does_not_match : Error<

clang/lib/AST/DeclCXX.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,31 @@ void CXXRecordDecl::addedMember(Decl *D) {
13831383
}
13841384
}
13851385

1386+
bool CXXRecordDecl::isLiteral() const {
1387+
const LangOptions &LangOpts = getLangOpts();
1388+
if (!(LangOpts.CPlusPlus20 ? hasConstexprDestructor()
1389+
: hasTrivialDestructor()))
1390+
return false;
1391+
1392+
if (hasNonLiteralTypeFieldsOrBases()) {
1393+
// CWG2598
1394+
// is an aggregate union type that has either no variant
1395+
// members or at least one variant member of non-volatile literal type,
1396+
if (!isUnion())
1397+
return false;
1398+
bool HasAtLeastOneLiteralMember =
1399+
fields().empty() || any_of(fields(), [this](const FieldDecl *D) {
1400+
return !D->getType().isVolatileQualified() &&
1401+
D->getType()->isLiteralType(getASTContext());
1402+
});
1403+
if (!HasAtLeastOneLiteralMember)
1404+
return false;
1405+
}
1406+
1407+
return isAggregate() || (isLambda() && LangOpts.CPlusPlus17) ||
1408+
hasConstexprNonCopyMoveConstructor() || hasTrivialDefaultConstructor();
1409+
}
1410+
13861411
void CXXRecordDecl::addedSelectedDestructor(CXXDestructorDecl *DD) {
13871412
DD->setIneligibleOrNotSelected(false);
13881413
addedEligibleSpecialMemberFunction(DD, SMF_Destructor);

clang/lib/Basic/Targets/RISCV.cpp

Lines changed: 27 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -241,39 +241,6 @@ ArrayRef<Builtin::Info> RISCVTargetInfo::getTargetBuiltins() const {
241241
clang::RISCV::LastTSBuiltin - Builtin::FirstTSBuiltin);
242242
}
243243

244-
static std::vector<std::string>
245-
collectNonISAExtFeature(ArrayRef<std::string> FeaturesNeedOverride, int XLen) {
246-
std::vector<std::string> NonISAExtFeatureVec;
247-
248-
auto IsNonISAExtFeature = [](const std::string &Feature) {
249-
assert(Feature.size() > 1 && (Feature[0] == '+' || Feature[0] == '-'));
250-
StringRef Ext = StringRef(Feature).drop_front(); // drop the +/-
251-
return !llvm::RISCVISAInfo::isSupportedExtensionFeature(Ext);
252-
};
253-
llvm::copy_if(FeaturesNeedOverride, std::back_inserter(NonISAExtFeatureVec),
254-
IsNonISAExtFeature);
255-
256-
return NonISAExtFeatureVec;
257-
}
258-
259-
static std::vector<std::string>
260-
resolveTargetAttrOverride(const std::vector<std::string> &FeaturesVec,
261-
int XLen) {
262-
auto I = llvm::find(FeaturesVec, "__RISCV_TargetAttrNeedOverride");
263-
if (I == FeaturesVec.end())
264-
return FeaturesVec;
265-
266-
ArrayRef<std::string> FeaturesNeedOverride(&*FeaturesVec.begin(), &*I);
267-
std::vector<std::string> NonISAExtFeature =
268-
collectNonISAExtFeature(FeaturesNeedOverride, XLen);
269-
270-
std::vector<std::string> ResolvedFeature(++I, FeaturesVec.end());
271-
ResolvedFeature.insert(ResolvedFeature.end(), NonISAExtFeature.begin(),
272-
NonISAExtFeature.end());
273-
274-
return ResolvedFeature;
275-
}
276-
277244
bool RISCVTargetInfo::initFeatureMap(
278245
llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
279246
const std::vector<std::string> &FeaturesVec) const {
@@ -287,10 +254,27 @@ bool RISCVTargetInfo::initFeatureMap(
287254
Features["32bit"] = true;
288255
}
289256

290-
std::vector<std::string> NewFeaturesVec =
291-
resolveTargetAttrOverride(FeaturesVec, XLen);
257+
// If a target attribute specified a full arch string, override all the ISA
258+
// extension target features.
259+
const auto I = llvm::find(FeaturesVec, "__RISCV_TargetAttrNeedOverride");
260+
if (I != FeaturesVec.end()) {
261+
std::vector<std::string> OverrideFeatures(std::next(I), FeaturesVec.end());
262+
263+
// Add back any non ISA extension features, e.g. +relax.
264+
auto IsNonISAExtFeature = [](StringRef Feature) {
265+
assert(Feature.size() > 1 && (Feature[0] == '+' || Feature[0] == '-'));
266+
StringRef Ext = Feature.substr(1); // drop the +/-
267+
return !llvm::RISCVISAInfo::isSupportedExtensionFeature(Ext);
268+
};
269+
llvm::copy_if(llvm::make_range(FeaturesVec.begin(), I),
270+
std::back_inserter(OverrideFeatures), IsNonISAExtFeature);
292271

293-
auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, NewFeaturesVec);
272+
return TargetInfo::initFeatureMap(Features, Diags, CPU, OverrideFeatures);
273+
}
274+
275+
// Otherwise, parse the features and add any implied extensions.
276+
std::vector<std::string> AllFeatures = FeaturesVec;
277+
auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec);
294278
if (!ParseResult) {
295279
std::string Buffer;
296280
llvm::raw_string_ostream OutputErrMsg(Buffer);
@@ -301,21 +285,9 @@ bool RISCVTargetInfo::initFeatureMap(
301285
return false;
302286
}
303287

304-
// RISCVISAInfo makes implications for ISA features
305-
std::vector<std::string> ImpliedFeatures = (*ParseResult)->toFeatures();
306-
307-
// parseFeatures normalizes the feature set by dropping any explicit
308-
// negatives, and non-extension features. We need to preserve the later
309-
// for correctness and want to preserve the former for consistency.
310-
for (auto &Feature : NewFeaturesVec) {
311-
StringRef ExtName = Feature;
312-
assert(ExtName.size() > 1 && (ExtName[0] == '+' || ExtName[0] == '-'));
313-
ExtName = ExtName.drop_front(1); // Drop '+' or '-'
314-
if (!llvm::is_contained(ImpliedFeatures, ("+" + ExtName).str()) &&
315-
!llvm::is_contained(ImpliedFeatures, ("-" + ExtName).str()))
316-
ImpliedFeatures.push_back(Feature);
317-
}
318-
return TargetInfo::initFeatureMap(Features, Diags, CPU, ImpliedFeatures);
288+
// Append all features, not just new ones, so we override any negatives.
289+
llvm::append_range(AllFeatures, (*ParseResult)->toFeatures());
290+
return TargetInfo::initFeatureMap(Features, Diags, CPU, AllFeatures);
319291
}
320292

321293
std::optional<std::pair<unsigned, unsigned>>
@@ -424,7 +396,10 @@ static void handleFullArchString(StringRef FullArchStr,
424396
// Forward the invalid FullArchStr.
425397
Features.push_back("+" + FullArchStr.str());
426398
} else {
427-
std::vector<std::string> FeatStrings = (*RII)->toFeatures();
399+
// Append a full list of features, including any negative extensions so that
400+
// we override the CPU's features.
401+
std::vector<std::string> FeatStrings =
402+
(*RII)->toFeatures(/* AddAllExtensions */ true);
428403
Features.insert(Features.end(), FeatStrings.begin(), FeatStrings.end());
429404
}
430405
}

0 commit comments

Comments
 (0)