Commit Graph

56 Commits

Author SHA1 Message Date
Alexis Hunt ed05325dbe Convert DeclNodes to use TableGen.
The macros required for DeclNodes use have changed to match the use of
StmtNodes. The FooFirst enumerator constants have been named firstFoo
to match usage elsewhere.

llvm-svn: 105165
2010-05-30 07:21:58 +00:00
Douglas Gregor ecc60b99f9 Unbreak CMake build.
llvm-svn: 103077
2010-05-05 05:41:05 +00:00
Ted Kremenek 7296de9ae3 Start moving some of the logic for the unreachable code analysis out of libSema
and into libAnalysis.

llvm-svn: 96872
2010-02-23 02:39:16 +00:00
Ted Kremenek a2e77b41f3 Add skeleton for a more structured way to analyzing pring format
strings than what we currently have in Sema.  This is both an
experiment and a WIP.

The idea is simple: parse the format string incrementally,
constructing a well-structure representation of each format specifier.
Each format specifier is then handed back one-by-one to a client via a
callback.  Malformed format strings are also handled with callbacks.
The idea is to separate the parsing of the format string from the
emission of diagnostics.  Currently what we have in Sema for handling
format strings is a mongrel of both that is hard to follow and
difficult to modify (I can apply this label since I'm the original
author of that code).

This is in libAnalysis as it is reasonable generic and can potentially
be used both by libSema and libChecker.

Comments welcome.

llvm-svn: 94702
2010-01-27 23:43:25 +00:00
Ted Kremenek d6b8708643 Split libAnalysis into two libraries: libAnalysis and libChecker.
(1) libAnalysis is a generic analysis library that can be used by
    Sema.  It defines the CFG, basic dataflow analysis primitives, and
    inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
    path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker.  More changes pending.  :)

This change also exposed a layering violation between AnalysisContext
and MemRegion.  BlockInvocationContext shouldn't explicitly know about
BlockDataRegions.  For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet).  We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.

llvm-svn: 94406
2010-01-25 04:41:41 +00:00
Zhongxing Xu 1042bf4ae2 Refactor OSAtomic evaluation logic into OSAtomicChecker.
llvm-svn: 90968
2009-12-09 12:23:28 +00:00
Zhongxing Xu fe2f901269 Refactor builtin function evaluation into a checker.
llvm-svn: 90847
2009-12-08 09:07:59 +00:00
Zhongxing Xu 175447f743 Add EvalCallExpr interface to checker, and migrate the no-return function
handler to this interface.
GRExprEngine::CheckerEvalCall() will return true if one of the checkers has
processed the node. In the future this might return void when we have some 
default checker.

llvm-svn: 90755
2009-12-07 09:17:35 +00:00
Daniel Dunbar 98f2067ca4 Update CMake for CallGraph.cpp move.
llvm-svn: 90443
2009-12-03 09:14:19 +00:00
Zhongxing Xu c2998766f0 We can remove this file now.
llvm-svn: 89751
2009-11-24 08:28:49 +00:00
Zhongxing Xu c6123a1a3c Refactor undefined result checker. This is the last one.
llvm-svn: 89750
2009-11-24 08:24:26 +00:00
Zhongxing Xu da32375115 Rename: UndefinedArgChecker.cpp => CallAndMessageChecker.cpp
llvm-svn: 89734
2009-11-24 04:08:01 +00:00
Ted Kremenek b43737387b Provide out-of-line definition for destructor of Checker.
llvm-svn: 89688
2009-11-23 18:53:03 +00:00
Douglas Gregor 1c3feb5b25 Fix CMake build
llvm-svn: 89650
2009-11-23 12:03:50 +00:00
Ted Kremenek caf2c51fad Pull BadCallChecker int UndefinedArgChecker, and have UndefinedArgChecker also handled undefined receivers in message expressions.
llvm-svn: 89524
2009-11-21 01:25:37 +00:00
Ted Kremenek aedb7434c8 Add clang-cc option "-analyzer-experimental-checks" to enable experimental path-sensitive checks. The idea is to separate "barely working" or "skunkworks" checks from ones that should always run. Later we need more fine-grain checker control.
llvm-svn: 87053
2009-11-13 01:15:47 +00:00
Zhongxing Xu c6d9292197 update CMakefile
llvm-svn: 86979
2009-11-12 08:39:33 +00:00
Ted Kremenek d48568f641 Add most of the boilerplate logic for a simple pthread_mutux_lock() -> pthread_mutex_unlock() checker. We need to add a visitor method to Checker for handling dead symbols in order to detect locks that are not unlocked.
llvm-svn: 86958
2009-11-12 06:17:47 +00:00
Chandler Carruth 5375309250 Move the ManagerRegistry to the Analysis library to resolve the layering violation.
llvm-svn: 86863
2009-11-11 19:10:59 +00:00
Zhongxing Xu b166712d02 Add undefined array subscript checker.
llvm-svn: 86837
2009-11-11 13:42:54 +00:00
Zhongxing Xu 4f7759a339 Reimplement out-of-bound array access checker with the new checker interface.
Now only one test case is XFAIL'ed.

