From 918fe8498dfd72fc484dbf6432aa524aa4f45ec3 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 20 Mar 2010 21:06:02 +0000 Subject: 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 --- clang/lib/Sema/SemaExpr.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'clang/lib/Sema/SemaExpr.cpp') 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(); -- cgit v1.2.3