Skip to content

Commit fb99590

Browse files
author
iclsrc
committed
Merge from 'main' to 'sycl-web' (38 commits)
CONFLICT (content): Merge conflict in clang/test/Driver/linker-wrapper.c CONFLICT (content): Merge conflict in clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
2 parents 1226f29 + 74e4a86 commit fb99590

File tree

250 files changed

+15622
-12834
lines changed

Some content is hidden

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

250 files changed

+15622
-12834
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,10 +1883,7 @@ def note_unsatisfied_trait_reason
18831883
"%DeletedAssign{has a deleted %select{copy|move}1 "
18841884
"assignment operator}|"
18851885
"%UnionWithUserDeclaredSMF{is a union with a user-declared "
1886-
"%sub{select_special_member_kind}1}|"
1887-
"%FunctionType{is a function type}|"
1888-
"%CVVoidType{is a cv void type}|"
1889-
"%IncompleteArrayType{is an incomplete array type}"
1886+
"%sub{select_special_member_kind}1}"
18901887
"}0">;
18911888

18921889
def warn_consteval_if_always_true : Warning<

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,11 @@ def UndefResultChecker : Checker<"UndefinedBinaryOperatorResult">,
233233
HelpText<"Check for undefined results of binary operators">,
234234
Documentation<HasDocumentation>;
235235

236-
def StackAddrEscapeBase : Checker<"StackAddrEscapeBase">,
237-
HelpText<"Generate information about stack address escapes.">,
238-
Documentation<NotDocumented>,
239-
Hidden;
240-
241-
def StackAddrEscapeChecker : Checker<"StackAddressEscape">,
242-
HelpText<"Check that addresses to stack memory do not escape the function">,
243-
Dependencies<[StackAddrEscapeBase]>,
244-
Documentation<HasDocumentation>;
236+
def StackAddrEscapeChecker
237+
: Checker<"StackAddressEscape">,
238+
HelpText<
239+
"Check that addresses to stack memory do not escape the function">,
240+
Documentation<HasDocumentation>;
245241

246242
def DynamicTypePropagation : Checker<"DynamicTypePropagation">,
247243
HelpText<"Generate dynamic type information">,
@@ -295,10 +291,11 @@ def DynamicTypeChecker
295291
Dependencies<[DynamicTypePropagation]>,
296292
Documentation<HasDocumentation>;
297293

298-
def StackAddrAsyncEscapeChecker : Checker<"StackAddressAsyncEscape">,
299-
HelpText<"Check that addresses to stack memory do not escape the function">,
300-
Dependencies<[StackAddrEscapeBase]>,
301-
Documentation<HasDocumentation>;
294+
def StackAddrAsyncEscapeChecker
295+
: Checker<"StackAddressAsyncEscape">,
296+
HelpText<
297+
"Check that addresses to stack memory do not escape the function">,
298+
Documentation<HasDocumentation>;
302299

303300
def PthreadLockBase : Checker<"PthreadLockBase">,
304301
HelpText<"Helper registering multiple checks.">,
@@ -1047,11 +1044,6 @@ def RetainCountBase : Checker<"RetainCountBase">,
10471044