llvm-svn: 86834
2009-11-11 12:33:27 +00:00
Daniel Dunbar 23ede2d9d1 Update CMake.
llvm-svn: 86822
2009-11-11 08:14:02 +00:00
Zhongxing Xu ab0e27ff0c Add check for pointer arithmetic on non-array variables.
llvm-svn: 86538
2009-11-09 13:23:31 +00:00
Zhongxing Xu d09b22aa5a remove redundant file name in CMakeLists.txt.
llvm-svn: 86536
2009-11-09 09:35:41 +00:00
Zhongxing Xu 08670a89aa update CMakeList.txt
llvm-svn: 86535
2009-11-09 09:32:38 +00:00
Daniel Dunbar 53272bbf40 Update CMake
llvm-svn: 86533
2009-11-09 08:13:45 +00:00
Daniel Dunbar 65c0db98ab Update CMake
llvm-svn: 86528
2009-11-09 08:04:31 +00:00
Benjamin Kramer 489232c466 Update CMake file.
llvm-svn: 86479
2009-11-08 18:30:42 +00:00
Zhongxing Xu 167bce9cf1 Add a checker for CWE-466: Return of Pointer Value Outside of Expected Range.
llvm-svn: 86252
2009-11-06 13:30:44 +00:00
Ted Kremenek bee01e5b61 static analyzer: refactor checking logic for returning the address of a stack variable or a garbage
value into their own respective subclasses of Checker (and put them in .cpp files where their
implementation details are hidden from GRExprEngine).

llvm-svn: 86215
2009-11-06 02:24:13 +00:00
Daniel Dunbar 0300bbcf80 Update CMake.
llvm-svn: 86015
2009-11-04 06:39:40 +00:00
Zhongxing Xu 259d46407a Merge ZeroSizedVLAChecker and UndefSizedVLAChecker.
llvm-svn: 85996
2009-11-04 01:43:07 +00:00
Ted Kremenek 8d43a6ac3d Merge NullDerefChecker.[h,cpp] and UndefDerefChecker.[h,cpp]. They are essentially two parts of the same check.
llvm-svn: 85911
2009-11-03 18:41:06 +00:00
Benjamin Kramer 8a712c7866 Update CMakeLists.
llvm-svn: 85898
2009-11-03 13:37:33 +00:00
Ted Kremenek 18c7ceee16 Implement: <rdar://problem/6250216> Warn against using -[NSAutoreleasePool release] in GC mode
llvm-svn: 85887
2009-11-03 08:03:59 +00:00
Zhongxing Xu 9b9d731a8b Pull AttrNonNullChecker into its own files.
llvm-svn: 85883
2009-11-03 07:35:33 +00:00
Zhongxing Xu b42929d773 Update CMake file.
llvm-svn: 85879
2009-11-03 07:14:39 +00:00
Ted Kremenek df8016aabb Rename NSErrorCheck to NSErrorChecker.
llvm-svn: 85877
2009-11-03 06:59:59 +00:00
Ted Kremenek 3684c65ded Update CMake file.
llvm-svn: 85876
2009-11-03 06:46:41 +00:00
Benjamin Kramer 6b289a9cf6 Update CMake file.
llvm-svn: 85652
2009-10-31 12:15:23 +00:00
Ted Kremenek f613e89617 Move all logic for the null dereference checker from GRExprEngineInternalChecks.cpp to a separate .cpp file.
llvm-svn: 85595
2009-10-30 17:24:47 +00:00
Benjamin Kramer 1618c0113b Update CMakeLists.
llvm-svn: 81519
2009-09-11 11:28:30 +00:00
Benjamin Kramer 2a94b3dcdb fix cmake build
llvm-svn: 77589
2009-07-30 10:38:43 +00:00
Daniel Dunbar 7be573f05a Update CMakeLists.txt
llvm-svn: 77577
2009-07-30 03:55:04 +00:00
Ted Kremenek c5b4c0ec64 Add initial implementation of checking for uses of floating point as a loop counter.
llvm-svn: 76833
2009-07-23 01:07:19 +00:00
Ted Kremenek f1282074c3 Move bug reporter "visitors" to their own file and make them part of the public
BugReporter API.  No real functionality change.

llvm-svn: 76760
2009-07-22 17:55:28 +00:00
Ted Kremenek ac7c7240f0 Fix PR 4594 by refactoring almost all casting logic from GRExprEngine::VisitCast
to SValuator::EvalCast. In the process, the StoreManagers now use this new cast
machinery, and the hack in GRExprEngine::EvalBind to handle implicit casts
involving OSAtomicCompareAndSwap and friends has been removed (and replaced with
logic closer to the logic specific to those functions).

llvm-svn: 76641
2009-07-21 21:03:30 +00:00
Ted Kremenek 6796fbd2e8 Move the source-level CFG from libAST to libAnalysis.
llvm-svn: 76092
2009-07-16 18:13:04 +00:00
Ted Kremenek 942c0e5243 Update CMake file.
llvm-svn: 75885
2009-07-16 01:43:33 +00:00
Ted Kremenek 3e808edac9 Lexically order files in CMakeLists.txt files.
llvm-svn: 75832
2009-07-15 21:08:41 +00:00