@@ -1615,6 +1615,18 @@ class Sema final {
1615
1615
1616
1616
void emitAndClearUnusedLocalTypedefWarnings();
1617
1617
1618
+ private:
1619
+ /// Function or variable declarations to be checked for whether the deferred
1620
+ /// diagnostics should be emitted.
1621
+ SmallVector<Decl *, 4> DeclsToCheckForDeferredDiags;
1622
+
1623
+ public:
1624
+ // Emit all deferred diagnostics.
1625
+ void emitDeferredDiags();
1626
+ // Emit any deferred diagnostics for FD and erase them from the map in which
1627
+ // they're stored.
1628
+ void emitDeferredDiags(FunctionDecl *FD, bool ShowCallStack);
1629
+
1618
1630
enum TUFragmentKind {
1619
1631
/// The global module fragment, between 'module;' and a module-declaration.
1620
1632
Global,
@@ -3901,7 +3913,8 @@ class Sema final {
3901
3913
TemplateDiscarded, // Discarded due to uninstantiated templates
3902
3914
Unknown,
3903
3915
};
3904
- FunctionEmissionStatus getEmissionStatus(FunctionDecl *Decl);
3916
+ FunctionEmissionStatus getEmissionStatus(FunctionDecl *Decl,
3917
+ bool Final = false);
3905
3918
3906
3919
// Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check.
3907
3920
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee);
@@ -9925,22 +9938,10 @@ class Sema final {
9925
9938
/// Pop OpenMP function region for non-capturing function.
9926
9939
void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
9927
9940
9928
- /// Check whether we're allowed to call Callee from the current function.
9929
- void checkOpenMPDeviceFunction(SourceLocation Loc, FunctionDecl *Callee,
9930
- bool CheckForDelayedContext = true);
9931
-
9932
- /// Check whether we're allowed to call Callee from the current function.
9933
- void checkOpenMPHostFunction(SourceLocation Loc, FunctionDecl *Callee,
9934
- bool CheckCaller = true);
9935
-
9936
9941
/// Check if the expression is allowed to be used in expressions for the
9937
9942
/// OpenMP devices.
9938
9943
void checkOpenMPDeviceExpr(const Expr *E);
9939
9944
9940
- /// Finishes analysis of the deferred functions calls that may be declared as
9941
- /// host/nohost during device/host compilation.
9942
- void finalizeOpenMPDelayedAnalysis();
9943
-
9944
9945
/// Checks if a type or a declaration is disabled due to the owning extension
9945
9946
/// being disabled, and emits diagnostic messages if it is disabled.
9946
9947
/// \param D type or declaration to be checked.
@@ -10131,6 +10132,11 @@ class Sema final {
10131
10132
void
10132
10133
checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D,
10133
10134
SourceLocation IdLoc = SourceLocation());
10135
+ /// Finishes analysis of the deferred functions calls that may be declared as
10136
+ /// host/nohost during device/host compilation.
10137
+ void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller,
10138
+ const FunctionDecl *Callee,
10139
+ SourceLocation Loc);
10134
10140
/// Return true inside OpenMP declare target region.
10135
10141
bool isInOpenMPDeclareTargetContext() const {
10136
10142
return DeclareTargetNestingLevel > 0;
@@ -11517,18 +11523,6 @@ class Sema final {
11517
11523
/* Caller = */ FunctionDeclAndLoc>
11518
11524
DeviceKnownEmittedFns;
11519
11525
11520
- /// A partial call graph maintained during CUDA/OpenMP device code compilation
11521
- /// to support deferred diagnostics.
11522
- ///
11523
- /// Functions are only added here if, at the time they're considered, they are
11524
- /// not known-emitted. As soon as we discover that a function is
11525
- /// known-emitted, we remove it and everything it transitively calls from this
11526
- /// set and add those functions to DeviceKnownEmittedFns.
11527
- llvm::DenseMap</* Caller = */ CanonicalDeclPtr<FunctionDecl>,
11528
- /* Callees = */ llvm::MapVector<CanonicalDeclPtr<FunctionDecl>,
11529
- SourceLocation>>
11530
- DeviceCallGraph;
11531
-
11532
11526
/// Diagnostic builder for CUDA/OpenMP devices errors which may or may not be
11533
11527
/// deferred.
11534
11528
///
@@ -11603,14 +11597,6 @@ class Sema final {
11603
11597
llvm::Optional<unsigned> PartialDiagId;
11604
11598
};
11605
11599
11606
- /// Indicate that this function (and thus everything it transtively calls)
11607
- /// will be codegen'ed, and emit any deferred diagnostics on this function and
11608
- /// its (transitive) callees.
11609
- void markKnownEmitted(
11610
- Sema &S, FunctionDecl *OrigCaller, FunctionDecl *OrigCallee,
11611
- SourceLocation OrigLoc,
11612
- const llvm::function_ref<bool(Sema &, FunctionDecl *)> IsKnownEmitted);
11613
-
11614
11600
/// Creates a DeviceDiagBuilder that emits the diagnostic if the current context
11615
11601
/// is "used as device code".
11616
11602
///
@@ -12478,10 +12464,11 @@ class Sema final {
12478
12464
/// codegen'ed yet.
12479
12465
bool checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee);
12480
12466
12481
- /// Emit diagnostic that can't be emitted with deferred diagnostics mechanism.
12482
- /// At this step we imply that all device functions are marked with
12483
- /// sycl_device attribute.
12484
- void finalizeSYCLDelayedAnalysis();
12467
+ /// Finishes analysis of the deferred functions calls that may be declared as
12468
+ /// host during device compilation.
12469
+ void finalizeSYCLDelayedAnalysis(const FunctionDecl *Caller,
12470
+ const FunctionDecl *Callee,
12471
+ SourceLocation Loc);
12485
12472
};
12486
12473
12487
12474
template <typename AttrType>
0 commit comments