Skip to content

Commit fd6c5fb

Browse files
authored
Merge branch 'main' into make-hugify-available-aarhc64
2 parents a7eb94d + abdbaff commit fd6c5fb

File tree

783 files changed

+15942
-15683
lines changed

Some content is hidden

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

783 files changed

+15942
-15683
lines changed

.ci/metrics/metrics.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,24 @@ def github_get_metrics(
168168
created_at = job.created_at
169169
started_at = job.started_at
170170
completed_at = job.completed_at
171-
queue_time = started_at - created_at
172-
run_time = completed_at - started_at
171+
172+
# GitHub API can return results where the started_at is slightly
173+
# later then the created_at (or completed earlier than started).
174+
# This would cause a -23h59mn delta, which will show up as +24h
175+
# queue/run time on grafana.
176+
if started_at < created_at:
177+
logging.info(
178+
"Workflow {} started before being created.".format(task.id)
179+
)
180+
queue_time = datetime.timedelta(seconds=0)
181+
else:
182+
queue_time = started_at - created_at
183+
if completed_at < started_at:
184+
logging.info("Workflow {} finished before starting.".format(task.id))
185+
run_time = datetime.timedelta(seconds=0)
186+
else:
187+
run_time = completed_at - started_at
188+
173189
if run_time.seconds == 0:
174190
continue
175191

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ Bug Fixes to Attribute Support
292292
Bug Fixes to C++ Support
293293
^^^^^^^^^^^^^^^^^^^^^^^^
294294

295+
- Clang now diagnoses copy constructors taking the class by value in template instantiations. (#GH130866)
295296
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
296297
- Clang now prints the correct instantiation context for diagnostics suppressed
297298
by template argument deduction.
@@ -308,6 +309,7 @@ Bug Fixes to C++ Support
308309
not in the last position.
309310
- Clang now correctly parses ``if constexpr`` expressions in immediate function context. (#GH123524)
310311
- Fixed an assertion failure affecting code that uses C++23 "deducing this". (#GH130272)
312+
- Clang now properly instantiates destructors for initialized members within non-delegating constructors. (#GH93251)
311313

312314
Bug Fixes to AST Handling
313315
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -357,6 +359,10 @@ Android Support
357359
Windows Support
358360
^^^^^^^^^^^^^^^
359361

362+
- Clang now defines ``_CRT_USE_BUILTIN_OFFSETOF`` macro in MSVC-compatible mode,
363+
which makes ``offsetof`` provided by Microsoft's ``<stddef.h>`` to be defined
364+
correctly. (#GH59689)
365+
360366
LoongArch Support
361367
^^^^^^^^^^^^^^^^^
362368

clang/docs/analyzer/checkers.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3476,6 +3476,24 @@ Limitations:
34763476
alpha.WebKit
34773477
^^^^^^^^^^^^
34783478
3479+
alpha.webkit.ForwardDeclChecker
3480+
"""""""""""""""""""""""""""""""
3481+
Check for local variables, member variables, and function arguments that are forward declared.
3482+
3483+
.. code-block:: cpp
3484+
3485+
struct Obj;
3486+
Obj* provide();
3487+
3488+
struct Foo {
3489+
Obj* ptr; // warn
3490+
};
3491+
3492+
void foo() {
3493+
Obj* obj = provide(); // warn
3494+
consume(obj); // warn
3495+
}
3496+
34793497
.. _alpha-webkit-NoUncheckedPtrMemberChecker:
34803498
34813499
alpha.webkit.MemoryUnsafeCastChecker
@@ -3779,6 +3797,26 @@ Here are some examples of situations that we warn about as they *might* be poten
37793797
NSObject* unretained = retained.get(); // warn
37803798
}
37813799
3800+
webkit.RetainPtrCtorAdoptChecker
3801+
""""""""""""""""""""""""""""""""
3802+
The goal of this rule is to make sure the constructor of RetainPtr as well as adoptNS and adoptCF are used correctly.
3803+
When creating a RetainPtr with +1 semantics, adoptNS or adoptCF should be used, and in +0 semantics, RetainPtr constructor should be used.
3804+
Warn otherwise.
3805+
3806+
These are examples of cases that we consider correct:
3807+
3808+
.. code-block:: cpp
3809+
3810+
RetainPtr ptr = adoptNS([[NSObject alloc] init]); // ok
3811+
RetainPtr ptr = CGImageGetColorSpace(image); // ok
3812+
3813+
Here are some examples of cases that we consider incorrect use of RetainPtr constructor and adoptCF
3814+
3815+
.. code-block:: cpp
3816+
3817+
RetainPtr ptr = [[NSObject alloc] init]; // warn
3818+
auto ptr = adoptCF(CGImageGetColorSpace(image)); // warn
3819+
37823820
Debug Checkers
37833821
---------------
37843822

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct MissingFeatures {
8383
static bool emitNullabilityCheck() { return false; }
8484
static bool astVarDeclInterface() { return false; }
8585
static bool stackSaveOp() { return false; }
86+
static bool aggValueSlot() { return false; }
8687
};
8788

8889
} // namespace cir

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5451,7 +5451,8 @@ class Sema final : public SemaBase {
54515451
/// destructor is referenced.
54525452
void MarkVirtualBaseDestructorsReferenced(
54535453
SourceLocation Location, CXXRecordDecl *ClassDecl,
5454-
llvm::SmallPtrSetImpl<const RecordType *> *DirectVirtualBases = nullptr);
5454+
llvm::SmallPtrSetImpl<const CXXRecordDecl *> *DirectVirtualBases =
5455+
nullptr);
54555456

54565457
/// Do semantic checks to allow the complete destructor variant to be emitted
54575458
/// when the destructor is defined in another translation unit. In the Itanium

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,10 @@ def UncountedLambdaCapturesChecker : Checker<"UncountedLambdaCapturesChecker">,
17611761

17621762
let ParentPackage = WebKitAlpha in {
17631763

1764+
def ForwardDeclChecker : Checker<"ForwardDeclChecker">,
1765+
HelpText<"Check for forward declared local or member variables and function arguments">,
1766+
Documentation<HasDocumentation>;
1767+
17641768
def MemoryUnsafeCastChecker : Checker<"MemoryUnsafeCastChecker">,
17651769
HelpText<"Check for memory unsafe casts from base type to derived type.">,
17661770
Documentation<HasDocumentation>;
@@ -1801,4 +1805,8 @@ def UnretainedLocalVarsChecker : Checker<"UnretainedLocalVarsChecker">,
18011805
HelpText<"Check unretained local variables.">,
18021806
Documentation<HasDocumentation>;
18031807

1808+
def RetainPtrCtorAdoptChecker : Checker<"RetainPtrCtorAdoptChecker">,
1809+
HelpText<"Check for correct use of RetainPtr constructor, adoptNS, and adoptCF">,
1810+
Documentation<HasDocumentation>;
1811+
18041812
} // end alpha.webkit

clang/lib/Basic/Targets/OSTargets.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) {
220220
Builder.defineMacro("_MSC_FULL_VER", Twine(Opts.MSCompatibilityVersion));
221221
// FIXME We cannot encode the revision information into 32-bits
222222
Builder.defineMacro("_MSC_BUILD", Twine(1));
223+
// Exposed by MSVC, used in their stddef.h.
224+
Builder.defineMacro("_CRT_USE_BUILTIN_OFFSETOF", Twine(1));
223225

224226
if (Opts.CPlusPlus11 && Opts.isCompatibleWithMSVC(LangOptions::MSVC2015))
225227
Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1));

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,34 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) {
165165
return LValue();
166166
}
167167

168+
/// Emit code to compute the specified expression which
169+
/// can have any type. The result is returned as an RValue struct.
170+
RValue CIRGenFunction::emitAnyExpr(const Expr *e) {
171+
switch (CIRGenFunction::getEvaluationKind(e->getType())) {
172+
case cir::TEK_Scalar:
173+
return RValue::get(emitScalarExpr(e));
174+
case cir::TEK_Complex:
175+
cgm.errorNYI(e->getSourceRange(), "emitAnyExpr: complex type");
176+
return RValue::get(nullptr);
177+
case cir::TEK_Aggregate:
178+
cgm.errorNYI(e->getSourceRange(), "emitAnyExpr: aggregate type");
179+
return RValue::get(nullptr);
180+
}
181+
llvm_unreachable("bad evaluation kind");
182+
}
183+
184+
/// Emit code to compute the specified expression, ignoring the result.
185+
void CIRGenFunction::emitIgnoredExpr(const Expr *e) {
186+
if (e->isPRValue()) {
187+
assert(!cir::MissingFeatures::aggValueSlot());
188+
emitAnyExpr(e);
189+
return;
190+
}
191+
192+
// Just emit it as an l-value and drop the result.
193+
emitLValue(e);
194+
}
195+
168196
mlir::Value CIRGenFunction::emitAlloca(StringRef name, mlir::Type ty,
169197
mlir::Location loc,
170198
CharUnits alignment) {

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ class CIRGenFunction : public CIRGenTypeCache {
154154

155155
const clang::LangOptions &getLangOpts() const { return cgm.getLangOpts(); }
156156

157+
/// Emit code to compute the specified expression which can have any type. The
158+
/// result is returned as an RValue struct. If this is an aggregate
159+
/// expression, the aggloc/agglocvolatile arguments indicate where the result
160+
/// should be returned.
161+
RValue emitAnyExpr(const clang::Expr *e);
162+
157163
void finishFunction(SourceLocation endLoc);
158164
mlir::LogicalResult emitFunctionBody(const clang::Stmt *body);
159165

@@ -170,6 +176,10 @@ class CIRGenFunction : public CIRGenTypeCache {
170176

171177
void emitCompoundStmtWithoutScope(const clang::CompoundStmt &s);
172178

179+
/// Emit code to compute the specified expression,
180+
/// ignoring the result.
181+
void emitIgnoredExpr(const clang::Expr *e);
182+
173183
mlir::LogicalResult emitDeclStmt(const clang::DeclStmt &s);
174184

175185
mlir::LogicalResult emitReturnStmt(const clang::ReturnStmt &s);

clang/lib/CIR/CodeGen/CIRGenStmt.cpp

Lines changed: 158 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,160 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s,
5555
if (mlir::succeeded(emitSimpleStmt(s, useCurrentScope)))
5656
return mlir::success();
5757

58-
// Only a subset of simple statements are supported at the moment. When more
59-
// kinds of statements are supported, a
60-
// switch (s->getStmtClass()) {
61-
// will be added here.
62-
return mlir::failure();
58+
switch (s->getStmtClass()) {
59+
60+
#define STMT(Type, Base)
61+
#define ABSTRACT_STMT(Op)
62+
#define EXPR(Type, Base) case Stmt::Type##Class:
63+
#include "clang/AST/StmtNodes.inc"
64+
{
65+
// Remember the block we came in on.
66+
mlir::Block *incoming = builder.getInsertionBlock();
67+
assert(incoming && "expression emission must have an insertion point");
68+
69+
emitIgnoredExpr(cast<Expr>(s));
70+
71+
mlir::Block *outgoing = builder.getInsertionBlock();
72+
assert(outgoing && "expression emission cleared block!");
73+
return mlir::success();
74+
}
75+
76+
case Stmt::OMPScopeDirectiveClass:
77+
case Stmt::OMPErrorDirectiveClass:
78+
case Stmt::NoStmtClass:
79+
case Stmt::CXXCatchStmtClass:
80+
case Stmt::SEHExceptStmtClass:
81+
case Stmt::SEHFinallyStmtClass:
82+
case Stmt::MSDependentExistsStmtClass:
83+
case Stmt::NullStmtClass:
84+
case Stmt::CompoundStmtClass:
85+
case Stmt::DeclStmtClass:
86+
case Stmt::LabelStmtClass:
87+
case Stmt::AttributedStmtClass:
88+
case Stmt::GotoStmtClass:
89+
case Stmt::BreakStmtClass:
90+
case Stmt::ContinueStmtClass:
91+
case Stmt::DefaultStmtClass:
92+
case Stmt::CaseStmtClass:
93+
case Stmt::SEHLeaveStmtClass:
94+
case Stmt::SYCLKernelCallStmtClass:
95+
case Stmt::IfStmtClass:
96+
case Stmt::SwitchStmtClass:
97+
case Stmt::ForStmtClass:
98+
case Stmt::WhileStmtClass:
99+
case Stmt::DoStmtClass:
100+
case Stmt::CoroutineBodyStmtClass:
101+
case Stmt::CoreturnStmtClass:
102+
case Stmt::CXXTryStmtClass:
103+
case Stmt::CXXForRangeStmtClass:
104+
case Stmt::IndirectGotoStmtClass:
105+
case Stmt::ReturnStmtClass:
106+
case Stmt::GCCAsmStmtClass:
107+
case Stmt::MSAsmStmtClass:
108+
case Stmt::OMPParallelDirectiveClass:
109+
case Stmt::OMPTaskwaitDirectiveClass:
110+
case Stmt::OMPTaskyieldDirectiveClass:
111+
case Stmt::OMPBarrierDirectiveClass:
112+
case Stmt::CapturedStmtClass:
113+
case Stmt::ObjCAtTryStmtClass:
114+
case Stmt::ObjCAtThrowStmtClass:
115+
case Stmt::ObjCAtSynchronizedStmtClass:
116+
case Stmt::ObjCForCollectionStmtClass:
117+
case Stmt::ObjCAutoreleasePoolStmtClass:
118+
case Stmt::SEHTryStmtClass:
119+
case Stmt::OMPMetaDirectiveClass:
120+
case Stmt::OMPCanonicalLoopClass:
121+
case Stmt::OMPSimdDirectiveClass:
122+
case Stmt::OMPTileDirectiveClass:
123+
case Stmt::OMPUnrollDirectiveClass:
124+
case Stmt::OMPForDirectiveClass:
125+
case Stmt::OMPForSimdDirectiveClass:
126+
case Stmt::OMPSectionsDirectiveClass:
127+
case Stmt::OMPSectionDirectiveClass:
128+
case Stmt::OMPSingleDirectiveClass:
129+
case Stmt::OMPMasterDirectiveClass:
130+
case Stmt::OMPCriticalDirectiveClass:
131+
case Stmt::OMPParallelForDirectiveClass:
132+
case Stmt::OMPParallelForSimdDirectiveClass:
133+
case Stmt::OMPParallelMasterDirectiveClass:
134+
case Stmt::OMPParallelSectionsDirectiveClass:
135+
case Stmt::OMPTaskDirectiveClass:
136+
case Stmt::OMPTaskgroupDirectiveClass:
137+
case Stmt::OMPFlushDirectiveClass:
138+
case Stmt::OMPDepobjDirectiveClass:
139+
case Stmt::OMPScanDirectiveClass:
140+
case Stmt::OMPOrderedDirectiveClass:
141+
case Stmt::OMPAtomicDirectiveClass:
142+
case Stmt::OMPTargetDirectiveClass:
143+
case Stmt::OMPTeamsDirectiveClass:
144+
case Stmt::OMPCancellationPointDirectiveClass:
145+
case Stmt::OMPCancelDirectiveClass:
146+
case Stmt::OMPTargetDataDirectiveClass:
147+
case Stmt::OMPTargetEnterDataDirectiveClass:
148+
case Stmt::OMPTargetExitDataDirectiveClass:
149+
case Stmt::OMPTargetParallelDirectiveClass:
150+
case Stmt::OMPTargetParallelForDirectiveClass:
151+
case Stmt::OMPTaskLoopDirectiveClass:
152+
case Stmt::OMPTaskLoopSimdDirectiveClass:
153+
case Stmt::OMPMaskedTaskLoopDirectiveClass:
154+
case Stmt::OMPMaskedTaskLoopSimdDirectiveClass:
155+
case Stmt::OMPMasterTaskLoopDirectiveClass:
156+
case Stmt::OMPMasterTaskLoopSimdDirectiveClass:
157+
case Stmt::OMPParallelGenericLoopDirectiveClass:
158+
case Stmt::OMPParallelMaskedDirectiveClass:
159+
case Stmt::OMPParallelMaskedTaskLoopDirectiveClass:
160+
case Stmt::OMPParallelMaskedTaskLoopSimdDirectiveClass:
161+
case Stmt::OMPParallelMasterTaskLoopDirectiveClass:
162+
case Stmt::OMPParallelMasterTaskLoopSimdDirectiveClass:
163+
case Stmt::OMPDistributeDirectiveClass:
164+
case Stmt::OMPDistributeParallelForDirectiveClass:
165+
case Stmt::OMPDistributeParallelForSimdDirectiveClass:
166+
case Stmt::OMPDistributeSimdDirectiveClass:
167+
case Stmt::OMPTargetParallelGenericLoopDirectiveClass:
168+
case Stmt::OMPTargetParallelForSimdDirectiveClass:
169+
case Stmt::OMPTargetSimdDirectiveClass:
170+
case Stmt::OMPTargetTeamsGenericLoopDirectiveClass:
171+
case Stmt::OMPTargetUpdateDirectiveClass:
172+
case Stmt::OMPTeamsDistributeDirectiveClass:
173+
case Stmt::OMPTeamsDistributeSimdDirectiveClass:
174+
case Stmt::OMPTeamsDistributeParallelForSimdDirectiveClass:
175+
case Stmt::OMPTeamsDistributeParallelForDirectiveClass:
176+
case Stmt::OMPTeamsGenericLoopDirectiveClass:
177+
case Stmt::OMPTargetTeamsDirectiveClass:
178+
case Stmt::OMPTargetTeamsDistributeDirectiveClass:
179+
case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass:
180+
case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
181+
case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass:
182+
case Stmt::OMPInteropDirectiveClass:
183+
case Stmt::OMPDispatchDirectiveClass:
184+
case Stmt::OMPGenericLoopDirectiveClass:
185+
case Stmt::OMPReverseDirectiveClass:
186+
case Stmt::OMPInterchangeDirectiveClass:
187+
case Stmt::OMPAssumeDirectiveClass:
188+
case Stmt::OMPMaskedDirectiveClass:
189+
case Stmt::OMPStripeDirectiveClass:
190+
case Stmt::OpenACCComputeConstructClass:
191+
case Stmt::OpenACCLoopConstructClass:
192+
case Stmt::OpenACCCombinedConstructClass:
193+
case Stmt::OpenACCDataConstructClass:
194+
case Stmt::OpenACCEnterDataConstructClass:
195+
case Stmt::OpenACCExitDataConstructClass:
196+
case Stmt::OpenACCHostDataConstructClass:
197+
case Stmt::OpenACCWaitConstructClass:
198+
case Stmt::OpenACCInitConstructClass:
199+
case Stmt::OpenACCShutdownConstructClass:
200+
case Stmt::OpenACCSetConstructClass:
201+
case Stmt::OpenACCUpdateConstructClass:
202+
case Stmt::OpenACCCacheConstructClass:
203+
case Stmt::OpenACCAtomicConstructClass:
204+
case Stmt::ObjCAtCatchStmtClass:
205+
case Stmt::ObjCAtFinallyStmtClass:
206+
cgm.errorNYI(s->getSourceRange(),
207+
std::string("emitStmt: ") + s->getStmtClassName());
208+
return mlir::failure();
209+
}
210+
211+
llvm_unreachable("Unexpected statement class");
63212
}
64213

65214
mlir::LogicalResult CIRGenFunction::emitSimpleStmt(const Stmt *s,
@@ -106,16 +255,11 @@ mlir::LogicalResult CIRGenFunction::emitReturnStmt(const ReturnStmt &s) {
106255
// this section will do nothing. But for now a ReturnOp is necessary.
107256
builder.create<ReturnOp>(loc);
108257
} else if (rv->getType()->isVoidType()) {
109-
// No return value. Emit the return expression for its side effects.
110-
// TODO(CIR): Once emitAnyExpr(e) has been upstreamed, get rid of the check
111-
// and just call emitAnyExpr(rv) here.
112-
if (CIRGenFunction::hasScalarEvaluationKind(rv->getType())) {
113-
emitScalarExpr(rv);
114-
} else {
115-
getCIRGenModule().errorNYI(s.getSourceRange(),
116-
"non-scalar function return type");
258+
// Make sure not to return anything, but evaluate the expression
259+
// for side effects.
260+
if (rv) {
261+
emitAnyExpr(rv);
117262
}
118-
builder.create<ReturnOp>(loc);
119263
} else if (fnRetTy->isReferenceType()) {
120264
getCIRGenModule().errorNYI(s.getSourceRange(),
121265
"function return type that is a reference");

0 commit comments

Comments
 (0)