aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/array-struct.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-03Reland 4: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen1-1/+1
constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296895
2017-03-02Revert "Reland 3: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen1-1/+1
multiple constraint managers" This reverts commit ea36f1406e1f36bf456c3f3929839b024128e468. llvm-svn: 296841
2017-03-02Reland 3: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen1-1/+1
constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296837
2017-03-02Revert "Reland 2: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen1-1/+1
multiple constraint managers" This reverts commit f93343c099fff646a2314cc7f4925833708298b1. llvm-svn: 296836
2017-03-02Reland 2: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen1-1/+1
constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296835
2017-02-28Revert "Reland: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen1-1/+1
multiple constraint managers" This reverts commit 1b28d0b10e1c8feccb971abb6ef7a18bee589830. llvm-svn: 296422
2017-02-28Reland: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen1-1/+1
constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296414
2017-02-27Revert "[analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen1-1/+1
constraint managers" This reverts commit 8e7780b9e59ddaad1800baf533058d2c064d4787. llvm-svn: 296317
2017-02-27[analyzer] NFC: Update test infrastructure to support multiple constraint ↵Dominic Chen1-1/+1
managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296312
2016-12-01[analyzer] Drop explicit mention of range constraint solverDominic Chen1-1/+1
Summary: The basic constraint solver was dropped in rL162384, leaving the range constraint solver as the default and only constraint solver. Explicitly specifying it is unnecessary, and makes it difficult to test with other solver backends. Reviewers: zaks.anna, dcoughlin Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26694 llvm-svn: 288372
2016-09-13[analyzer] Fix ExprEngine::VisitMemberExprAlexander Shaposhnikov1-0/+11
AST may contain intermediate ParenExpr nodes between MemberExpr and ArrayToPointerDecay. This diff adjusts the check in ExprEngine::VisitMemberExpr accordingly. Test plan: make -j8 check-clang-analysis Differential revision: https://reviews.llvm.org/D24484 llvm-svn: 281373
2015-02-05[analyzer] Relax an assertion in VisitLvalArraySubscriptExprAnna Zaks1-0/+16
The analyzer thinks that ArraySubscriptExpr cannot be an r-value (ever). However, it can be in some corner cases. Specifically, C forbids expressions of unqualified void type from being l-values. Note, the analyzer will keep modeling the subscript expr as an l-value. The analyzer should be treating void* as a char array (https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Pointer-Arith.html). llvm-svn: 228249
2012-10-01[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"Jordan Rose1-0/+8
This seems to be legal according to C11 6.5.3.2. No functionality change. llvm-svn: 164959
2012-08-24Fix analyzer tests.Ted Kremenek1-1/+1
llvm-svn: 162588
2012-08-22Remove BasicConstraintManager. It hasn't been in active service for a while.Ted Kremenek1-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
2012-08-16Allow multiple PathDiagnosticConsumers to be used with a BugReporter at the ↵Ted Kremenek1-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
2011-08-03[analyzer] rename all experimental checker packages to have 'experimental' ↵Ted Kremenek1-2/+2
be the common root package. llvm-svn: 136835
2011-07-28Really remove FlatStoreManager and BasicStoreManager, this time from the ↵Ted Kremenek1-2/+0
driver. Also remove associated tests. Sorry for the messy commits; this is the result of a botched Git merge. llvm-svn: 136422
2011-02-28[analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best ↵Argyrios Kyrtzidis1-4/+4
misnomer award. llvm-svn: 126676
2011-02-15[analyzer] Use the new registration mechanism on some of the experimental ↵Argyrios Kyrtzidis1-4/+4
internal checkers: CastToStructChecker FixedAddressChecker PointerArithChecker PointerSubChecker llvm-svn: 125612
2010-07-29Move new test (that requires RegionStore) into its own file.Jordy Rose1-23/+0
llvm-svn: 109736
2010-07-29Use a LazyCompoundVal to handle initialization with a string literal, rather ↵Jordy Rose1-0/+23
than copying each character. llvm-svn: 109734
2010-02-05Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.Ted Kremenek1-4/+4
llvm-svn: 95348
2009-12-15Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar1-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
2009-12-14Replace clang-cc with clang -cc1.Zhongxing Xu1-4/+4
llvm-svn: 91272
2009-11-13Add clang-cc option "--analyzer-experimental-internal-checks". ThisTed Kremenek1-4/+4
option enables new "internal" checks that will eventually be turned on by default but still require broader testing. llvm-svn: 88671
2009-11-09Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.Zhongxing Xu1-1/+1
llvm-svn: 86529
2009-11-08Eliminate &&s in tests.Daniel Dunbar1-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
2009-11-07Implement -Wconversion. Off by default, in the non-gcc group. There'sJohn McCall1-1/+1
significant work left to be done to reduce the false-positive rate here. llvm-svn: 86326
2009-07-30Add casts to avoid a bunch of unused expr warnings. (They aren't reported ↵Anders Carlsson1-1/+1
right now due to a bug that I intend to fix). Ted, please review. llvm-svn: 77630
2009-07-29Remove 'StoreManager::OldCastRegion()', TypedViewRegion (which onlyTed Kremenek1-2/+0
OldCastRegion used), and the associated command line option '-analyzer-store=old-basic-cast'. llvm-svn: 77509
2009-07-21Remove stale comment and fix RUN line.Ted Kremenek1-3/+1
llvm-svn: 76656
2009-07-10Switch BasicStoreManager to use the new CastRegion implementation by default,Ted Kremenek1-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
2009-07-06Make 'BasicStoreManager' + 'NewCastRegion' testable from the command line ↵Ted Kremenek1-1/+3
using '-analyzer-store=basic-new-cast'. llvm-svn: 74865
2009-06-29Invalidate the alloca region by setting its default value to conjured symbol.Zhongxing Xu1-0/+12
llvm-svn: 74419
2009-06-28Now this test case passes.Zhongxing Xu1-2/+2
llvm-svn: 74410
2009-06-28Invalidate a field of struct type by setting its default value to conjured Zhongxing Xu1-0/+11
symbol. llvm-svn: 74408
2009-06-26Introduce a new concept to the static analyzer: SValuator.Ted Kremenek1-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
2009-06-11Bind the mistakenly generated nonloc::SymbolVal to struct correctly. See theZhongxing Xu1-0/+10
comments for added test case for details. llvm-svn: 73189
2009-05-20Treat AllocaRegion as SymbolicRegion in RegionStore::Retrieve().Zhongxing Xu1-1/+4
llvm-svn: 72166
2009-05-20Add comments to test case.Zhongxing Xu1-0/+2
llvm-svn: 72165
2009-05-20* API change: we need to pass GRState to GRExprEngine::EvalBinOp() becauseZhongxing Xu1-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
2009-05-12Add logic for invalidating array region to CFRefCount.cpp. When invalidatingZhongxing Xu1-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
2009-05-04Per conversations with Zhongxing, add an 'element type' toTed Kremenek1-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
2009-05-03region store: make Retrieve() can retrieve embedded array correctly. AlsoZhongxing Xu1-0/+11
simplify the retrieve logic. llvm-svn: 70651
2009-03-24Rename clang to clang-cc.Daniel Dunbar1-5/+5
Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
2009-03-18add test case.Zhongxing Xu1-0/+15
llvm-svn: 67154
2009-02-19add test case.Zhongxing Xu1-0/+7
llvm-svn: 65036
2009-02-17Update several tests to explicitly use BasicConstraintManager as well as to ↵Ted Kremenek1-3/+5
use RangeConstraintManager with RegionStoreManager. llvm-svn: 64854
2009-02-17Static Analyzer driver/options (partial) cleanup:Ted Kremenek1-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