summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.h
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-07-22 23:56:57 +0000
committerMike Stump <mrs@apple.com>2009-07-22 23:56:57 +0000
commit33979f75a0fd85a29c3d0a70d4985a20773e8ece (patch)
treea296fe11dc38d403e333910aefe4eca6200b2f16 /clang/lib/Sema/Sema.h
parente93e46c69096c8f6ad9e61578955d60a0de59f1d (diff)
downloadbcm5719-llvm-33979f75a0fd85a29c3d0a70d4985a20773e8ece.tar.gz
bcm5719-llvm-33979f75a0fd85a29c3d0a70d4985a20773e8ece.zip
Add warning for falling off the end of a function that should return a
value. This is on by default, and controlled by -Wreturn-type (-Wmost -Wall). I believe there should be very few false positives, though the most interesting case would be: int() { bar(); } when bar does: bar() { while (1) ; } Here, we assume functions return, unless they are marked with the noreturn attribute. I can envision a fixit note for functions that never return normally that don't have a noreturn attribute to add a noreturn attribute. If anyone spots other false positives, let me know! llvm-svn: 76821
Diffstat (limited to 'clang/lib/Sema/Sema.h')
-rw-r--r--clang/lib/Sema/Sema.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index 78d64b53c09..3bb763a13f8 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -801,10 +801,14 @@ public:
SourceLocation MemberLoc,
IdentifierInfo &Member);
- /// Helpers for dealing with function parameters.
+ /// Helpers for dealing with functions.
+ void CheckFallThroughForFunctionDef(Decl *D, Stmt *Body);
bool CheckParmsForFunctionDef(FunctionDecl *FD);
void CheckCXXDefaultArguments(FunctionDecl *FD);
void CheckExtraCXXDefaultArguments(Declarator &D);
+ enum ControlFlowKind { NeverFallThrough = 0, MaybeFallThrough = 1,
+ AlwaysFallThrough = 2 };
+ ControlFlowKind CheckFallThrough(Stmt *);
Scope *getNonFieldDeclScope(Scope *S);
OpenPOWER on IntegriCloud