summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-03-20 21:06:02 +0000
committerTed Kremenek <kremenek@apple.com>2010-03-20 21:06:02 +0000
commit918fe8498dfd72fc484dbf6432aa524aa4f45ec3 (patch)
tree1bdd2e97716ac8353bd5ee06a8e67e6487eac215 /clang/lib/Sema/SemaExpr.cpp
parentfebf6ab718bcb41c00c060a5320d449faaf88d26 (diff)
downloadbcm5719-llvm-918fe8498dfd72fc484dbf6432aa524aa4f45ec3.tar.gz
bcm5719-llvm-918fe8498dfd72fc484dbf6432aa524aa4f45ec3.zip
Refactor CFG-based warnings in Sema to be run by a worked object called AnalysisBasedWarnings.
This object controls when the warnings are executed, allowing the client code in Sema to selectively disable warnings as needed. Centralizing the logic for analysis-based warnings allows us to optimize when and how they are run. Along the way, remove the redundant logic for the 'check fall-through' warning for blocks; now the same logic is used for both blocks and functions. llvm-svn: 99085
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 28f921dacaf..fe6f3b9f560 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -14,7 +14,7 @@
#include "Sema.h"
#include "SemaInit.h"
#include "Lookup.h"
-#include "clang/Analysis/AnalysisContext.h"
+#include "AnalysisBasedWarnings.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
@@ -7003,9 +7003,10 @@ Sema::OwningExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
return ExprError();
}
- AnalysisContext AC(BSI->TheDecl);
- CheckFallThroughForBlock(BlockTy, BSI->TheDecl->getBody(), AC);
- CheckUnreachable(AC);
+ // Issue any analysis-based warnings.
+ sema::AnalysisBasedWarnings W(*this);
+ W.IssueWarnings(BSI->TheDecl, BlockTy);
+
Expr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy,
BSI->hasBlockDeclRefExprs);
PopFunctionOrBlockScope();
OpenPOWER on IntegriCloud