summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/array-struct.c
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"Jordan Rose2012-10-011-0/+8
| | | | | | | | This seems to be legal according to C11 6.5.3.2. No functionality change. llvm-svn: 164959
* Fix analyzer tests.Ted Kremenek2012-08-241-1/+1
| | | | llvm-svn: 162588
* Remove BasicConstraintManager. It hasn't been in active service for a while.Ted Kremenek2012-08-221-1/+0
| | | | | | | | As part of this change, I discovered that a few of our tests were not testing the RangeConstraintManager. Luckily all of those passed when I moved them over to use that constraint manager. llvm-svn: 162384
* Allow multiple PathDiagnosticConsumers to be used with a BugReporter at the ↵Ted Kremenek2012-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | same time. This fixes several issues: - removes egregious hack where PlistDiagnosticConsumer would forward to HTMLDiagnosticConsumer, but diagnostics wouldn't be generated consistently in the same way if PlistDiagnosticConsumer was used by itself. - emitting diagnostics to the terminal (using clang's diagnostic machinery) is no longer a special case, just another PathDiagnosticConsumer. This also magically resolved some duplicate warnings, as we now use PathDiagnosticConsumer's diagnostic pruning, which has scope for the entire translation unit, not just the scope of a BugReporter (which is limited to a particular ExprEngine). As an interesting side-effect, diagnostics emitted to the terminal also have their trailing "." stripped, just like with diagnostics emitted to plists and HTML. This required some tests to be updated, but now the tests have higher fidelity with what users will see. There are some inefficiencies in this patch. We currently generate the report graph (from the ExplodedGraph) once per PathDiagnosticConsumer, which is a bit wasteful, but that could be pulled up higher in the logic stack. There is some intended duplication, however, as we now generate different PathDiagnostics (for the same issue) for different PathDiagnosticConsumers. This is necessary to produce the diagnostics that a particular consumer expects. llvm-svn: 162028
* [analyzer] rename all experimental checker packages to have 'experimental' ↵Ted Kremenek2011-08-031-2/+2
| | | | | | be the common root package. llvm-svn: 136835
* Really remove FlatStoreManager and BasicStoreManager, this time from the ↵Ted Kremenek2011-07-281-2/+0
| | | | | | driver. Also remove associated tests. Sorry for the messy commits; this is the result of a botched Git merge. llvm-svn: 136422
* [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best ↵Argyrios Kyrtzidis2011-02-281-4/+4
| | | | | | misnomer award. llvm-svn: 126676
* [analyzer] Use the new registration mechanism on some of the experimental ↵Argyrios Kyrtzidis2011-02-151-4/+4
| | | | | | | | | | | internal checkers: CastToStructChecker FixedAddressChecker PointerArithChecker PointerSubChecker llvm-svn: 125612
* Move new test (that requires RegionStore) into its own file.Jordy Rose2010-07-291-23/+0
| | | | llvm-svn: 109736
* Use a LazyCompoundVal to handle initialization with a string literal, rather ↵Jordy Rose2010-07-291-0/+23
| | | | | | than copying each character. llvm-svn: 109734
* Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.Ted Kremenek2010-02-051-4/+4
| | | | llvm-svn: 95348
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-4/+4
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Replace clang-cc with clang -cc1.Zhongxing Xu2009-12-141-4/+4
| | | | llvm-svn: 91272
* Add clang-cc option "--analyzer-experimental-internal-checks". ThisTed Kremenek2009-11-131-4/+4
| | | | | | | option enables new "internal" checks that will eventually be turned on by default but still require broader testing. llvm-svn: 88671
* Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.Zhongxing Xu2009-11-091-1/+1
| | | | llvm-svn: 86529
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-3/+3
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Implement -Wconversion. Off by default, in the non-gcc group. There'sJohn McCall2009-11-071-1/+1
| | | | | | significant work left to be done to reduce the false-positive rate here. llvm-svn: 86326
* Add casts to avoid a bunch of unused expr warnings. (They aren't reported ↵Anders Carlsson2009-07-301-1/+1
| | | | | | right now due to a bug that I intend to fix). Ted, please review. llvm-svn: 77630
* Remove 'StoreManager::OldCastRegion()', TypedViewRegion (which onlyTed Kremenek2009-07-291-2/+0
| | | | | | | OldCastRegion used), and the associated command line option '-analyzer-store=old-basic-cast'. llvm-svn: 77509
* Remove stale comment and fix RUN line.Ted Kremenek2009-07-211-3/+1
| | | | llvm-svn: 76656
* Switch BasicStoreManager to use the new CastRegion implementation by default,Ted Kremenek2009-07-101-2/+2
| | | | | | | | and replace the 'clang-cc' option '-analyzer-store=basic-new-cast' with '-analyzer-store=basic-old-cast'. We'll keep the old CastRegion implementation around for a little while for regression testing. llvm-svn: 75209
* Make 'BasicStoreManager' + 'NewCastRegion' testable from the command line ↵Ted Kremenek2009-07-061-1/+3
| | | | | | using '-analyzer-store=basic-new-cast'. llvm-svn: 74865
* Invalidate the alloca region by setting its default value to conjured symbol.Zhongxing Xu2009-06-291-0/+12
| | | | llvm-svn: 74419
* Now this test case passes.Zhongxing Xu2009-06-281-2/+2
| | | | llvm-svn: 74410
* Invalidate a field of struct type by setting its default value to conjured Zhongxing Xu2009-06-281-0/+11
| | | | | | symbol. llvm-svn: 74408
* Introduce a new concept to the static analyzer: SValuator.Ted Kremenek2009-06-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GRTransferFuncs had the conflated role of both constructing SVals (symbolic expressions) as well as handling checker-specific logic. Now SValuator has the role of constructing SVals from expressions and GRTransferFuncs just handles checker-specific logic. The motivation is by separating these two concepts we will be able to much more easily create richer constraint-generating logic without coupling it to the main checker transfer function logic. We now have one implementation of SValuator: SimpleSValuator. SimpleSValuator is essentially the SVal-related logic that was in GRSimpleVals (which is removed in this patch). This includes the logic for EvalBinOp, EvalCast, etc. Because SValuator has a narrower role than the old GRTransferFuncs, the interfaces are much simpler, and so is the implementation of SimpleSValuator compared to GRSimpleVals. I also did a line-by-line review of SVal-related logic in GRSimpleVals and cleaned it up while moving it over to SimpleSValuator. As a consequence of removing GRSimpleVals, there is no longer a '-checker-simple' option. The '-checker-cfref' did everything that option did but also ran the retain/release checker. Of course a user may not always wish to run the retain/release checker, nor do we wish core analysis logic buried in the checker-specific logic. The next step is to refactor the logic in CFRefCount.cpp to separate out these pieces into the core analysis engine. llvm-svn: 74229
* Bind the mistakenly generated nonloc::SymbolVal to struct correctly. See theZhongxing Xu2009-06-111-0/+10
| | | | | | comments for added test case for details. llvm-svn: 73189
* Treat AllocaRegion as SymbolicRegion in RegionStore::Retrieve().Zhongxing Xu2009-05-201-1/+4
| | | | llvm-svn: 72166
* Add comments to test case.Zhongxing Xu2009-05-201-0/+2
| | | | llvm-svn: 72165
* * API change: we need to pass GRState to GRExprEngine::EvalBinOp() becauseZhongxing Xu2009-05-201-0/+1
| | | | | | | | RegionStore needs to know the type of alloca region. * RegionStoreManager::EvalBinOp() now converts the alloca region to its first element region, as what is done to symbolic region. llvm-svn: 72164
* Add logic for invalidating array region to CFRefCount.cpp. When invalidatingZhongxing Xu2009-05-121-0/+10
| | | | | | | | | array region, set its default value to conjured symbol. When retrieving its element, create new region value symbol for the element. Also fix some 80 columns violations. llvm-svn: 71548
* Per conversations with Zhongxing, add an 'element type' toTed Kremenek2009-05-041-3/+5
| | | | | | | | | | | | | | | | | | | ElementRegion. I also removed 'ElementRegion::getArrayRegion', although we may need to add this back. This breaks a few test cases with RegionStore: - 'array-struct.c' triggers an infinite recursion in RegionStoreManager. Need to investigate. - misc-ps.m triggers a failure with RegionStoreManager as we now get the diagnostic: 'Line 159: Uninitialized or undefined return value returned to caller.' There were a bunch of places that needed to be edit RegionStoreManager, and we may not be passing all the correct 'element types' down from GRExprEngine. Zhongxing: When you get a chance, could you review this? I could have easily screwed up something basic in RegionStoreManager. llvm-svn: 70830
* region store: make Retrieve() can retrieve embedded array correctly. AlsoZhongxing Xu2009-05-031-0/+11
| | | | | | simplify the retrieve logic. llvm-svn: 70651
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-5/+5
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* add test case.Zhongxing Xu2009-03-181-0/+15
| | | | llvm-svn: 67154
* add test case.Zhongxing Xu2009-02-191-0/+7
| | | | llvm-svn: 65036
* Update several tests to explicitly use BasicConstraintManager as well as to ↵Ted Kremenek2009-02-171-3/+5
| | | | | | use RangeConstraintManager with RegionStoreManager. llvm-svn: 64854
* Static Analyzer driver/options (partial) cleanup:Ted Kremenek2009-02-171-3/+3
| | | | | | | | | | | | | | - Move all analyzer options logic to AnalysisConsumer.cpp. - Unified specification of stores/constraints/output to be: -analyzer-output=... -analyzer-store=... -analyzer-constraints=... instead of -analyzer-range-constraints, -analyzer-store-basic, etc. - Updated drivers (ccc-analyzer, scan-builds, new ccc) to obey this new interface - Updated test cases to conform to new driver options llvm-svn: 64737
* Implement retrieval of the default value of element and field regions.Zhongxing Xu2009-01-231-0/+8
| | | | llvm-svn: 62847
* Add a test case for init expr of array and struct type.Zhongxing Xu2009-01-231-0/+1
| | | | llvm-svn: 62845
* Fix RegionStore::getLValueElement() to handle the case when the base region ↵Ted Kremenek2009-01-221-2/+3
| | | | | | | | is not an ElementRegion (also do some cleanups of its core logic). This gets array-struct.c to work with RegionStore. llvm-svn: 62781
* Add -analyze action to run static analyzer, instead of inferring fromDaniel Dunbar2009-01-201-2/+2
| | | | | | individual checker options. llvm-svn: 62634
* Add KillStruct to region store. Zhongxing Xu2009-01-131-0/+1
| | | | | | | | - put the killed region in the kill set. - set its default value to unknown. - removes all bindings for its subregions. llvm-svn: 62138
* MemRegion:Ted Kremenek2008-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | - Overhauled the notion of "types" for TypedRegions. We now distinguish between the "lvalue" of a region (via getLValueRegion()) and the "rvalue" of a region (va getRValueRegion()). Since a region represents a chunk of memory it has both, but we were conflating these concepts in some cases, leading to some insidious bugs. - Removed AnonPointeeType, partially because it is unused and because it doesn't have a clear notion of lvalue vs rvalue type. We can add it back once there is a need for it and we can resolve its role with these concepts. StoreManager: - Overhauled StoreManager::CastRegion. It expects an *lvalue* type for a region. This is actually what motivated the overhaul to the MemRegion type mechanism. It also no longer returns an SVal; we can just return a MemRegion*. - BasicStoreManager::CastRegion now overlays an "AnonTypedRegion" for pointer-pointer casts. This matches with the MemRegion changes. - Similar changes to RegionStore, except I've added a bunch of FIXMEs where it wasn't 100% clear where we should use TypedRegion::getRValueRegion() or TypedRegion::getLValueRegion(). AuditCFNumberCreate check: - Now blasts through AnonTypedRegions that may layer the original memory region, thus checking if the actually memory block is of the appropriate type. This change was needed to work with the changes to StoreManager::CastRegion. GRExprEngine::VisitCast: - Conform to the new interface of StoreManager::CastRegion. Tests: - None of the analysis tests fail now for using the "basic store". - Disabled the tests 'array-struct.c' and 'rdar-6442306-1.m' pending further testing and bug fixing. llvm-svn: 60995
* remove a test case that causes compiler warning.Zhongxing Xu2008-11-301-1/+0
| | | | llvm-svn: 60282
* Add test for initializing array with string literal.Zhongxing Xu2008-11-301-0/+7
| | | | llvm-svn: 60281
* Add documentation for test.Zhongxing Xu2008-11-251-0/+10
| | | | llvm-svn: 60002
* Add no-warning to test case.Zhongxing Xu2008-11-241-1/+1
| | | | llvm-svn: 59995
* Improve test case.Zhongxing Xu2008-11-231-1/+1
| | | | llvm-svn: 59902
* Add test cast for struct array.Zhongxing Xu2008-11-181-0/+4
| | | | llvm-svn: 59522
OpenPOWER on IntegriCloud