Skip to content

Commit 24b6b2b

Browse files
committed
merge main into amd-staging
revert : needs downstream rework on MMI removal 63e1647 CodeGen: Remove MachineModuleInfo reference from MachineFunction (llvm#100357) Change-Id: I1d1a248611ed89e468a94cc88592d5912050d74b
2 parents b69dc76 + b582b65 commit 24b6b2b

File tree

163 files changed

+4036
-1422
lines changed

Some content is hidden

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

163 files changed

+4036
-1422
lines changed

.github/workflows/release-sources.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
steps:
4848
- id: inputs
4949
run: |
50-
ref=${{ inputs.release-version || github.sha }}
50+
ref=${{ (inputs.release-version && format('llvmorg-{0}', inputs.release-version)) || github.sha }}
5151
if [ -n "${{ inputs.release-version }}" ]; then
5252
export_args="-release ${{ inputs.release-version }} -final"
5353
else

clang-tools-extra/test/clang-doc/basic-project.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// See https://github.com/llvm/llvm-project/issues/97507.
2+
// UNSUPPORTED: target={{.*}}
3+
14
// RUN: rm -rf %t && mkdir -p %t/docs %t/build
25
// RUN: sed 's|$test_dir|%/S|g' %S/Inputs/basic-project/database_template.json > %t/build/compile_commands.json
36
// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ Miscellaneous Bug Fixes
171171
Miscellaneous Clang Crashes Fixed
172172
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
173173

174+
- Fixed a crash in C due to incorrect lookup that members in nested anonymous struct/union
175+
can be found as ordinary identifiers in struct/union definition. (#GH31295)
176+
174177
OpenACC Specific Changes
175178
------------------------
176179

clang/include/clang/AST/Type.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4698,26 +4698,25 @@ class FunctionEffect {
46984698
};
46994699

47004700
private:
4701-
LLVM_PREFERRED_TYPE(Kind)
4702-
unsigned FKind : 3;
4701+
Kind FKind;
47034702

47044703
// Expansion: for hypothetical TCB+types, there could be one Kind for TCB,
47054704
// then ~16(?) bits "SubKind" to map to a specific named TCB. SubKind would
47064705
// be considered for uniqueness.
47074706

47084707
public:
4709-
FunctionEffect() : FKind(unsigned(Kind::None)) {}
4708+
FunctionEffect() : FKind(Kind::None) {}
47104709

4711-
explicit FunctionEffect(Kind K) : FKind(unsigned(K)) {}
4710+
explicit FunctionEffect(Kind K) : FKind(K) {}
47124711

47134712
/// The kind of the effect.
4714-
Kind kind() const { return Kind(FKind); }
4713+
Kind kind() const { return FKind; }
47154714

47164715
/// Return the opposite kind, for effects which have opposites.
47174716
Kind oppositeKind() const;
47184717

47194718
/// For serialization.
4720-
uint32_t toOpaqueInt32() const { return FKind; }
4719+
uint32_t toOpaqueInt32() const { return uint32_t(FKind); }
47214720
static FunctionEffect fromOpaqueInt32(uint32_t Value) {
47224721
return FunctionEffect(Kind(Value));
47234722
}

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
224224
COMPATIBLE_LANGOPT(NoInlineDefine , 1, 0, "__NO_INLINE__ predefined macro")
225225
COMPATIBLE_LANGOPT(Deprecated , 1, 0, "__DEPRECATED predefined macro")
226226
COMPATIBLE_LANGOPT(FastMath , 1, 0, "fast FP math optimizations, and __FAST_MATH__ predefined macro")
227-
COMPATIBLE_LANGOPT(FiniteMathOnly , 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
228227
COMPATIBLE_LANGOPT(UnsafeFPMath , 1, 0, "Unsafe Floating Point Math")
229228
COMPATIBLE_LANGOPT(ProtectParens , 1, 0, "optimizer honors parentheses "
230229
"when floating-point expressions are evaluated")
@@ -350,7 +349,6 @@ LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating poi
350349
LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
351350
BENIGN_LANGOPT(CLNoSignedZero , 1, 0, "Permit Floating Point optimization without regard to signed zeros")
352351
COMPATIBLE_LANGOPT(CLUnsafeMath , 1, 0, "Unsafe Floating Point Math")
353-
COMPATIBLE_LANGOPT(CLFiniteMathOnly , 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
354352
/// FP_CONTRACT mode (on/off/fast).
355353
BENIGN_ENUM_LANGOPT(DefaultFPContractMode, FPModeKind, 2, FPM_Off, "FP contraction type")
356354
COMPATIBLE_LANGOPT(ExpStrictFP, 1, false, "Enable experimental strict floating point")

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,7 @@ def cl_single_precision_constant : Flag<["-"], "cl-single-precision-constant">,
11191119
MarshallingInfoFlag<LangOpts<"SinglePrecisionConstants">>;
11201120
def cl_finite_math_only : Flag<["-"], "cl-finite-math-only">, Group<opencl_Group>,
11211121
Visibility<[ClangOption, CC1Option]>,
1122-
HelpText<"OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.">,
1123-
MarshallingInfoFlag<LangOpts<"CLFiniteMathOnly">>;
1122+
HelpText<"OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.">;
11241123
def cl_kernel_arg_info : Flag<["-"], "cl-kernel-arg-info">, Group<opencl_Group>,
11251124
Visibility<[ClangOption, CC1Option]>,
11261125
HelpText<"OpenCL only. Generate kernel argument metadata.">,
@@ -2611,13 +2610,12 @@ defm approx_func : BoolFOption<"approx-func", LangOpts<"ApproxFunc">, DefaultFal
26112610
"with an approximately equivalent calculation",
26122611
[funsafe_math_optimizations.KeyPath]>,
26132612
NegFlag<SetFalse, [], [ClangOption, CC1Option, FC1Option, FlangOption]>>;
2614-
defm finite_math_only : BoolFOption<"finite-math-only",
2615-
LangOpts<"FiniteMathOnly">, DefaultFalse,
2613+
defm finite_math_only : BoolOptionWithoutMarshalling<"f", "finite-math-only",
26162614
PosFlag<SetTrue, [], [ClangOption, CC1Option],
26172615
"Allow floating-point optimizations that "
26182616
"assume arguments and results are not NaNs or +-inf. This defines "
26192617
"the \\_\\_FINITE\\_MATH\\_ONLY\\_\\_ preprocessor macro.",
2620-
[cl_finite_math_only.KeyPath, ffast_math.KeyPath]>,
2618+
[ffast_math.KeyPath]>,
26212619
NegFlag<SetFalse>>;
26222620
defm signed_zeros : BoolFOption<"signed-zeros",
26232621
LangOpts<"NoSignedZero">, DefaultFalse,
@@ -7928,10 +7926,10 @@ def mreassociate : Flag<["-"], "mreassociate">,
79287926
MarshallingInfoFlag<LangOpts<"AllowFPReassoc">>, ImpliedByAnyOf<[funsafe_math_optimizations.KeyPath]>;
79297927
def menable_no_nans : Flag<["-"], "menable-no-nans">,
79307928
HelpText<"Allow optimization to assume there are no NaNs.">,
7931-
MarshallingInfoFlag<LangOpts<"NoHonorNaNs">>, ImpliedByAnyOf<[ffinite_math_only.KeyPath]>;
7932-
def menable_no_infinities : Flag<["-"], "menable-no-infs">,
7929+
MarshallingInfoFlag<LangOpts<"NoHonorNaNs">>, ImpliedByAnyOf<[ffast_math.KeyPath]>;
7930+
def menable_no_infs : Flag<["-"], "menable-no-infs">,
79337931
HelpText<"Allow optimization to assume there are no infinities.">,
7934-
MarshallingInfoFlag<LangOpts<"NoHonorInfs">>, ImpliedByAnyOf<[ffinite_math_only.KeyPath]>;
7932+
MarshallingInfoFlag<LangOpts<"NoHonorInfs">>, ImpliedByAnyOf<[ffast_math.KeyPath]>;
79357933

79367934
def pic_level : Separate<["-"], "pic-level">,
79377935
HelpText<"Value for __PIC__">,

clang/lib/AST/DeclBase.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,6 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
879879
return IDNS_Ordinary;
880880
case Label:
881881
return IDNS_Label;
882-
case IndirectField:
883-
return IDNS_Ordinary | IDNS_Member;
884882

885883
case Binding:
886884
case NonTypeTemplateParm:
@@ -918,6 +916,7 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
918916
return IDNS_ObjCProtocol;
919917

920918
case Field:
919+
case IndirectField:
921920
case ObjCAtDefsField:
922921
case ObjCIvar:
923922
return IDNS_Member;

clang/lib/AST/Interp/Disasm.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,15 @@ LLVM_DUMP_METHOD void InterpFrame::dump(llvm::raw_ostream &OS,
278278
OS << "\n";
279279
OS.indent(Spaces) << "This: " << getThis() << "\n";
280280
OS.indent(Spaces) << "RVO: " << getRVOPtr() << "\n";
281-
282-
while (const InterpFrame *F = this->Caller) {
281+
OS.indent(Spaces) << "Depth: " << Depth << "\n";
282+
OS.indent(Spaces) << "ArgSize: " << ArgSize << "\n";
283+
OS.indent(Spaces) << "Args: " << (void *)Args << "\n";
284+
OS.indent(Spaces) << "FrameOffset: " << FrameOffset << "\n";
285+
OS.indent(Spaces) << "FrameSize: " << (Func ? Func->getFrameSize() : 0)
286+
<< "\n";
287+
288+
for (const InterpFrame *F = this->Caller; F; F = F->Caller) {
283289
F->dump(OS, Indent + 1);
284-
F = F->Caller;
285290
}
286291
}
287292

clang/lib/AST/Interp/InterpBuiltin.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,27 +1170,30 @@ static bool interp__builtin_constant_p(InterpState &S, CodePtr OpPC,
11701170
Stk.clear();
11711171
}
11721172

1173-
const APValue &LV = Res.toAPValue();
1174-
if (!Res.isInvalid() && LV.isLValue()) {
1175-
APValue::LValueBase Base = LV.getLValueBase();
1176-
if (Base.isNull()) {
1177-
// A null base is acceptable.
1178-
return returnInt(true);
1179-
} else if (const auto *E = Base.dyn_cast<const Expr *>()) {
1180-
if (!isa<StringLiteral>(E))
1173+
if (!Res.isInvalid() && !Res.empty()) {
1174+
const APValue &LV = Res.toAPValue();
1175+
if (LV.isLValue()) {
1176+
APValue::LValueBase Base = LV.getLValueBase();
1177+
if (Base.isNull()) {
1178+
// A null base is acceptable.
1179+
return returnInt(true);
1180+
} else if (const auto *E = Base.dyn_cast<const Expr *>()) {
1181+
if (!isa<StringLiteral>(E))
1182+
return returnInt(false);
1183+
return returnInt(LV.getLValueOffset().isZero());
1184+
} else if (Base.is<TypeInfoLValue>()) {
1185+
// Surprisingly, GCC considers __builtin_constant_p(&typeid(int)) to
1186+
// evaluate to true.
1187+
return returnInt(true);
1188+
} else {
1189+
// Any other base is not constant enough for GCC.
11811190
return returnInt(false);
1182-
return returnInt(LV.getLValueOffset().isZero());
1183-
} else if (Base.is<TypeInfoLValue>()) {
1184-
// Surprisingly, GCC considers __builtin_constant_p(&typeid(int)) to
1185-
// evaluate to true.
1186-
return returnInt(true);
1187-
} else {
1188-
// Any other base is not constant enough for GCC.
1189-
return returnInt(false);
1191+
}
11901192
}
11911193
}
11921194

1193-
return returnInt(!Res.isInvalid() && !Res.empty());
1195+
// Otherwise, any constant value is good enough.
1196+
return returnInt(true);
11941197
}
11951198

11961199
return returnInt(false);

clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ class ResultObjectVisitor : public AnalysisASTVisitor<ResultObjectVisitor> {
416416
// below them can initialize the same object (or part of it).
417417
if (isa<CXXConstructExpr>(E) || isa<CallExpr>(E) || isa<LambdaExpr>(E) ||
418418
isa<CXXDefaultArgExpr>(E) || isa<CXXStdInitializerListExpr>(E) ||
419-
isa<AtomicExpr>(E) ||
419+
isa<AtomicExpr>(E) || isa<CXXInheritedCtorInitExpr>(E) ||
420420
// We treat `BuiltinBitCastExpr` as an "original initializer" too as
421421
// it may not even be casting from a record type -- and even if it is,
422422
// the two objects are in general of unrelated type.

clang/lib/Basic/LangOptions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ void LangOptions::resetNonModularOptions() {
3434
// invocations that cannot be round-tripped to arguments.
3535
// FIXME: we should derive this automatically from ImpliedBy in tablegen.
3636
AllowFPReassoc = UnsafeFPMath;
37-
NoHonorNaNs = FiniteMathOnly;
38-
NoHonorInfs = FiniteMathOnly;
37+
NoHonorInfs = FastMath;
38+
NoHonorNaNs = FastMath;
3939

4040
// These options do not affect AST generation.
4141
NoSanitizeFiles.clear();

clang/lib/Basic/Targets/OSTargets.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) {
173173
// "Under /fp:precise and /fp:strict, the compiler doesn't do any mathematical
174174
// transformation unless the transformation is guaranteed to produce a bitwise
175175
// identical result."
176-
const bool any_imprecise_flags =
177-
Opts.FastMath || Opts.FiniteMathOnly || Opts.UnsafeFPMath ||
178-
Opts.AllowFPReassoc || Opts.NoHonorNaNs || Opts.NoHonorInfs ||
179-
Opts.NoSignedZero || Opts.AllowRecip || Opts.ApproxFunc;
176+
const bool any_imprecise_flags = Opts.FastMath || Opts.UnsafeFPMath ||
177+
Opts.AllowFPReassoc || Opts.NoHonorNaNs ||
178+
Opts.NoHonorInfs || Opts.NoSignedZero ||
179+
Opts.AllowRecip || Opts.ApproxFunc;
180180

181181
// "Under both /fp:precise and /fp:fast, the compiler generates code intended
182182
// to run in the default floating-point environment."

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,10 @@ void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
621621
const char *LinkingOutput) const {
622622
std::string Linker = getToolChain().GetLinkerPath();
623623
ArgStringList CmdArgs;
624-
CmdArgs.push_back("--no-undefined");
625-
CmdArgs.push_back("-shared");
624+
if (!Args.hasArg(options::OPT_r)) {
625+
CmdArgs.push_back("--no-undefined");
626+
CmdArgs.push_back("-shared");
627+
}
626628

627629
addLinkerCompressDebugSectionsOption(getToolChain(), Args, CmdArgs);
628630
Args.AddAllArgs(CmdArgs, options::OPT_L);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,9 +3442,28 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
34423442
CmdArgs.push_back("-ffast-math");
34433443

34443444
// Handle __FINITE_MATH_ONLY__ similarly.
3445-
if (!HonorINFs && !HonorNaNs)
3445+
// The -ffinite-math-only is added to CmdArgs when !HonorINFs && !HonorNaNs.
3446+
// Otherwise process the Xclang arguments to determine if -menable-no-infs and
3447+
// -menable-no-nans are set by the user.
3448+
bool shouldAddFiniteMathOnly = false;
3449+
if (!HonorINFs && !HonorNaNs) {
3450+
shouldAddFiniteMathOnly = true;
3451+
} else {
3452+
bool InfValues = true;
3453+
bool NanValues = true;
3454+
for (const auto *Arg : Args.filtered(options::OPT_Xclang)) {
3455+
StringRef ArgValue = Arg->getValue();
3456+
if (ArgValue == "-menable-no-nans")
3457+
NanValues = false;
3458+
else if (ArgValue == "-menable-no-infs")
3459+
InfValues = false;
3460+
}
3461+
if (!NanValues && !InfValues)
3462+
shouldAddFiniteMathOnly = true;
3463+
}
3464+
if (shouldAddFiniteMathOnly) {
34463465
CmdArgs.push_back("-ffinite-math-only");
3447-
3466+
}
34483467
if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ)) {
34493468
CmdArgs.push_back("-mfpmath");
34503469
CmdArgs.push_back(A->getValue());
@@ -3813,6 +3832,11 @@ static void RenderOpenCLOptions(const ArgList &Args, ArgStringList &CmdArgs,
38133832
CmdArgs.push_back(Args.MakeArgString(CLExtStr));
38143833
}
38153834

3835+
if (Args.hasArg(options::OPT_cl_finite_math_only)) {
3836+
CmdArgs.push_back("-menable-no-infs");
3837+
CmdArgs.push_back("-menable-no-nans");
3838+
}
3839+
38163840
for (const auto &Arg : ForwardedArguments)
38173841
if (const auto *A = Args.getLastArg(Arg))
38183842
CmdArgs.push_back(Args.MakeArgString(A->getOption().getPrefixedName()));

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
13181318
if (!LangOpts.MathErrno)
13191319
Builder.defineMacro("__NO_MATH_ERRNO__");
13201320

1321-
if (LangOpts.FastMath || LangOpts.FiniteMathOnly)
1321+
if (LangOpts.FastMath || (LangOpts.NoHonorInfs && LangOpts.NoHonorNaNs))
13221322
Builder.defineMacro("__FINITE_MATH_ONLY__", "1");
13231323
else
13241324
Builder.defineMacro("__FINITE_MATH_ONLY__", "0");

clang/lib/Frontend/PrintPreprocessedOutput.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
980980
*Callbacks->OS << static_cast<unsigned>(*Iter);
981981
PrintComma = true;
982982
}
983-
IsStartOfLine = true;
984983
} else if (Tok.isAnnotation()) {
985984
// Ignore annotation tokens created by pragmas - the pragmas themselves
986985
// will be reproduced in the preprocessed output.

clang/lib/Lex/PPMacroExpansion.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,16 @@ static bool isTargetVariantEnvironment(const TargetInfo &TI,
16041604
return false;
16051605
}
16061606

1607+
#if defined(__sun__) && defined(__svr4__)
1608+
// GCC mangles std::tm as tm for binary compatibility on Solaris (Issue
1609+
// #33114). We need to match this to allow the std::put_time calls to link
1610+
// (PR #99075).
1611+
asm("_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_"
1612+
"RSt8ios_basecPKSt2tmPKcSB_ = "
1613+
"_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_"
1614+
"RSt8ios_basecPK2tmPKcSB_");
1615+
#endif
1616+
16071617
/// ExpandBuiltinMacro - If an identifier token is read that is to be expanded
16081618
/// as a builtin macro, handle it and return the next token as 'Tok'.
16091619
void Preprocessor::ExpandBuiltinMacro(Token &Tok) {

clang/lib/Sema/SemaChecking.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,18 @@ static bool BuiltinSEHScopeCheck(Sema &SemaRef, CallExpr *TheCall,
14771477
return false;
14781478
}
14791479

1480+
// In OpenCL, __builtin_alloca_* should return a pointer to address space
1481+
// that corresponds to the stack address space i.e private address space.
1482+
static void builtinAllocaAddrSpace(Sema &S, CallExpr *TheCall) {
1483+
QualType RT = TheCall->getType();
1484+
assert((RT->isPointerType() && !(RT->getPointeeType().hasAddressSpace())) &&
1485+
"__builtin_alloca has invalid address space");
1486+
1487+
RT = RT->getPointeeType();
1488+
RT = S.Context.getAddrSpaceQualType(RT, LangAS::opencl_private);
1489+
TheCall->setType(S.Context.getPointerType(RT));
1490+
}
1491+
14801492
namespace {
14811493
enum PointerAuthOpKind {
14821494
PAO_Strip,
@@ -2214,6 +2226,9 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
22142226
case Builtin::BI__builtin_alloca_uninitialized:
22152227
Diag(TheCall->getBeginLoc(), diag::warn_alloca)
22162228
<< TheCall->getDirectCallee();
2229+
if (getLangOpts().OpenCL) {
2230+
builtinAllocaAddrSpace(*this, TheCall);
2231+
}
22172232
break;
22182233
case Builtin::BI__arithmetic_fence:
22192234
if (BuiltinArithmeticFence(TheCall))

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10411,7 +10411,7 @@ void Sema::checkIncorrectVTablePointerAuthenticationAttribute(
1041110411
while (1) {
1041210412
assert(PrimaryBase);
1041310413
const CXXRecordDecl *Base = nullptr;
10414-
for (auto BasePtr : PrimaryBase->bases()) {
10414+
for (const CXXBaseSpecifier &BasePtr : PrimaryBase->bases()) {
1041510415
if (!BasePtr.getType()->getAsCXXRecordDecl()->isDynamicClass())
1041610416
continue;
1041710417
Base = BasePtr.getType()->getAsCXXRecordDecl();

clang/lib/Sema/SemaTemplateDeduction.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,9 +951,11 @@ class PackDeductionScope {
951951

952952
// Skip over the pack elements that were expanded into separate arguments.
953953
// If we partially expanded, this is the number of partial arguments.
954+
// FIXME: `&& FixedNumExpansions` is a workaround for UB described in
955+
// https://github.com/llvm/llvm-project/issues/100095
954956
if (IsPartiallyExpanded)
955957
PackElements += NumPartialPackArgs;
956-
else if (IsExpanded)
958+
else if (IsExpanded && FixedNumExpansions)
957959
PackElements += *FixedNumExpansions;
958960

959961
for (auto &Pack : Packs) {

clang/test/AST/Interp/builtins.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ constexpr bool assume() {
3131
return true;
3232
}
3333
static_assert(assume(), "");
34+
35+
void test_builtin_os_log(void *buf, int i, const char *data) {
36+
constexpr int len = __builtin_os_log_format_buffer_size("%d %{public}s %{private}.16P", i, data, data);
37+
static_assert(len > 0, "Expect len > 0");
38+
}

clang/test/CodeGen/finite-math.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -ffinite-math-only -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=FINITE
1+
// RUN: %clang_cc1 -menable-no-infs -menable-no-nans -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=FINITE
22
// RUN: %clang_cc1 -fno-signed-zeros -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=NSZ
33
// RUN: %clang_cc1 -freciprocal-math -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=RECIP
44
// RUN: %clang_cc1 -mreassociate -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=REASSOC

clang/test/CodeGen/fp-floatcontrol-stack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffp-contract=on -DDEFAULT=1 -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-DDEFAULT %s
22
// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffp-contract=on -DEBSTRICT=1 -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-DEBSTRICT %s
33
// RUN: %clang_cc1 -triple x86_64-linux-gnu -DFAST=1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-FAST %s
4-
// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffp-contract=on -DNOHONOR=1 -menable-no-infs -menable-no-nans -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOHONOR %s
4+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffp-contract=on -DNOHONOR=1 -ffinite-math-only -menable-no-infs -menable-no-nans -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOHONOR %s
55

66
#define FUN(n) \
77
(float z) { return n * z + n; }

0 commit comments

Comments
 (0)