Skip to content

Commit 9338db8

Browse files
committed
Merge 16.0.6 into emscripten-libs-16
Tag 16.0.6
2 parents 929cfaa + 7cbf1a2 commit 9338db8

File tree

67 files changed

+1441
-335
lines changed

Some content is hidden

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

67 files changed

+1441
-335
lines changed

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
2323
- name: Install Dependencies
2424
run: |
25-
sudo apt-get update \
25+
sudo apt-get update
2626
sudo apt-get install -y \
2727
doxygen \
2828
graphviz \

bolt/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ endif()
4646

4747
if (BOLT_ENABLE_RUNTIME)
4848
message(STATUS "Building BOLT runtime libraries for X86")
49+
set(extra_args "")
50+
if(CMAKE_SYSROOT)
51+
list(APPEND extra_args -DCMAKE_SYSROOT=${CMAKE_SYSROOT})
52+
endif()
4953
ExternalProject_Add(bolt_rt
5054
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime"
5155
STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-stamps
@@ -54,8 +58,10 @@ if (BOLT_ENABLE_RUNTIME)
5458
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
5559
-DCMAKE_BUILD_TYPE=Release
5660
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
57-
-DCMAKE_INSTALL_PREFIX=${LLVM_BINARY_DIR}
5861
-DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
62+
-DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
63+
${extra_args}
64+
INSTALL_COMMAND ""
5965
BUILD_ALWAYS True
6066
)
6167
install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/cmake_install.cmake \)"