10481045
let ParentPackage = OSX in {
10491046

1050-
def NSOrCFErrorDerefChecker : Checker<"NSOrCFErrorDerefChecker">,
1051-
HelpText<"Implementation checker for NSErrorChecker and CFErrorChecker">,
1052-
Documentation<NotDocumented>,
1053-
Hidden;
1054-
10551047
def NumberObjectConversionChecker : Checker<"NumberObjectConversion">,
10561048
HelpText<"Check for erroneous conversions of objects representing numbers "
10571049
"into numbers">,
@@ -1149,9 +1141,8 @@ def ObjCSuperCallChecker : Checker<"MissingSuperCall">,
11491141
Documentation<NotDocumented>;
11501142

11511143
def NSErrorChecker : Checker<"NSError">,
1152-
HelpText<"Check usage of NSError** parameters">,
1153-
Dependencies<[NSOrCFErrorDerefChecker]>,
1154-
Documentation<HasDocumentation>;
1144+
HelpText<"Check usage of NSError** parameters">,
1145+
Documentation<HasDocumentation>;
11551146

11561147
def RetainCountChecker : Checker<"RetainCount">,
11571148
HelpText<"Check for leaks and improper reference count management">,
@@ -1253,9 +1244,8 @@ def CFRetainReleaseChecker : Checker<"CFRetainRelease">,
12531244
Documentation<HasDocumentation>;
12541245

12551246
def CFErrorChecker : Checker<"CFError">,
1256-
HelpText<"Check usage of CFErrorRef* parameters">,
1257-
Dependencies<[NSOrCFErrorDerefChecker]>,
1258-
Documentation<HasDocumentation>;
1247+
HelpText<"Check usage of CFErrorRef* parameters">,
1248+
Documentation<HasDocumentation>;
12591249

12601250
} // end "osx.coreFoundation"
12611251

clang/lib/AST/ByteCode/Compiler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "clang/AST/Decl.h"
2222
#include "clang/AST/Expr.h"
2323
#include "clang/AST/StmtVisitor.h"
24-
#include "clang/Basic/TargetInfo.h"
2524

