4 Commits

Author SHA1 Message Date
Jinsong Ji
19aa4c854a
[NFC] Fix implicit-fallthrough warnings (#112825)
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on.
Built by GCC 11.

Fix warnings:

clang/lib/Sema/SemaFunctionEffects.cpp:1531:5: error: this statement may
fall through [-Werror=implicit-fallthrough=]
 1531 |     switch (DiffKind) {
      |     ^~~~~~
2024-10-18 11:42:57 +02:00
Doug Wyatt
cef66aa04d
[Clang] Diagnose additional ObjC statements as function effect violations (#112148)
Bug fix: `@autoreleasepool`, `@synchronized`, and `@finally` were not
being noticed and treated as function effect violations.

---------

Co-authored-by: Doug Wyatt <dwyatt@apple.com>
2024-10-14 17:49:30 +02:00
Doug Wyatt
4d218caa77
[Clang] [Sema] Effects: Correctly detect (x ? a : b) as nonblocking when a and b are (#111224)
Correctly detect `(x ? a : b)` as nonblocking when `a` and `b` are. Use 
`FunctionEffectsRef::get` to get to the actual effect set instead of trying 
to retrieve it manually via the `FunctionProtoType` as we may have to 
look through function pointers etc. in some cases.

---------

Co-authored-by: Doug Wyatt <dwyatt@apple.com>
2024-10-08 10:20:05 +02:00
Doug Wyatt
7fe43ada28
[Clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (#99656)
- In Sema, when encountering Decls with function effects needing
verification, add them to a vector, DeclsWithEffectsToVerify.
- Update AST serialization to include DeclsWithEffectsToVerify.
- In AnalysisBasedWarnings, use DeclsWithEffectsToVerify as a work
queue, verifying functions with declared effects, and inferring (when
permitted and necessary) whether their callees have effects.

---------

Co-authored-by: Doug Wyatt <dwyatt@apple.com>
Co-authored-by: Sirraide <aeternalmail@gmail.com>
Co-authored-by: Erich Keane <ekeane@nvidia.com>
2024-10-03 02:14:51 +02:00