Skip to content

Commit 736cd7a

Browse files
authored
Merge branch 'llvm:main' into gh-101657
2 parents b7e9ef1 + a537724 commit 736cd7a

File tree

211 files changed

+7955
-4421
lines changed

Some content is hidden

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

211 files changed

+7955
-4421
lines changed

bolt/runtime/hugify.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ static bool hasPagecacheTHPSupport() {
8585
KernelVersionTy KernelVersion;
8686

8787
getKernelVersion((uint32_t *)&KernelVersion);
88-
if (KernelVersion.major >= 5 && KernelVersion.minor >= 10)
88+
if (KernelVersion.major >= 6 ||
89+
(KernelVersion.major == 5 && KernelVersion.minor >= 10))
8990
return true;
9091

9192
return false;

bolt/utils/docker/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ RUN mkdir build && \
2323
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--push-state -Wl,-whole-archive -ljemalloc_pic -Wl,--pop-state -lpthread -lstdc++ -lm -ldl" \
2424
-DCMAKE_INSTALL_PREFIX=/home/bolt/install && \
2525
ninja check-bolt && \
26-
ninja install-llvm-bolt install-perf2bolt install-merge-fdata \
27-
install-llvm-boltdiff install-bolt_rt
26+
ninja install-llvm-bolt install-merge-fdata install-bolt_rt
2827

2928
FROM ubuntu:24.04
3029

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ Resolutions to C++ Defect Reports
9696
- Implemented `CWG2918 Consideration of constraints for address of overloaded `
9797
`function <https://cplusplus.github.io/CWG/issues/2918.html>`_
9898

99+
- Bumped the ``__cpp_constexpr`` feature-test macro to ``202002L`` in C++20 mode as indicated in
100+
`P2493R0 <https://wg21.link/P2493R0>`_.
101+
99102
C Language Changes
100103
------------------
101104

@@ -243,6 +246,8 @@ Bug Fixes in This Version
243246
when it can affect template argument deduction (#GH122306).
244247
- Fix crash on code completion of function calls involving partial order of function templates
245248
(#GH125500).
249+
- Fixed clang crash when #embed data does not fit into an array
250+
(#GH128987).
246251

247252
Bug Fixes to Compiler Builtins
248253
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6325,7 +6325,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
63256325
if (auto It = Locals.find(D); It != Locals.end()) {
63266326
const unsigned Offset = It->second.Offset;
63276327
if (IsReference)
6328-
return this->emitGetLocal(PT_Ptr, Offset, E);
6328+
return this->emitGetLocal(classifyPrim(E), Offset, E);
63296329
return this->emitGetPtrLocal(Offset, E);
63306330
} else if (auto GlobalIndex = P.getGlobal(D)) {
63316331
if (IsReference) {

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,9 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
714714
return false;
715715
}
716716

717+
if (S.checkingPotentialConstantExpression() && S.Current->getDepth() != 0)
718+
return false;
719+
717720
if (F->isConstexpr() && F->hasBody() &&
718721
(F->getDecl()->isConstexpr() || F->getDecl()->hasAttr<MSConstexprAttr>()))
719722
return true;

clang/lib/AST/ByteCode/Pointer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const {
210210
};
211211

212212
bool UsePath = true;
213-
if (getType()->isLValueReferenceType())
213+
if (const ValueDecl *VD = getDeclDesc()->asValueDecl();
214+
VD && VD->getType()->isLValueReferenceType())
214215
UsePath = false;
215216

216217
// Build the path into the object.

clang/lib/AST/ExprConstant.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3628,8 +3628,6 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
36283628
if (AllowConstexprUnknown) {
36293629
if (!Result)
36303630
Result = &Info.CurrentCall->createConstexprUnknownAPValues(VD, Base);
3631-
else
3632-
Result->setConstexprUnknown();
36333631
}
36343632
return true;
36353633
}
@@ -16995,6 +16993,18 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx,
1699516993

1699616994
if (!Info.discardCleanups())
1699716995
llvm_unreachable("Unhandled cleanup; missing full expression marker?");
16996+
16997+
if (Value.allowConstexprUnknown()) {
16998+
assert(Value.isLValue() && "Expected an lvalue");
16999+
auto Base = Value.getLValueBase();
17000+
const auto *NewVD = Base.dyn_cast<const ValueDecl *>();
17001+
if (!NewVD)
17002+
NewVD = VD;
17003+
Info.FFDiag(getExprLoc(), diag::note_constexpr_var_init_non_constant, 1)
17004+
<< NewVD;
17005+
NoteLValueLocation(Info, Base);
17006+
return false;
17007+
}
1699817008
}
1699917009

1700017010
return CheckConstantExpression(Info, DeclLoc, DeclTy, Value,

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,8 +1883,11 @@ llvm::Constant *ConstantEmitter::tryEmitPrivateForVarInit(const VarDecl &D) {
18831883

18841884
// Try to emit the initializer. Note that this can allow some things that
18851885
// are not allowed by tryEmitPrivateForMemory alone.
1886-
if (APValue *value = D.evaluateValue())
1886+
if (APValue *value = D.evaluateValue()) {
1887+
assert(!value->allowConstexprUnknown() &&
1888+
"Constexpr unknown values are not allowed in CodeGen");
18871889
return tryEmitPrivateForMemory(*value, destType);
1890+
}
18881891

18891892
return nullptr;
18901893
}

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4845,16 +4845,11 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
48454845
return Style.SpaceBeforeParensOptions.AfterControlStatements ||
48464846
spaceRequiredBeforeParens(Right);
48474847
}
4848-
if (Left.isOneOf(tok::kw_new, tok::kw_delete)) {
4849-
return ((!Line.MightBeFunctionDecl || !BeforeLeft) &&
4850-
Style.SpaceBeforeParens != FormatStyle::SBPO_Never) ||
4851-
spaceRequiredBeforeParens(Right);
4852-
}
4853-
4854-
if (Left.is(tok::r_square) && Left.MatchingParen &&
4855-
Left.MatchingParen->Previous &&
4856-
Left.MatchingParen->Previous->is(tok::kw_delete)) {
4857-
return (Style.SpaceBeforeParens != FormatStyle::SBPO_Never) ||
4848+
if (Left.isOneOf(tok::kw_new, tok::kw_delete) ||
4849+
(Left.is(tok::r_square) && Left.MatchingParen &&
4850+
Left.MatchingParen->Previous &&
4851+
Left.MatchingParen->Previous->is(tok::kw_delete))) {
4852+
return Style.SpaceBeforeParens != FormatStyle::SBPO_Never ||
48584853
spaceRequiredBeforeParens(Right);
48594854
}
48604855
}

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
664664
Builder.defineMacro("__cpp_lambdas", "200907L");
665665
Builder.defineMacro("__cpp_constexpr", LangOpts.CPlusPlus26 ? "202406L"
666666
: LangOpts.CPlusPlus23 ? "202211L"
667-
: LangOpts.CPlusPlus20 ? "201907L"
667+
: LangOpts.CPlusPlus20 ? "202002L"
668668
: LangOpts.CPlusPlus17 ? "201603L"
669669
: LangOpts.CPlusPlus14 ? "201304L"
670670
: "200704");

0 commit comments

Comments
 (0)