Skip to content
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

Control flow analysis is missing for Obj-C @​try/@catch/@finally, -Wreturn-type not produced #46038

Open
jtbandes opened this issue Jul 12, 2020 · 5 comments
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer objective-c

Comments

@jtbandes
Copy link
Member

Bugzilla Link 46693
Version trunk
OS All
CC @comanea,@nico,@zygoloid

Extended Description

Symptom: an Objective-C method declared as returning non-void, but without a return statement, produces no warning if the method contains an Obj-C exception handling block.

  • (int)foo {
    // Missing return, -Wreturn-type is produced
    }

  • (int)bar {
    @​try { }
    @​finally { }
    // Missing return but no warning!
    }

Root cause:
CFGBuilder simply does not have an implementation for ObjCAtTryStmt, ObjCAtCatchStmt, etc. It's been missing for 11 years.

There was briefly partial support:
89cc8ea

But it was removed:
89be652

@jtbandes
Copy link
Member Author

Credit to @​isaiah for noticing this bug! https://twitter.com/isaiah/status/1279289964702957568

@nico
Copy link
Contributor

nico commented Oct 22, 2021

https://reviews.llvm.org/D112287 implements some of this.

@comanea
Copy link
Mannequin

comanea mannequin commented Nov 22, 2021

There may have been a bug introduced by the change Jacob mentioned. llvm/llvm-bugzilla-archive#52473

There is a superfluous warning that appears when return statements are after the try statement.

@comanea
Copy link
Mannequin

comanea mannequin commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#52473

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@Endilll Endilll added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer objective-c and removed clang Clang issues not falling into any other category labels May 22, 2023
@Endilll
Copy link
Contributor

Endilll commented May 22, 2023

Still no diagnostics as of Clang 16:
https://godbolt.org/z/nxY3hfKhb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer objective-c
Projects
None yet
Development

No branches or pull requests

3 participants