aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/StaticAnalyzer/EntoSA/AggExprVisitor.cpp63
-rw-r--r--lib/StaticAnalyzer/EntoSA/AnalysisManager.cpp32
-rw-r--r--lib/StaticAnalyzer/EntoSA/AnalyzerStatsChecker.cpp123
-rw-r--r--lib/StaticAnalyzer/EntoSA/BasicConstraintManager.cpp338
-rw-r--r--lib/StaticAnalyzer/EntoSA/BasicStore.cpp594
-rw-r--r--lib/StaticAnalyzer/EntoSA/BasicValueFactory.cpp290
-rw-r--r--lib/StaticAnalyzer/EntoSA/BlockCounter.cpp86
-rw-r--r--lib/StaticAnalyzer/EntoSA/BugReporter.cpp1892
-rw-r--r--lib/StaticAnalyzer/EntoSA/BugReporterVisitors.cpp457
-rw-r--r--lib/StaticAnalyzer/EntoSA/CFRefCount.cpp3500
-rw-r--r--lib/StaticAnalyzer/EntoSA/CMakeLists.txt41
-rw-r--r--lib/StaticAnalyzer/EntoSA/CXXExprEngine.cpp328
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checker.cpp36
-rw-r--r--lib/StaticAnalyzer/EntoSA/CheckerHelpers.cpp80
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/AdjustedReturnValueChecker.cpp96
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/AnalysisConsumer.cpp610
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ArrayBoundChecker.cpp91
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ArrayBoundCheckerV2.cpp277
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/AttrNonNullChecker.cpp136
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/BasicObjCFoundationChecks.cpp521
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/BasicObjCFoundationChecks.h36
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/BuiltinFunctionChecker.cpp83
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CMakeLists.txt53
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CStringChecker.cpp1048
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CallAndMessageChecker.cpp350
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CastSizeChecker.cpp91
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CastToStructChecker.cpp79
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CheckDeadStores.cpp290
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CheckObjCDealloc.cpp262
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CheckObjCInstMethSignature.cpp120
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CheckSecuritySyntaxOnly.cpp503
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/CheckSizeofPointer.cpp72
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ChrootChecker.cpp162
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/DereferenceChecker.cpp204
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/DivZeroChecker.cpp86
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ExprEngine.cpp3513
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ExprEngineExperimentalChecks.cpp46
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ExprEngineExperimentalChecks.h37
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ExprEngineInternalChecks.h59
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/FixedAddressChecker.cpp72
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/FrontendActions.cpp22
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/IdempotentOperationChecker.cpp834
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/LLVMConventionsChecker.cpp313
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/MacOSXAPIChecker.cpp142
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/Makefile17
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/MallocChecker.cpp733
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/NSAutoreleasePoolChecker.cpp87
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/NSErrorChecker.cpp238
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/NoReturnFunctionChecker.cpp80
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/OSAtomicChecker.cpp203
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ObjCAtSyncChecker.cpp95
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ObjCUnusedIVarsChecker.cpp164
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/PointerArithChecker.cpp72
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/PointerSubChecker.cpp79
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/PthreadLockChecker.cpp147
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ReturnPointerRangeChecker.cpp95
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/ReturnUndefChecker.cpp69
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/StackAddrLeakChecker.cpp205
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/StreamChecker.cpp466
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/UndefBranchChecker.cpp120
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/UndefCapturedBlockVarChecker.cpp102
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/UndefResultChecker.cpp87
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/UndefinedArraySubscriptChecker.cpp57
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/UndefinedAssignmentChecker.cpp94
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/UnixAPIChecker.cpp277
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/UnreachableCodeChecker.cpp223
-rw-r--r--lib/StaticAnalyzer/EntoSA/Checkers/VLASizeChecker.cpp138
-rw-r--r--lib/StaticAnalyzer/EntoSA/CoreEngine.cpp809
-rw-r--r--lib/StaticAnalyzer/EntoSA/Environment.cpp236
-rw-r--r--lib/StaticAnalyzer/EntoSA/ExplodedGraph.cpp282
-rw-r--r--lib/StaticAnalyzer/EntoSA/FlatStore.cpp203
-rw-r--r--lib/StaticAnalyzer/EntoSA/GRState.cpp551
-rw-r--r--lib/StaticAnalyzer/EntoSA/HTMLDiagnostics.cpp578
-rw-r--r--lib/StaticAnalyzer/EntoSA/Makefile19
-rw-r--r--lib/StaticAnalyzer/EntoSA/ManagerRegistry.cpp21
-rw-r--r--lib/StaticAnalyzer/EntoSA/MemRegion.cpp987
-rw-r--r--lib/StaticAnalyzer/EntoSA/PathDiagnostic.cpp279
-rw-r--r--lib/StaticAnalyzer/EntoSA/PlistDiagnostics.cpp472
-rw-r--r--lib/StaticAnalyzer/EntoSA/README.txt117
-rw-r--r--lib/StaticAnalyzer/EntoSA/RangeConstraintManager.cpp442
-rw-r--r--lib/StaticAnalyzer/EntoSA/RegionStore.cpp1875
-rw-r--r--lib/StaticAnalyzer/EntoSA/SValBuilder.cpp310
-rw-r--r--lib/StaticAnalyzer/EntoSA/SVals.cpp361
-rw-r--r--lib/StaticAnalyzer/EntoSA/SimpleConstraintManager.cpp303
-rw-r--r--lib/StaticAnalyzer/EntoSA/SimpleConstraintManager.h93
-rw-r--r--lib/StaticAnalyzer/EntoSA/SimpleSValBuilder.cpp884
-rw-r--r--lib/StaticAnalyzer/EntoSA/Store.cpp334
-rw-r--r--lib/StaticAnalyzer/EntoSA/SymbolManager.cpp343
-rw-r--r--lib/StaticAnalyzer/EntoSA/TextPathDiagnostics.cpp70
89 files changed, 0 insertions, 31485 deletions
diff --git a/lib/StaticAnalyzer/EntoSA/AggExprVisitor.cpp b/lib/StaticAnalyzer/EntoSA/AggExprVisitor.cpp
deleted file mode 100644
index 0cc23900ed..0000000000
--- a/lib/StaticAnalyzer/EntoSA/AggExprVisitor.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//=-- AggExprVisitor.cpp - evaluating expressions of C++ class type -*- 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 AggExprVisitor class, which contains lots of boiler
-// plate code for evaluating expressions of C++ class type.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/StaticAnalyzer/PathSensitive/ExprEngine.h"
-#include "clang/AST/StmtVisitor.h"
-
-using namespace clang;
-using namespace ento;
-
-namespace {
-/// AggExprVisitor is designed after AggExprEmitter of the CodeGen module. It
-/// is used for evaluating exprs of C++ object type. Evaluating such exprs
-/// requires a destination pointer pointing to the object being evaluated
-/// into. Passing such a pointer around would pollute the Visit* interface of
-/// ExprEngine. AggExprVisitor encapsulates code that goes through various
-/// cast and construct exprs (and others), and at the final point, dispatches
-/// back to the ExprEngine to let the real evaluation logic happen.
-class AggExprVisitor : public StmtVisitor<AggExprVisitor> {
- const MemRegion *Dest;
- ExplodedNode *Pred;
- ExplodedNodeSet &DstSet;
- ExprEngine &Eng;
-
-public:
- AggExprVisitor(const MemRegion *dest, ExplodedNode *N, ExplodedNodeSet &dst,
- ExprEngine &eng)
- : Dest(dest), Pred(N), DstSet(dst), Eng(eng) {}
-
- void VisitCastExpr(CastExpr *E);
- void VisitCXXConstructExpr(CXXConstructExpr *E);
-};
-}
-
-void AggExprVisitor::VisitCastExpr(CastExpr *E) {
- switch (E->getCastKind()) {
- default:
- assert(0 && "Unhandled cast kind");
- case CK_NoOp:
- case CK_ConstructorConversion:
- Visit(E->getSubExpr());
- break;
- }
-}
-
-void AggExprVisitor::VisitCXXConstructExpr(CXXConstructExpr *E) {
- Eng.VisitCXXConstructExpr(E, Dest, Pred, DstSet);
-}
-
-void ExprEngine::VisitAggExpr(const Expr *E, const MemRegion *Dest,
- ExplodedNode *Pred, ExplodedNodeSet &Dst) {
- AggExprVisitor(Dest, Pred, Dst, *this).Visit(const_cast<Expr *>(E));
-}
diff --git a/lib/StaticAnalyzer/EntoSA/AnalysisManager.cpp b/lib/StaticAnalyzer/EntoSA/AnalysisManager.cpp
deleted file mode 100644
index cc5e271393..0000000000
--- a/lib/StaticAnalyzer/EntoSA/AnalysisManager.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//===-- AnalysisManager.cpp -------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/StaticAnalyzer/PathSensitive/AnalysisManager.h"
-#include "clang/Index/Entity.h"
-#include "clang/Index/Indexer.h"
-
-using namespace clang;
-using namespace ento;
-
-AnalysisContext *
-AnalysisManager::getAnalysisContextInAnotherTU(const Decl *D) {
- idx::Entity Ent = idx::Entity::get(const_cast<Decl *>(D),
- Idxer->getProgram());
- FunctionDecl *FuncDef;
- idx::TranslationUnit *TU;
- llvm::tie(FuncDef, TU) = Idxer->getDefinitionFor(Ent);
-
- if (FuncDef == 0)
- return 0;
-
- // This AnalysisContext wraps function definition in another translation unit.
- // But it is still owned by the AnalysisManager associated with the current
- // translation unit.
- return AnaCtxMgr.getContext(FuncDef, TU);
-}
diff --git a/lib/StaticAnalyzer/EntoSA/AnalyzerStatsChecker.cpp b/lib/StaticAnalyzer/EntoSA/AnalyzerStatsChecker.cpp
deleted file mode 100644
index 8521c18c54..0000000000
--- a/lib/StaticAnalyzer/EntoSA/AnalyzerStatsChecker.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-//==--AnalyzerStatsChecker.cpp - Analyzer visitation statistics --*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// This file reports various statistics about analyzer visitation.
-//===----------------------------------------------------------------------===//
-
-#include "clang/StaticAnalyzer/PathSensitive/CheckerVisitor.h"
-#include "clang/StaticAnalyzer/PathSensitive/ExplodedGraph.h"
-#include "clang/StaticAnalyzer/BugReporter/BugReporter.h"
-
-// FIXME: Restructure checker registration.
-#include "Checkers/ExprEngineExperimentalChecks.h"
-
-#include "clang/Basic/SourceManager.h"
-#include "llvm/ADT/SmallPtrSet.h"
-
-using namespace clang;
-using namespace ento;
-
-namespace {
-class AnalyzerStatsChecker : public CheckerVisitor<AnalyzerStatsChecker> {
-public:
- static void *getTag();
- void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B, ExprEngine &Eng);
-
-private:
- llvm::SmallPtrSet<const CFGBlock*, 256> reachable;
-};
-}
-
-void *AnalyzerStatsChecker::getTag() {
- static int x = 0;
- return &x;
-}
-
-void ento::RegisterAnalyzerStatsChecker(ExprEngine &Eng) {
- Eng.registerCheck(new AnalyzerStatsChecker());
-}
-
-void AnalyzerStatsChecker::VisitEndAnalysis(ExplodedGraph &G,
- BugReporter &B,
- ExprEngine &Eng) {
- const CFG *C = 0;
- const Decl *D = 0;
- const LocationContext *LC = 0;
- const SourceManager &SM = B.getSourceManager();
-
- // Iterate over explodedgraph
- for (ExplodedGraph::node_iterator I = G.nodes_begin();
- I != G.nodes_end(); ++I) {
- const ProgramPoint &P = I->getLocation();
- // Save the LocationContext if we don't have it already
- if (!LC)
- LC = P.getLocationContext();
-
- if (const BlockEntrance *BE = dyn_cast<BlockEntrance>(&P)) {
- const CFGBlock *CB = BE->getBlock();
- reachable.insert(CB);
- }
- }
-
- // Get the CFG and the Decl of this block
- C = LC->getCFG();
- D = LC->getAnalysisContext()->getDecl();
-
- unsigned total = 0, unreachable = 0;
-
- // Find CFGBlocks that were not covered by any node
- for (CFG::const_iterator I = C->begin(); I != C->end(); ++I) {
- const CFGBlock *CB = *I;
- ++total;
- // Check if the block is unreachable
- if (!reachable.count(CB)) {
- ++unreachable;
- }
- }
-
- // We never 'reach' the entry block, so correct the unreachable count
- unreachable--;
-
- // Generate the warning string
- llvm::SmallString<128> buf;
- llvm::raw_svector_ostream output(buf);
- PresumedLoc Loc = SM.getPresumedLoc(D->getLocation());
- if (Loc.isValid()) {
- output << Loc.getFilename() << " : ";
-
- if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
- const NamedDecl *ND = cast<NamedDecl>(D);
- output << ND;
- }
- else if (isa<BlockDecl>(D)) {
- output << "block(line:" << Loc.getLine() << ":col:" << Loc.getColumn();
- }
- }
-
- output << " -> Total CFGBlocks: " << total << " | Unreachable CFGBlocks: "
- << unreachable << " | Aborted Block: "
- << (Eng.wasBlockAborted() ? "yes" : "no")
- << " | Empty WorkList: "
- << (Eng.hasEmptyWorkList() ? "yes" : "no");
-
- B.EmitBasicReport("Analyzer Statistics", "Internal Statistics", output.str(),
- D->getLocation());
-
- // Emit warning for each block we bailed out on
- typedef CoreEngine::BlocksAborted::const_iterator AbortedIterator;
- const CoreEngine &CE = Eng.getCoreEngine();
- for (AbortedIterator I = CE.blocks_aborted_begin(),
- E = CE.blocks_aborted_end(); I != E; ++I) {
- const BlockEdge &BE = I->first;
- const CFGBlock *Exit = BE.getDst();
- const CFGElement &CE = Exit->front();
- if (const CFGStmt *CS = dyn_cast<CFGStmt>(&CE))
- B.EmitBasicReport("Bailout Point", "Internal Statistics", "The analyzer "
- "stopped analyzing at this point", CS->getStmt()->getLocStart());
- }
-}
diff --git a/lib/StaticAnalyzer/EntoSA/BasicConstraintManager.cpp b/lib/StaticAnalyzer/EntoSA/BasicConstraintManager.cpp
deleted file mode 100644
index 8bdc4fa003..0000000000
--- a/lib/StaticAnalyzer/EntoSA/BasicConstraintManager.cpp
+++ /dev/null
@@ -1,338 +0,0 @@
-//== BasicConstraintManager.cpp - Manage basic constraints.------*- 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 BasicConstraintManager, a class that tracks simple
-// equality and inequality constraints on symbolic values of GRState.
-//
-//===----------------------------------------------------------------------===//
-
-#include "SimpleConstraintManager.h"
-#include "clang/StaticAnalyzer/PathSensitive/GRState.h"
-#include "clang/StaticAnalyzer/PathSensitive/GRStateTrait.h"
-#include "clang/StaticAnalyzer/PathSensitive/TransferFuncs.h"
-#include "llvm/Support/raw_ostream.h"
-
-using namespace clang;
-using namespace ento;
-
-
-namespace { class ConstNotEq {}; }
-namespace { class ConstEq {}; }
-
-typedef llvm::ImmutableMap<SymbolRef,GRState::IntSetTy> ConstNotEqTy;
-typedef llvm::ImmutableMap<SymbolRef,const llvm::APSInt*> ConstEqTy;
-
-static int ConstEqIndex = 0;
-static int ConstNotEqIndex = 0;
-
-namespace clang {
-namespace ento {
-template<>
-struct GRStateTrait<ConstNotEq> : public GRStatePartialTrait<ConstNotEqTy> {
- static inline void* GDMIndex() { return &ConstNotEqIndex; }