-
Notifications
You must be signed in to change notification settings - Fork 15.2k
nonblocking/nonallocating attributes: 2nd pass caller/callee analysis #99656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
8c5f854
95b7a00
21c780a
ff10413
d472964
f1142db
efe1b93
d4f8dd5
7ffdbef
c39e28e
dec1a61
06ca4c5
9e45e6f
b99f784
dbdd8f8
1b9874f
b8818a3
8390e69
7acda8c
bffacc5
c718b5a
8b225f4
2cb4539
0e07315
47dfce8
fddd9d2
eb536ab
15b399f
dfebc1a
82cb07d
a7060ad
f93ee01
6cc0a62
69e1ae6
076302e
7b891c6
d1fcceb
abcf022
47ebf27
6650c1f
250b80b
e8bcd9f
ea7f3fc
d1a39e2
75365ef
6aadec0
9b123a6
ba57bfb
54feb05
93cb74e
d583c85
cda1a9c
9c971c6
b23e942
9bfbe12
f06909b
adcfd14
17320b8
909d7ff
9367103
eb782e0
eccc7cf
220a1bf
a8fef93
092bc16
ca3f44a
424a74b
273871a
a77d4e3
f8d9189
da725c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -873,30 +873,17 @@ class Sema final : public SemaBase { | |
| /// Warn when implicitly casting 0 to nullptr. | ||
| void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E); | ||
|
|
||
| // ----- function effects --- | ||
| /// All functions/lambdas/blocks which have bodies and which have a non-empty | ||
| /// FunctionEffectsRef to be verified. | ||
| SmallVector<const Decl *> DeclsWithEffectsToVerify; | ||
| /// The union of all effects present on DeclsWithEffectsToVerify. Conditions | ||
| /// are all null. | ||
| FunctionEffectSet AllEffectsToVerify; | ||
dougsonos marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// Warn when implicitly changing function effects. | ||
| void diagnoseFunctionEffectConversion(QualType DstType, QualType SrcType, | ||
| SourceLocation Loc); | ||
|
|
||
| /// Warn and return true if adding an effect to a set would create a conflict. | ||
| bool diagnoseConflictingFunctionEffect(const FunctionEffectsRef &FX, | ||
| const FunctionEffectWithCondition &EC, | ||
| SourceLocation NewAttrLoc); | ||
|
|
||
| // Report a failure to merge function effects between declarations due to a | ||
| // conflict. | ||
| void | ||
| diagnoseFunctionEffectMergeConflicts(const FunctionEffectSet::Conflicts &Errs, | ||
| SourceLocation NewLoc, | ||
| SourceLocation OldLoc); | ||
|
|
||
| /// Try to parse the conditional expression attached to an effect attribute | ||
| /// (e.g. 'nonblocking'). (c.f. Sema::ActOnNoexceptSpec). Return an empty | ||
| /// optional on error. | ||
| std::optional<FunctionEffectMode> | ||
| ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName); | ||
|
|
||
| /// makeUnavailableInSystemHeader - There is an error in the current | ||
| /// context. If we're still in a system header, and we can plausibly | ||
| /// make the relevant declaration unavailable instead of erroring, do | ||
|
|
@@ -4330,6 +4317,25 @@ class Sema final : public SemaBase { | |
| // Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check. | ||
| bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee); | ||
|
|
||
| /// Warn and return true if adding a function effect to a set would create a | ||
| /// conflict. | ||
| bool diagnoseConflictingFunctionEffect(const FunctionEffectsRef &FX, | ||
| const FunctionEffectWithCondition &EC, | ||
| SourceLocation NewAttrLoc); | ||
|
|
||
| // Report a failure to merge function effects between declarations due to a | ||
| // conflict. | ||
| void | ||
| diagnoseFunctionEffectMergeConflicts(const FunctionEffectSet::Conflicts &Errs, | ||
| SourceLocation NewLoc, | ||
| SourceLocation OldLoc); | ||
|
|
||
| /// Potentially add a FunctionDecl or BlockDecl to DeclsWithEffectsToVerify. | ||
| void maybeAddDeclWithEffects(const Decl *D, const FunctionEffectsRef &FX); | ||
|
|
||
| /// Unconditionally add a Decl to DeclsWithEfffectsToVerify. | ||
| void addDeclWithEffects(const Decl *D, const FunctionEffectsRef &FX); | ||
|
|
||
| private: | ||
| /// Function or variable declarations to be checked for whether the deferred | ||
| /// diagnostics should be emitted. | ||
|
|
@@ -15002,6 +15008,12 @@ class Sema final : public SemaBase { | |
| return hasAcceptableDefinition(D, &Hidden, Kind); | ||
| } | ||
|
|
||
| /// Try to parse the conditional expression attached to an effect attribute | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we still have the 'function effects' comment here? @Endilll ? |
||
| /// (e.g. 'nonblocking'). (c.f. Sema::ActOnNoexceptSpec). Return an empty | ||
| /// optional on error. | ||
| std::optional<FunctionEffectMode> | ||
| ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName); | ||
dougsonos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private: | ||
| /// The implementation of RequireCompleteType | ||
| bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -948,6 +948,9 @@ class ASTReader | |
| /// Sema tracks these to emit deferred diags. | ||
| llvm::SmallSetVector<GlobalDeclID, 4> DeclsToCheckForDeferredDiags; | ||
|
|
||
| /// The IDs of all decls with function effects to be checked. | ||
| SmallVector<GlobalDeclID, 0> DeclsWithEffectsToVerify; | ||
Sirraide marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| private: | ||
| struct ImportedSubmodule { | ||
| serialization::SubmoduleID ID; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.