2625
namespace clang {
2726
class QualType;

clang/lib/AST/ByteCode/Interp.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "InterpStack.h"
2626
#include "InterpState.h"
2727
#include "MemberPointer.h"
28-
#include "Opcode.h"
2928
#include "PrimType.h"
3029
#include "Program.h"
3130
#include "State.h"
@@ -1131,8 +1130,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
11311130
S.FFDiag(Loc, diag::note_constexpr_pointer_comparison_past_end)
11321131
<< LHS.toDiagnosticString(S.getASTContext());
11331132
return false;
1134-
} else if (RHS.isOnePastEnd() && !LHS.isOnePastEnd() && !LHS.isZero() &&
1135-
LHS.getOffset() == 0) {
1133+
}
1134+
if (RHS.isOnePastEnd() && !LHS.isOnePastEnd() && !LHS.isZero() &&
1135+
LHS.getOffset() == 0) {
11361136
const SourceInfo &Loc = S.Current->getSource(OpPC);
11371137
S.FFDiag(Loc, diag::note_constexpr_pointer_comparison_past_end)
11381138
<< RHS.toDiagnosticString(S.getASTContext());
@@ -1150,8 +1150,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
11501150
const SourceInfo &Loc = S.Current->getSource(OpPC);
11511151
S.FFDiag(Loc, diag::note_constexpr_literal_comparison);
11521152
return false;
1153-
} else if (const auto *CE = dyn_cast<CallExpr>(E);
1154-
CE && IsOpaqueConstantCall(CE)) {
1153+
}
1154+
if (const auto *CE = dyn_cast<CallExpr>(E);
1155+
CE && IsOpaqueConstantCall(CE)) {
11551156
const SourceInfo &Loc = S.Current->getSource(OpPC);
11561157
S.FFDiag(Loc, diag::note_constexpr_opaque_call_comparison)
11571158
<< P.toDiagnosticString(S.getASTContext());
@@ -3266,7 +3267,8 @@ inline bool InvalidCast(InterpState &S, CodePtr OpPC, CastKind Kind,
32663267
S.CCEDiag(Loc, diag::note_constexpr_invalid_cast)
32673268
<< static_cast<unsigned>(Kind) << S.Current->getRange(OpPC);
32683269
return !Fatal;
3269-
} else if (Kind == CastKind::Volatile) {
3270+
}
3271+
if (Kind == CastKind::Volatile) {
32703272
if (!S.checkingPotentialConstantExpression()) {
32713273
const auto *E = cast<CastExpr>(S.Current->getExpr(OpPC));
32723274
if (S.getLangOpts().CPlusPlus)
@@ -3277,7 +3279,8 @@ inline bool InvalidCast(InterpState &S, CodePtr OpPC, CastKind Kind,
32773279
}
32783280

32793281
return false;
3280-
} else if (Kind == CastKind::Dynamic) {
3282+
}
3283+
if (Kind == CastKind::Dynamic) {
32813284
assert(!S.getLangOpts().CPlusPlus20);
32823285
S.CCEDiag(S.Current->getSource(OpPC), diag::note_constexpr_invalid_cast)
32833286
<< diag::ConstexprInvalidCastKind::Dynamic;

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,6 +2652,8 @@ void CGDebugInfo::emitVTableSymbol(llvm::GlobalVariable *VTable,
26522652
const CXXRecordDecl *RD) {
26532653
if (!CGM.getTarget().getCXXABI().isItaniumFamily())
26542654
return;
2655+
if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly)
2656+
return;
26552657

26562658
ASTContext &Context = CGM.getContext();
26572659
StringRef SymbolName = "_vtable$";

clang/lib/Driver/Driver.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,7 +4587,7 @@ class OffloadingActionBuilder final {
45874587
if (!CompileDeviceOnly) {
45884588
C.getDriver().Diag(diag::err_opt_not_valid_without_opt)
45894589
<< "-fhip-emit-relocatable"
4590-
<< "--cuda-device-only";
4590+
<< "--offload-device-only";
45914591
}
45924592
}
45934593
}
@@ -7780,6 +7780,21 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
77807780
C.isOffloadingHostKind(Action::OFK_HIP) &&
77817781
!Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false);
77827782

7783+
bool HIPRelocatableObj =
7784+
C.isOffloadingHostKind(Action::OFK_HIP) &&
7785+
Args.hasFlag(options::OPT_fhip_emit_relocatable,
7786+
options::OPT_fno_hip_emit_relocatable, false);
7787+
7788+
if (!HIPNoRDC && HIPRelocatableObj)
7789+
C.getDriver().Diag(diag::err_opt_not_valid_with_opt)
7790+
<< "-fhip-emit-relocatable"
7791+
<< "-fgpu-rdc";
7792+
7793+
if (!offloadDeviceOnly() && HIPRelocatableObj)
7794+
C.getDriver().Diag(diag::err_opt_not_valid_without_opt)
7795+
<< "-fhip-emit-relocatable"
7796+
<< "--offload-device-only";
7797+
77837798
// For HIP non-rdc non-device-only compilation, create a linker wrapper
77847799
// action for each host object to link, bundle and wrap device files in
77857800
// it.
@@ -7917,7 +7932,7 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
79177932
A->getOffloadingToolChain()->getTriple().isSPIRV();
79187933
if ((A->getType() != types::TY_Object && !IsAMDGCNSPIRV &&
79197934
A->getType() != types::TY_LTO_BC) ||
7920-
!HIPNoRDC || !offloadDeviceOnly())
7935+
HIPRelocatableObj || !HIPNoRDC || !offloadDeviceOnly())
79217936
continue;
79227937
ActionList LinkerInput = {A};
79237938
A = C.MakeAction<LinkJobAction>(LinkerInput, types::TY_Image);

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,17 +295,22 @@ static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs,
295295
Format = A->getValue();
296296

297297
SmallString<128> F;
298-
const Arg *A = Args.getLastArg(options::OPT_foptimization_record_file_EQ);
299-
if (A)
298+
if (const Arg *A =
299+
Args.getLastArg(options::OPT_foptimization_record_file_EQ)) {
300+
F = A->getValue();
301+
F += ".";
302+
} else if (const Arg *A = Args.getLastArg(options::OPT_dumpdir)) {
300303
F = A->getValue();
301-
else if (Output.isFilename())
304+
} else if (Output.isFilename()) {
302305
F = Output.getFilename();
306+
F += ".";
307+
}
303308

