aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Checker
AgeCommit message (Collapse)Author
2010-12-22[analyzer] Refactoring: include/clang/Checker -> include/clang/GRArgyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20Rename 'VisitLocation' to 'visitLocation'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122271 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20Rename 'Generate[Node,Sink]' to 'generate[Node,Sink]'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17Move CocoaConventions.[h,cpp] from libCheckerTed Kremenek
to libAnalysis. Similar to Format (format string checking), CocoaConventions has the potential to serve clients other than the static analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122040 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17Rename several methods/functions in the analyzerTed Kremenek
to start with lowercase characters. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122035 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16Start migration of static analyzer to using theTed Kremenek
implicit lvalue-to-rvalue casts that John McCall recently introduced. This causes a whole bunch of logic in the analyzer for handling lvalues to vanish. It does, however, raise a few issues in the analyzer w.r.t to modeling various constructs (e.g., field accesses to compound literals). The .c/.m analysis test cases that fail are due to a missing lvalue-to-rvalue cast that will get introduced into the AST. The .cpp failures were more than I could investigate in one go, and the patch was already getting huge. I have XFAILED some of these tests, and they should obviously be further investigated. Some highlights of this patch include: - CFG no longer requires an lvalue bit for CFGElements - StackFrameContext doesn't need an 'asLValue' flag - The "VisitLValue" path from GRExprEngine has been eliminated. Besides the test case failures (XFAILed), there are surely other bugs that are fallout from this change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10Eliminate the branching in QualType::getTypePtr() by providing aDouglas Gregor
common base for ExtQuals and Type that stores the underlying type pointer. This results in a 2% performance win for -emit-llvm on a typical C file, with 1% memory growth in the AST. Note that there is an API change in this optimization: QualType::getTypePtr() can no longer be invoked on a NULL QualType. If the QualType might be NULL, use QualType::getTypePtrOrNull(). I've audited all uses of getTypePtr() in the code base and changed the appropriate uses over to getTypePtrOrNull(). A future optimization opportunity would be to distinguish between cast/dyn_cast and cast_or_null/dyn_cast_or_null; for the former, we could use getTypePtr() rather than getTypePtrOrNull(), to take another branch out of the cast/dyn_cast implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121489 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall
space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05Mark SVal constructors 'explicit'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120970 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05Rename Environment::LookupExpr() toTed Kremenek
Environment::lookupExpr() and move its implementation out-of-line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120969 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05Remove unused method GRState::LookupExpr().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120968 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04Minor refactoring; have BugReport::getRanges return a pair of iterator, no ↵Argyrios Kyrtzidis
functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03Fix an insidious bug in BugReporter whereTed Kremenek
a node in the trimmed graph might not always correctly map back to the original error node. This could cause a crash in some cases when flagging memory leaks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120795 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03Introduce TextPathDiagnostics, a simple PathDiagnosticClient that outputs as ↵Argyrios Kyrtzidis
diagnostic notes the sequence of events; useful for testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03Rename Create[*]DiagnosticClient -> create[*]DiagnosticClient.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02Merge ValueManager into SValBuilder.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename all 'AssumeXXX' methods in libCheckerTed Kremenek
to 'assumeXXX'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120614 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename all 'EvalXXX' methods in libChecker toTed Kremenek
'evalXXX'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename 'SValuator' to 'SValBuilder'. The new nameTed Kremenek
reflects what the class actually does. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120605 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29Merge System into Support.Michael J. Spencer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120297 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26Rename CXXObjectRegion to CXXTempObjectRegion.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26fix a bug introduced in r120173.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120175 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26Regionstore: support derived-to-base cast by creating a CXXBaseObjectRegion.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120173 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-25Add dump method.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24When getting CXXThisRegion from CXXMethodDecl, use the qualifiers. This is Zhongxing Xu
to be consistent with the type of 'this' expr in the method. 此行及以下内容将会被忽略-- M test/Analysis/method-call.cpp M include/clang/Checker/PathSensitive/GRExprEngine.h M lib/Checker/GRCXXExprEngine.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120094 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Let StackFrameContext represent if the call expr is evaluated as lvalue.Zhongxing Xu
This is required for supporting const reference to temporary objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120093 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Use StackFrameContext directly in CallEnter program point. Then we don't needZhongxing Xu
to remake the stackframe everytime in GRExprEngine::ProcessCallEnter(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Improve comments in Clang static analyzer, based on kremenek'sZhanyong Wan
explanation on how things work there. Reviewed by kremenek. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Adjust method calls to reflect name changes inTed Kremenek
ImmutableSet/ImmtuableMap/ImmutableList APIs. Along the way, clean up some method names in the static analyzer so that they are more descriptive and/or start with lowercase letters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120071 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20Handle CFGAutomaticObjDtor. Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18Added method for handling CXXOperatorCallExpr differently from CallExpr if ↵Marcin Swiderski
CXXOperatorCallExpr represents method call. Also fixed returning ExpolodedNodeSet from VisitCXXMethodCallExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17In EvalArguments allow for evaluation of first argument always as a lvalue. ↵Marcin Swiderski
Will be used for CXXOperatorCallExpr that represents method call. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119567 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17Add skeleton for handling various cfg dtors.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16Handle member initializer in C++ ctor. Zhongxing Xu
- Add a new Kind of ProgramPoint: PostInitializer. - Still use GRStmtNodeBuilder. But special handling PostInitializer in GRStmtNodeBuilder::GenerateAutoTransition(). - Someday we should clean up the interface of GRStmtNodeBuilder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119335 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Add skeleton for handling other kinds of CFGElements.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13Add GRWorkList::VisitItemsInWorkList() to allow a client to introspect the ↵Ted Kremenek
contents of a worklist. This API required changing the BFS worklist to use a deque instead of a queue, but that is better for performance reasons anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118982 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01Now initializer of C++ record type is visited as block-level expr. Zhongxing Xu
Let the destination of AggExprVisitor be an explicit MemRegion. Reenable the test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117908 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20Remove obsolete GRAuditor and GRSimpleAPICheck, which have been completely ↵Ted Kremenek
subsumed by the Checker interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30Added two new command line arguments:Marcin Swiderski
-cfg-add-implicit-dtors - sets CFG::BuildOptions::AddImplicitDtors for AnalysisCosumer to true, -cfg-add-initializers - sets CFG::BuildOptions::AddInitializers for AnalysisCosumer to true. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30Change CheckerVisitor so that [Pre,Post]VisitCallExpr only handles CallExprs ↵Ted Kremenek
for simple C functions, not all CallExprs (including CXXMemberCallExpr, etc.). Now the generic handler for all CallExprs is [Pre,Post]VisitGenericCallExpr. Also add [Pre,Post]Visit hooks for CXXMemberCallExpr. Change GRExprEngine::VisitCXXMemberCallExpr() to do pre/post checker visits of the call. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115119 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like ↵Ted Kremenek
VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114628 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16Refactored BugReporter to refer to EndNode as ErrorNode. We currently make ↵Tom Care
the assumption that EndNode == ErrorNode, but upcoming changes will break this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114065 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patchZhongxing Xu
and discussions with Ted and Jordy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114056 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15Disallow the use of UnknownVal as the index for ElementRegions. UnknownVals ↵Ted Kremenek
can be used as the index when the value evaluation isn't powerful enough. By creating ElementRegions with UnknownVals as the index, this gives the false impression that they are the same element, when they really aren't. This becomes really problematic when deriving symbols from these regions (e.g., those representing the initial value of the index), since two different indices will get the same symbol for their binding. This fixes an issue with the idempotent operations checker that would cause two indices that are clearly not the same to make it appear as if they always had the same value. Fixes <rdar://problem/8431728>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14Rename 'MaxLoop' to 'MaxVisit' in AnalysisManager to more correctly reflect ↵Tom Care
that we aborted analysis may not necessarily be due to a loop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10Add ObjCAtSynchronizedStmt to the CFG and add GRExprEngine support (PreVisit ↵Ted Kremenek
for checkers). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113572 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10Added AnalyzerStatsChecker, a path sensitive check that reports visitation ↵Tom Care
statistics about analysis. Running clang with the -analyzer-stats flag will emit warnings containing the information. We can then run a postanalysis script to take this data and give useful information about how much the analyzer missed in a project. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113568 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09Use FindReportInEquivalenceClass to identify all the nodes used for the ↵Ted Kremenek
trimmed graph (in BugReporter). This fixes a problem where a leak that happened to occur on both an exit() path and a non-exit() path was getting reported with the exit() path (which users don't care about). This fixes: <rdar://problem/8331641> leak reports should not show paths that end with exit() (but ones that don't end with exit()) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113524 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09Rename GRState::getSVal() -> getRawSVal() and getSimplifiedSVal() -> getSVal().Ted Kremenek
The end result is now we eagarly constant-fold symbols in the analyzer that are perfectly constrained to be a constant value. This allows us to recover some path-sensitivity in some cases by lowering the required level of reasoning power needed to evaluate some expressions. The net win from this change is that the false positive in PR 8015 is fixed, and we also find more idempotent operations bugs. We do, however, regress with the BugReporterVisitors, which need to be modified to understand this constant folding (and look past it). This causes some diagnostic regressions in plist-output.m which will get addressed in a future patch. plist-output.m is now marked XFAIL, while plist-output-alternate.m now tests that the plist output is working, but with the suboptimal diagnostics. This second test file will eventually be removed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113477 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09Static analyzer fix: <rdar://problem/5880430> Switch on enum should not ↵Ted Kremenek
consider default case live if all enum values are covered git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113457 91177308-0d34-0410-b5e6-96231b3b80d8