bolt/runtime/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ add_library(bolt_rt_instr STATIC
1515
instr.cpp
1616
${CMAKE_CURRENT_BINARY_DIR}/config.h
1717
)
18-
set_target_properties(bolt_rt_instr PROPERTIES LIBRARY_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}")
18+
set_target_properties(bolt_rt_instr PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${LLVM_LIBRARY_DIR}")
1919
add_library(bolt_rt_hugify STATIC
2020
hugify.cpp
2121
${CMAKE_CURRENT_BINARY_DIR}/config.h
2222
)
23-
set_target_properties(bolt_rt_hugify PROPERTIES LIBRARY_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}")
23+
set_target_properties(bolt_rt_hugify PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${LLVM_LIBRARY_DIR}")
2424

2525
set(BOLT_RT_FLAGS
2626
-ffreestanding
@@ -44,7 +44,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
4444
instr.cpp
4545
${CMAKE_CURRENT_BINARY_DIR}/config.h
4646
)
47-
set_target_properties(bolt_rt_instr_osx PROPERTIES LIBRARY_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}")
47+
set_target_properties(bolt_rt_instr_osx PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${LLVM_LIBRARY_DIR}")
4848
target_include_directories(bolt_rt_instr_osx PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
4949
target_compile_options(bolt_rt_instr_osx PRIVATE
5050
-target x86_64-apple-darwin19.6.0

clang-tools-extra/clangd/test/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ configure_lit_site_cfg(
2828
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
2929
)
3030

31-
# Copy an empty compile_flags.txt to make sure tests don't pick up arbitrary
32-
# commands from parents.
33-
file(
34-
TOUCH
35-
${CMAKE_CURRENT_BINARY_DIR}/compile_flags.txt
36-
)
37-
3831
add_lit_testsuite(check-clangd "Running the Clangd regression tests"
3932
# clangd doesn't put unittest configs in test/unit like every other project.
4033
# Because of that, this needs to pass two folders here, while every other

clang-tools-extra/test/clang-tidy/checkers/performance/trivially-destructible.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %check_clang_tidy %s performance-trivially-destructible %t
22
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
3-
// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -fix --
4-
// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -warnings-as-errors='-*,performance-trivially-destructible' --
3+
// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -fix
4+
// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -warnings-as-errors='-*,performance-trivially-destructible'
55

66
struct TriviallyDestructible1 {
77
int a;

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
253253
set(LLVM_TOOLCHAIN_TOOLS
254254
dsymutil
255255
llvm-ar
256-
llvm-bolt
257256
llvm-cov
258257
llvm-cxxfilt
259258
llvm-debuginfod-find
@@ -287,6 +286,7 @@ set(LLVM_TOOLCHAIN_TOOLS
287286
CACHE STRING "")
288287

289288
set(LLVM_DISTRIBUTION_COMPONENTS
289+
bolt
290290
clang
291291
lld
292292
LTO

clang/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,12 @@ Bug Fixes in This Version
718718
- Fix crash when attempting to perform parenthesized initialization of an
719719
aggregate with a base class with only non-public constructors.
720720
(`#62296 <https://github.com/llvm/llvm-project/issues/62296>`_)
721+
- Fix crash when handling nested immediate invocations in initializers of global
722+
variables.
723+
(`#58207 <https://github.com/llvm/llvm-project/issues/58207>`_)
724+
- Fix crash when passing a braced initializer list to a parentehsized aggregate
725+
initialization expression.
726+
(`#63008 <https://github.com/llvm/llvm-project/issues/63008>`_).
721727

722728
Bug Fixes to Compiler Builtins
723729
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -824,6 +830,9 @@ Bug Fixes to C++ Support
824830
- Fix default member initializers sometimes being ignored when performing
825831
parenthesized aggregate initialization of templated types.
826832
(`#62266 <https://github.com/llvm/llvm-project/issues/62266>`_)
833+
- Fix overly aggressive lifetime checks for parenthesized aggregate
834+
initialization.
835+
(`#61567 <https://github.com/llvm/llvm-project/issues/61567>`_)
827836

828837
Concepts Specific Fixes:
829838

clang/include/clang/AST/ExprConcepts.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class ConceptSpecializationExpr final : public Expr, public ConceptReference {
6464
const ConstraintSatisfaction *Satisfaction);
6565

6666
ConceptSpecializationExpr(const ASTContext &C, ConceptDecl *NamedConcept,
67+
const ASTTemplateArgumentListInfo *ArgsAsWritten,
6768
ImplicitConceptSpecializationDecl *SpecDecl,
6869
const ConstraintSatisfaction *Satisfaction,
6970
bool Dependent,
@@ -85,6 +86,13 @@ class ConceptSpecializationExpr final : public Expr, public ConceptReference {
8586
const ConstraintSatisfaction *Satisfaction, bool Dependent,
8687
bool ContainsUnexpandedParameterPack);
8788

89+
static ConceptSpecializationExpr *
90+
Create(const ASTContext &C, ConceptDecl *NamedConcept,
91+
const ASTTemplateArgumentListInfo *ArgsAsWritten,
92+
ImplicitConceptSpecializationDecl *SpecDecl,
93+
const ConstraintSatisfaction *Satisfaction, bool Dependent,
94+
bool ContainsUnexpandedParameterPack);
95+
8896
ArrayRef<TemplateArgument> getTemplateArguments() const {
8997
return SpecDecl->getTemplateArguments();
9098
}

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,8 @@ def err_init_conversion_failed : Error<
21242124
"exception object|a member subobject|an array element|a new value|a value|a "
21252125
"base class|a constructor delegation|a vector element|a block element|a "
21262126
"block element|a complex element|a lambda capture|a compound literal "
2127-
"initializer|a related result|a parameter of CF audited function}0 "
2127+
"initializer|a related result|a parameter of CF audited function|a "
2128+
"structured binding|a member subobject}0 "
21282129
"%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
21292130
"with an %select{rvalue|lvalue}2 of incompatible type}1,3"
21302131
"%select{|: different classes%diff{ ($ vs $)|}5,6"

clang/include/clang/Sema/Initialization.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ class alignas(8) InitializedEntity {
123123
/// decomposition declaration.
124124
EK_Binding,
125125

126+
/// The entity being initialized is a non-static data member subobject of an
127+
/// object initialized via parenthesized aggregate initialization.
128+
EK_ParenAggInitMember,
129+
126130
// Note: err_init_conversion_failed in DiagnosticSemaKinds.td uses this
127131
// enum as an index for its first %select. When modifying this list,
128132
// that diagnostic text needs to be updated as well.
@@ -227,8 +231,10 @@ class alignas(8) InitializedEntity {
227231

228232
/// Create the initialization entity for a member subobject.
229233
InitializedEntity(FieldDecl *Member, const InitializedEntity *Parent,
230-
bool Implicit, bool DefaultMemberInit)
231-
: Kind(EK_Member), Parent(Parent), Type(Member->getType()),
234+
bool Implicit, bool DefaultMemberInit,
235+
bool IsParenAggInit = false)
236+
: Kind(IsParenAggInit ? EK_ParenAggInitMember : EK_Member),
237+
Parent(Parent), Type(Member->getType()),
232238
Variable{Member, Implicit, DefaultMemberInit} {}
233239

234240
/// Create the initialization entity for an array element.
@@ -388,6 +394,14 @@ class alignas(8) InitializedEntity {
388394
return InitializedEntity(Member->getAnonField(), Parent, Implicit, false);
389395
}
390396

397+
/// Create the initialization entity for a member subobject initialized via
398+
/// parenthesized aggregate init.
399+
static InitializedEntity InitializeMemberFromParenAggInit(FieldDecl *Member) {
400+
return InitializedEntity(Member, /*Parent=*/nullptr, /*Implicit=*/false,
401+
/*DefaultMemberInit=*/false,
402+
/*IsParenAggInit=*/true);
403+
}
404+
391405
/// Create the initialization entity for a default member initializer.
392406
static InitializedEntity
393407
InitializeMemberFromDefaultMemberInitializer(FieldDecl *Member) {

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,9 @@ class Sema final {
13941394
/// A stack of expression evaluation contexts.
13951395
SmallVector<ExpressionEvaluationContextRecord, 8> ExprEvalContexts;
13961396

1397+
// Set of failed immediate invocations to avoid double diagnosing.
1398+
llvm::SmallPtrSet<ConstantExpr *, 4> FailedImmediateInvocations;
1399+
13971400
/// Emit a warning for all pending noderef expressions that we recorded.
13981401
void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec);
13991402

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,8 @@ canonicalizeImmediatelyDeclaredConstraint(const ASTContext &C, Expr *IDC,
765765
CSE->getNamedConcept()->getLocation(), NewConverted);
766766

767767
Expr *NewIDC = ConceptSpecializationExpr::Create(
768-
C, CSE->getNamedConcept(), CSD, nullptr, CSE->isInstantiationDependent(),
768+
C, CSE->getNamedConcept(), CSE->getTemplateArgsAsWritten(), CSD,
769+
/*Satisfaction=*/nullptr, CSE->isInstantiationDependent(),
769770
CSE->containsUnexpandedParameterPack());
770771

771772
if (auto *OrigFold = dyn_cast<CXXFoldExpr>(IDC))

clang/lib/AST/ExprConcepts.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ ConceptSpecializationExpr::ConceptSpecializationExpr(
5858
ConceptSpecializationExpr::ConceptSpecializationExpr(EmptyShell Empty)
5959
: Expr(ConceptSpecializationExprClass, Empty) {}
6060

61+
ConceptSpecializationExpr *ConceptSpecializationExpr::Create(
62+
const ASTContext &C, ConceptDecl *NamedConcept,
63+
ImplicitConceptSpecializationDecl *SpecDecl,
64+
const ConstraintSatisfaction *Satisfaction, bool Dependent,
65+
bool ContainsUnexpandedParameterPack) {
66+
return Create(C, NamedConcept, /*ArgsAsWritten*/ nullptr, SpecDecl, Satisfaction,
67+
Dependent, ContainsUnexpandedParameterPack);
68+
}
69+
6170
ConceptSpecializationExpr *ConceptSpecializationExpr::Create(
6271
const ASTContext &C, NestedNameSpecifierLoc NNS,
6372
SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo,
@@ -72,13 +81,14 @@ ConceptSpecializationExpr *ConceptSpecializationExpr::Create(
7281

7382
ConceptSpecializationExpr::ConceptSpecializationExpr(
7483
const ASTContext &C, ConceptDecl *NamedConcept,
84+
const ASTTemplateArgumentListInfo *ArgsAsWritten,
7585
ImplicitConceptSpecializationDecl *SpecDecl,
7686
const ConstraintSatisfaction *Satisfaction, bool Dependent,
7787
bool ContainsUnexpandedParameterPack)
7888
: Expr(ConceptSpecializationExprClass, C.BoolTy, VK_PRValue, OK_Ordinary),
7989
ConceptReference(NestedNameSpecifierLoc(), SourceLocation(),
8090
DeclarationNameInfo(), NamedConcept, NamedConcept,
81-
nullptr),
91+
ArgsAsWritten),
8292
SpecDecl(SpecDecl),
8393
Satisfaction(Satisfaction
8494
? ASTConstraintSatisfaction::Create(C, *Satisfaction)
@@ -95,12 +105,13 @@ ConceptSpecializationExpr::ConceptSpecializationExpr(
95105

96106
ConceptSpecializationExpr *ConceptSpecializationExpr::Create(
97107
const ASTContext &C, ConceptDecl *NamedConcept,
108+
const ASTTemplateArgumentListInfo *ArgsAsWritten,
98109
ImplicitConceptSpecializationDecl *SpecDecl,
99110
const ConstraintSatisfaction *Satisfaction, bool Dependent,
100111
bool ContainsUnexpandedParameterPack) {
101-
return new (C)
102-
ConceptSpecializationExpr(C, NamedConcept, SpecDecl, Satisfaction,
103-
Dependent, ContainsUnexpandedParameterPack);
112+
return new (C) ConceptSpecializationExpr(C, NamedConcept, ArgsAsWritten,
113+
SpecDecl, Satisfaction, Dependent,
114+
ContainsUnexpandedParameterPack);
104115
}
105116

106117
const TypeConstraint *

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7801,6 +7801,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
78017801
} else {
78027802
D.Diag(diag::err_drv_invalid_value) << A->getSpelling() << GuardArgs;
78037803
}
7804+
A->claim();
78047805
}
78057806
}
78067807

clang/lib/Format/IntegerLiteralSeparatorFixer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ IntegerLiteralSeparatorFixer::process(const Environment &Env,
113113
continue;
114114
}
115115
if (Style.isCpp()) {
116-
if (const auto Pos = Text.find_first_of("_i"); Pos != StringRef::npos) {
116+
// Hex alpha digits a-f/A-F must be at the end of the string literal.
117+
StringRef Suffixes = "_himnsuyd";
118+
if (const auto Pos =
119+
Text.find_first_of(IsBase16 ? Suffixes.drop_back() : Suffixes);
120+
Pos != StringRef::npos) {
117121
Text = Text.substr(0, Pos);
118122
Length = Pos;
119123
}

clang/lib/Sema/SemaAccess.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,8 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc,
16511651
<< Entity.getBaseSpecifier()->getType() << getSpecialMember(Constructor);
16521652
break;
16531653

1654-
case InitializedEntity::EK_Member: {
1654+
case InitializedEntity::EK_Member:
1655+
case InitializedEntity::EK_ParenAggInitMember: {
16551656
const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
16561657
PD = PDiag(diag::err_access_field_ctor);
16571658
PD << Field->getType() << getSpecialMember(Constructor);

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8693,7 +8693,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
86938693
}
86948694

86958695
// Check that SVE types are only used in functions with SVE available.
8696-
if (T->isSVESizelessBuiltinType() && CurContext->isFunctionOrMethod()) {
8696+
if (T->isSVESizelessBuiltinType() && isa<FunctionDecl>(CurContext)) {
86978697
const FunctionDecl *FD = cast<FunctionDecl>(CurContext);
86988698
llvm::StringMap<bool> CallerFeatureMap;
86998699
Context.getFunctionFeatureMap(CallerFeatureMap, FD);

clang/lib/Sema/SemaExpr.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17805,6 +17805,7 @@ static void EvaluateAndDiagnoseImmediateInvocation(
1780517805
bool Result = CE->EvaluateAsConstantExpr(
1780617806
Eval, SemaRef.getASTContext(), ConstantExprKind::ImmediateInvocation);
1780717807
if (!Result || !Notes.empty()) {
17808+
SemaRef.FailedImmediateInvocations.insert(CE);
1780817809
Expr *InnerExpr = CE->getSubExpr()->IgnoreImplicit();
1780917810
if (auto *FunctionalCast = dyn_cast<CXXFunctionalCastExpr>(InnerExpr))
1781017811
InnerExpr = FunctionalCast->getSubExpr();
@@ -17849,10 +17850,16 @@ static void RemoveNestedImmediateInvocation(
1784917850
[E](Sema::ImmediateInvocationCandidate Elem) {
1785017851
return Elem.getPointer() == E;
1785117852
});
17852-
assert(It != IISet.rend() &&
17853-
"ConstantExpr marked IsImmediateInvocation should "
17854-
"be present");
17855-
It->setInt(1); // Mark as deleted
17853+
// It is possible that some subexpression of the current immediate
17854+
// invocation was handled from another expression evaluation context. Do
17855+
// not handle the current immediate invocation if some of its
17856+
// subexpressions failed before.
17857+
if (It == IISet.rend()) {
17858+
if (SemaRef.FailedImmediateInvocations.contains(E))
17859+
CurrentII->setInt(1);
17860+
} else {
17861+
It->setInt(1); // Mark as deleted
17862+
}
1785617863
}
1785717864
ExprResult TransformConstantExpr(ConstantExpr *E) {
1785817865
if (!E->isImmediateInvocation())
@@ -17925,10 +17932,13 @@ HandleImmediateInvocations(Sema &SemaRef,
1792517932
SemaRef.RebuildingImmediateInvocation)
1792617933
return;
1792717934

17928-
/// When we have more then 1 ImmediateInvocationCandidates we need to check
17929-
/// for nested ImmediateInvocationCandidates. when we have only 1 we only
17930-
/// need to remove ReferenceToConsteval in the immediate invocation.
17931-
if (Rec.ImmediateInvocationCandidates.size() > 1) {
17935+
/// When we have more than 1 ImmediateInvocationCandidates or previously
17936+
/// failed immediate invocations, we need to check for nested
17937+
/// ImmediateInvocationCandidates in order to avoid duplicate diagnostics.
17938+
/// Otherwise we only need to remove ReferenceToConsteval in the immediate
17939+
/// invocation.
17940+
if (Rec.ImmediateInvocationCandidates.size() > 1 ||
17941+
!SemaRef.FailedImmediateInvocations.empty()) {
1793217942

1793317943
/// Prevent sema calls during the tree transform from adding pointers that
1793417944
/// are already in the sets.

0 commit comments

Comments
 (0)