304309
assert(!F.empty() && "Cannot determine remarks output name.");
305310
// Append "opt.ld.<format>" to the end of the file name.
306311
CmdArgs.push_back(Args.MakeArgString(Twine(PluginOptPrefix) +
307-
"opt-remarks-filename=" + F +
308-
".opt.ld." + Format));
312+
"opt-remarks-filename=" + F + "opt.ld." +
313+
Format));
309314

310315
if (const Arg *A =
311316
Args.getLastArg(options::OPT_foptimization_record_passes_EQ))
@@ -1083,9 +1088,17 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
10831088
}
10841089
}
10851090

1086-
if (Args.hasArg(options::OPT_gsplit_dwarf))
1087-
CmdArgs.push_back(Args.MakeArgString(
1088-
Twine(PluginOptPrefix) + "dwo_dir=" + Output.getFilename() + "_dwo"));
1091+
if (Args.hasArg(options::OPT_gsplit_dwarf)) {
1092+
SmallString<128> F;
1093+
if (const Arg *A = Args.getLastArg(options::OPT_dumpdir)) {
1094+
F = A->getValue();
1095+
} else {
1096+
F = Output.getFilename();
1097+
F += "_";
1098+
}
1099+
CmdArgs.push_back(
1100+
Args.MakeArgString(Twine(PluginOptPrefix) + "dwo_dir=" + F + "dwo"));
1101+
}
10891102

10901103
if (IsThinLTO && !IsOSAIX)
10911104
CmdArgs.push_back(Args.MakeArgString(Twine(PluginOptPrefix) + "thinlto"));

