//=- AnalysisBasedWarnings.cpp - Sema warnings based on libAnalysis -*- C++ -*-=////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file defines analysis_warnings::[Policy,Executor].// Together they are used by Sema to issue warnings based on inexpensive// static analysis algorithms in libAnalysis.////===----------------------------------------------------------------------===//#include"clang/Sema/AnalysisBasedWarnings.h"#include"clang/Sema/SemaInternal.h"#include"clang/Sema/ScopeInfo.h"#include"clang/Basic/SourceManager.h"#include"clang/Basic/SourceLocation.h"#include"clang/Lex/Preprocessor.h"#include"clang/Lex/Lexer.h"#include"clang/AST/DeclObjC.h"#include"clang/AST/DeclCXX.h"#include"clang/AST/ExprObjC.h"#include"clang/AST/ExprCXX.h"#include"clang/AST/StmtObjC.h"#include"clang/AST/StmtCXX.h"#include"clang/AST/EvaluatedExprVisitor.h"#include"clang/AST/StmtVisitor.h"#include"clang/AST/RecursiveASTVisitor.h"#include"clang/Analysis/AnalysisContext.h"#include"clang/Analysis/CFG.h"#include"clang/Analysis/Analyses/ReachableCode.h"#include"clang/Analysis/Analyses/CFGReachabilityAnalysis.h"#include"clang/Analysis/Analyses/ThreadSafety.h"#include"clang/Analysis/CFGStmtMap.h"#include"clang/Analysis/Analyses/UninitializedValues.h"#include"llvm/ADT/BitVector.h"#include"llvm/ADT/FoldingSet.h"#include"llvm/ADT/ImmutableMap.h"#include"llvm/ADT/PostOrderIterator.h"#include"llvm/ADT/SmallVector.h"#include"llvm/ADT/StringRef.h"#include"llvm/Support/Casting.h"#include<algorithm>#include<iterator>#include<vector>#include<deque>usingnamespaceclang;//===----------------------------------------------------------------------===//// Unreachable code analysis.//===----------------------------------------------------------------------===//namespace{classUnreachableCodeHandler:publicreachable_code::Callback{Sema&S;public:UnreachableCodeHandler(Sema&s):S(s){}voidHandleUnreachable(SourceLocationL,SourceRangeR1,SourceRangeR2){S.Diag(L,diag::warn_unreachable)<<R1<<R2;}};}/// CheckUnreachable - Check for unreachable code.