aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/array-struct-region.c
AgeCommit message (Collapse)Author
2013-02-21[analyzer] Tighten up safety in the use of lazy bindings.Jordan Rose
- When deciding if we can reuse a lazy binding, make sure to check if there are additional bindings in the sub-region. - When reading from a lazy binding, don't accidentally strip off casts or base object regions. This slows down lazy binding reading a bit but is necessary for type sanity when treating one class as another. A bit of minor refactoring allowed these two checks to be unified in a nice early-return-using helper function. <rdar://problem/13239840> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175703 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01[analyzer] Reuse a LazyCompoundVal if its type matches the new region.Jordan Rose
This allows us to keep from chaining LazyCompoundVals in cases like this: CGRect r = CGRectMake(0, 0, 640, 480); CGRect r2 = r; CGRect r3 = r2; Previously we only made this optimization if the struct did not begin with an aggregate member, to make sure that we weren't picking up an LCV for the first field of the struct. But since LazyCompoundVals are typed, we can make that inference directly by comparing types. This is a pure optimization; the test changes are to guard against possible future regressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31[analyzer] Fix a bug in region store that lead to undefined value falseAnna Zaks
positives. The includeSuffix was only set on the first iteration through the function, resulting in invalid regions being produced by getLazyBinding (ex: zoomRegion.y). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174016 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10[analyzer] When invalidating symbolic offset regions, take fields into account.Jordan Rose
Previously, RegionStore was being VERY conservative in saying that because p[i].x and p[i].y have a concrete base region of 'p', they might overlap. Now, we check the chain of fields back up to the base object and check if they match. This only kicks in when dealing with symbolic offset regions because RegionStore's "base+offset" representation of concrete offset regions loses all information about fields. In cases where all offsets are concrete (s.x and s.y), RegionStore will already do the right thing, but mixing concrete and symbolic offsets can cause bindings to be invalidated that are known to not overlap (e.g. p[0].x and p[i].y). This additional refinement is tracked by <rdar://problem/12676180>. <rdar://problem/12530149> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167654 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24Fix analyzer tests.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162588 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22Remove BasicConstraintManager. It hasn't been in active service for a while.Ted Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162384 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21[analyzer] -analyzer-ipa=inlining is now the default. Remove it from tests.Jordan Rose
The actual change here is a little more complicated than the summary above. What we want to do is have our generic inlining tests run under whatever mode is the default. However, there are some tests that depend on the presence of C++ inlining, which still has some rough edges. These tests have been explicitly marked as -analyzer-ipa=inlining in preparation for a new mode that limits inlining to C functions and blocks. This will be the default until the false positives for C++ have been brought down to manageable levels. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162317 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08[analyzer] Revamp RegionStore to distinguish regions with symbolic offsets.Jordan Rose
RegionStore currently uses a (Region, Offset) pair to describe the locations of memory bindings. However, this representation breaks down when we have regions like 'array[index]', where 'index' is unknown. We used to store this as (SubRegion, 0); now we mark them specially as (SubRegion, SYMBOLIC). Furthermore, ProgramState::scanReachableSymbols depended on the existence of a sub-region map, but RegionStore's implementation doesn't provide for such a thing. Moving the store-traversing logic of scanReachableSymbols into the StoreManager allows us to eliminate the notion of SubRegionMap altogether. This fixes some particularly awkward broken test cases, now in array-struct-region.c. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161510 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06[analyzer] Fix mis-committed test. No functionality change.Jordan Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159869 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06[analyzer] Be careful about LazyCompoundVals, which may be for the first field.Jordan Rose
We use LazyCompoundVals to avoid copying the contents of structs and arrays around in the store, and when we need to pass a struct around that already has a LazyCompoundVal we just use the original one. However, it's possible that the first field of a struct may have a LazyCompoundVal of its own, and we currently can't distinguish a LazyCompoundVal for the first element of a struct from a LazyCompoundVal for the entire struct. In this case we should just drop the optimization and make a new LazyCompoundVal that encompasses the old one. PR13264 / <rdar://problem/11802440> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159866 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-16[analyzer] Convert many existing tests to use clang_analyzer_eval.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156920 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15Improve some of the conversion warnings to fire on conversion to bool.David Blaikie
Moves the bool bail-out down a little in SemaChecking - so now -Wnull-conversion and -Wliteral-conversion can fire when the target type is bool. Also improve the wording/details in the -Wliteral-conversion warning to match the -Wconstant-conversion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156826 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-12[analyzer] Test case: p->x is the same as p[0].x. (PR7297)Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156720 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-05Enable warn_impcast_literal_float_to_integer by default.David Blaikie
This diagnostic seems to be production ready, it's just an oversight that it wasn't turned on by default. The test changes are a bit of a mixed bag. Some tests that seemed like they clearly didn't need to use this behavior have been modified not to use it. Others that I couldn't be sure about, I added the necessary expected-warnings to. It's possible the diagnostic message could be improved to make it clearer that this warning can be suppressed by using a value that won't lose precision when converted to the target type (but can still be a floating point literal, such as "bool b = 1.0;"). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154068 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03[analyzer] rename all experimental checker packages to have 'experimental' ↵Ted Kremenek
be the common root package. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24Rework checker "packages" and groups to be more hierarchical.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128187 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28[analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best ↵Argyrios Kyrtzidis
misnomer award. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126676 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28[analyzer] Remove '-analyzer-experimental-checks' flag.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126607 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24[analyzer] Remove '-analyzer-experimental-internal-checks' flag, it doesn't ↵Argyrios Kyrtzidis
have any checkers associated with it anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126440 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15[analyzer] Use the new registration mechanism on some of the experimental ↵Argyrios Kyrtzidis
checks. These are: CStringChecker ChrootChecker MallocChecker PthreadLockChecker StreamChecker UnreachableCodeChecker MallocChecker creates implicit dependencies between checkers and needs to be handled differently. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20Handle nested compound values in BindArray for multidimensional arrays. ↵Jordy Rose
Fixes PR7945. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29Move new test (that requires RegionStore) into its own file.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109736 91177308-0d34-0410-b5e6-96231b3b80d8