clang/lib/Sema/AnalysisBasedWarnings.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,12 @@ static bool areAllValuesNoReturn(const VarDecl *VD, const CFGBlock &VarBlk,
503503

504504
TransferFunctions TF(VD);
505505
BackwardDataflowWorklist Worklist(*AC.getCFG(), AC);
506+
llvm::DenseSet<const CFGBlock *> Visited;
506507
Worklist.enqueueBlock(&VarBlk);
507508
while (const CFGBlock *B = Worklist.dequeue()) {
509+
if (Visited.contains(B))
510+
continue;
511+
Visited.insert(B);
508512
// First check the current block.
509513
for (CFGBlock::const_reverse_iterator ri = B->rbegin(), re = B->rend();
510514
ri != re; ++ri) {

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "clang/AST/DeclCXX.h"
14-
#include "clang/AST/TemplateBase.h"
1514
#include "clang/AST/Type.h"
16-
#include "clang/Basic/DiagnosticIDs.h"
1715
#include "clang/Basic/DiagnosticParse.h"
1816
#include "clang/Basic/DiagnosticSema.h"
1917
#include "clang/Basic/TypeTraits.h"
@@ -1965,7 +1963,6 @@ static std::optional<TypeTrait> StdNameToTypeTrait(StringRef Name) {
19651963
.Case("is_assignable", TypeTrait::BTT_IsAssignable)
19661964
.Case("is_empty", TypeTrait::UTT_IsEmpty)
19671965
.Case("is_standard_layout", TypeTrait::UTT_IsStandardLayout)
1968-
.Case("is_constructible", TypeTrait::TT_IsConstructible)
19691966
.Default(std::nullopt);
19701967
}
19711968

@@ -2002,16 +1999,8 @@ static ExtractedTypeTraitInfo ExtractTypeTraitFromExpression(const Expr *E) {
20021999
Trait = StdNameToTypeTrait(Name);
20032000
if (!Trait)
20042001
return std::nullopt;
2005-
for (const auto &Arg : VD->getTemplateArgs().asArray()) {
2006-
if (Arg.getKind() == TemplateArgument::ArgKind::Pack) {
2007-
for (const auto &InnerArg : Arg.pack_elements())
2008-
Args.push_back(InnerArg.getAsType());
2009-
} else if (Arg.getKind() == TemplateArgument::ArgKind::Type) {
2010-
Args.push_back(Arg.getAsType());
2011-
} else {
2012-
llvm_unreachable("Unexpected kind");
2013-
}
2014-
}
2002+
for (const auto &Arg : VD->getTemplateArgs().asArray())
2003+
Args.push_back(Arg.getAsType());
20152004
return {{Trait.value(), std::move(Args)}};
20162005
}
20172006

@@ -2284,60 +2273,6 @@ static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef,
22842273
}
22852274
}
22862275

2287-
static void DiagnoseNonConstructibleReason(
2288-
Sema &SemaRef, SourceLocation Loc,
2289-
const llvm::SmallVector<clang::QualType, 1> &Ts) {
2290-
if (Ts.empty()) {
2291-
return;
2292-
}
2293-
2294-
bool ContainsVoid = false;
2295-
for (const QualType &ArgTy : Ts) {
2296-
ContainsVoid |= ArgTy->isVoidType();
2297-
}
2298-
2299-
if (ContainsVoid)
2300-
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2301-
<< diag::TraitNotSatisfiedReason::CVVoidType;
2302-
2303-
QualType T = Ts[0];
2304-
if (T->isFunctionType())
2305-
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2306-
<< diag::TraitNotSatisfiedReason::FunctionType;
2307-
2308-
if (T->isIncompleteArrayType())
2309-
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2310-
<< diag::TraitNotSatisfiedReason::IncompleteArrayType;
2311-
2312-
const CXXRecordDecl *D = T->getAsCXXRecordDecl();
2313-
if (!D || D->isInvalidDecl() || !D->hasDefinition())
2314-
return;
2315-
2316-
llvm::BumpPtrAllocator OpaqueExprAllocator;
2317-
SmallVector<Expr *, 2> ArgExprs;
2318-
ArgExprs.reserve(Ts.size() - 1);
2319-
for (unsigned I = 1, N = Ts.size(); I != N; ++I) {
2320-
QualType ArgTy = Ts[I];
2321-
if (ArgTy->isObjectType() || ArgTy->isFunctionType())
2322-
ArgTy = SemaRef.Context.getRValueReferenceType(ArgTy);
2323-
ArgExprs.push_back(
2324-
new (OpaqueExprAllocator.Allocate<OpaqueValueExpr>())
2325-
OpaqueValueExpr(Loc, ArgTy.getNonLValueExprType(SemaRef.Context),
2326-
Expr::getValueKindForType(ArgTy)));
2327-
}
2328-
2329-
EnterExpressionEvaluationContext Unevaluated(
2330-
SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
2331-
Sema::ContextRAII TUContext(SemaRef,
2332-
SemaRef.Context.getTranslationUnitDecl());
2333-
InitializedEntity To(InitializedEntity::InitializeTemporary(T));
2334-
InitializationKind InitKind(InitializationKind::CreateDirect(Loc, Loc, Loc));
2335-
InitializationSequence Init(SemaRef, To, InitKind, ArgExprs);
2336-
2337-
Init.Diagnose(SemaRef, To, InitKind, ArgExprs);
2338-
SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D;
2339-
}
2340-
23412276
static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef,
23422277
SourceLocation Loc, QualType T) {
23432278
SemaRef.Diag(Loc, diag::note_unsatisfied_trait)
@@ -2624,9 +2559,6 @@ void Sema::DiagnoseTypeTraitDetails(const Expr *E) {
26242559
case UTT_IsStandardLayout:
26252560
DiagnoseNonStandardLayoutReason(*this, E->getBeginLoc(), Args[0]);
26262561
break;
2627-
case TT_IsConstructible:
2628-
DiagnoseNonConstructibleReason(*this, E->getBeginLoc(), Args);
2629-
break;
26302562
default:
26312563
break;
26322564
}

0 commit comments

Comments
 (0)