aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer
AgeCommit message (Collapse)Author
2013-03-20[analyzer] Re-apply "Do part of the work to find shortest bug paths up front".Jordan Rose
With the assurance that the trimmed graph does not contain cycles, this patch is safe (with a few tweaks), and provides the performance boost it was intended to. Part of performance work for <rdar://problem/13433687>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177469 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20[analyzer] Break cycles (optionally) when trimming an ExplodedGraph.Jordan Rose
Having a trimmed graph with no cycles (a DAG) is much more convenient for trying to find shortest paths, which is exactly what BugReporter needs to do. Part of the performance work for <rdar://problem/13433687>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177468 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19[analyzer] Do not believe lazy binding when symbolic region types do not matchAnna Zaks
This fixes a crash when analyzing LLVM that was exposed by r177220 (modeling of trivial copy/move assignment operators). When we look up a lazy binding for “Builder”, we see the direct binding of Loc at offset 0. Previously, we believed the binding, which led to a crash. Now, we do not believe it as the types do not match. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177453 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19Revert "[analyzer] Do part of the work to find shortest bug paths up front."Jordan Rose
The whole reason we were doing a BFS in the first place is because an ExplodedGraph can have cycles. Unfortunately, my removeErrorNode "update" doesn't work at all if there are cycles. I'd still like to be able to avoid doing the BFS every time, but I'll come back to it later. This reverts r177353 / 481fa5071c203bc8ba4f88d929780f8d0f8837ba. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177448 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18[analyzer] Do part of the work to find shortest bug paths up front.Jordan Rose
Splitting the graph trimming and the path-finding (r177216) already recovered quite a bit of performance lost to increased suppression. We can still do better by also performing the reverse BFS up front (needed for shortest-path-finding) and only walking the shortest path for each report. This does mean we have to walk back up the path and invalidate all the BFS numbers if the report turns out to be invalid, but it's probably still faster than redoing the full BFS every time. More performance work for <rdar://problem/13433687> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177353 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18[analyzer] Replace uses of assume() with isNull() in BR visitors.Jordan Rose
Also, replace a std::string with a SmallString. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177352 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18[analyzer] Warn when a ‘nil’ object is added to NSArray or NSMutableArray.Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177318 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16[analyzer] Model trivial copy/move assignment operators with a bind as well.Jordan Rose
r175234 allowed the analyzer to model trivial copy/move constructors as an aggregate bind. This commit extends that to trivial assignment operators as well. Like the last commit, one of the motivating factors here is not warning when the right-hand object is partially-initialized, which can have legitimate uses. <rdar://problem/13405162> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177220 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16[analyzer] Separate graph trimming from creating the single-path graph.Jordan Rose
When we generate a path diagnostic for a bug report, we have to take the full ExplodedGraph and limit it down to a single path. We do this in two steps: "trimming", which limits the graph to all the paths that lead to this particular bug, and "creating the report graph", which finds the shortest path in the trimmed path to any error node. With BugReporterVisitor false positive suppression, this becomes more expensive: it's possible for some paths through the trimmed graph to be invalid (i.e. likely false positives) but others to be valid. Therefore we have to run the visitors over each path in the graph until we find one that is valid, or until we've ruled them all out. This can become quite expensive. This commit separates out graph trimming from creating the report graph, performing the first only once per bug equivalence class and the second once per bug report. It also cleans up that portion of the code by introducing some wrapper classes. This seems to recover most of the performance regression described in my last commit. <rdar://problem/13433687> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177216 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16[analyzer] Eliminate InterExplodedGraphMap class and NodeBackMap typedef.Jordan Rose
...in favor of this typedef: typedef llvm::DenseMap<const ExplodedNode *, const ExplodedNode *> InterExplodedGraphMap; Use this everywhere the previous class and typedef were used. Took the opportunity to ArrayRef-ize ExplodedGraph::trim while I'm at it. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177215 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16[analyzer] Don't repeat a bug equivalence class if every report is invalid.Jordan Rose
I removed this check in the recursion->iteration commit, but forgot that generatePathDiagnostic may be called multiple times if there are multiple PathDiagnosticConsumers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177214 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Address a TODO in the StreamChecker; otherwise the output is ↵Anna Zaks
non-deterministic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177207 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Use isLiveRegion to determine when SymbolRegionValue is dead.Anna Zaks
Fixes a FIXME, improves dead symbol collection, suppresses a false positive, which resulted from reusing the same symbol twice for simulation of 2 calls to the same function. Fixing this lead to 2 possible false negatives in CString checker. Since the checker is still alpha and the solution will not require revert of this commit, move the tests to a FIXME section. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177206 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] BugReporterVisitors: handle the case where a ternary operator is ↵Anna Zaks
wrapped in a cast. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177205 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Address Jordan’s review of r177138 (a micro optimization)Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177204 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Make GRBugReporter::generatePathDiagnostic iterative, not recursive.Jordan Rose
The previous generatePathDiagnostic() was intended to be tail-recursive, restarting and trying again if a report was marked invalid. However: (1) this leaked all the cloned visitors, which weren't being deleted, and (2) this wasn't actually tail-recursive because some local variables had non-trivial destructors. This was causing us to overflow the stack on inputs with large numbers of reports in the same equivalence class, such as sqlite3.c. Being iterative at least prevents us from blowing out the stack, but doesn't solve the performance issue: suppressing thousands (yes, thousands) of paths in the same equivalence class is expensive. I'm looking into that now. <rdar://problem/13423498> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177189 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Collect stats on the max # of bug reports in an equivalence class.Jordan Rose
We discovered that sqlite3.c currently has 2600 reports in a single equivalence class; it would be good to know if this is a recent development or what. (For the curious, the different reports in an equivalence class represent the same bug found along different paths. When we're suppressing false positives, we need to go through /every/ path to make sure there isn't a valid path to a bug. This is a flaw in our after-the-fact suppression, made worse by the fact that that function isn't particularly optimized.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177188 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Include opcode in dumping a SymSymExpr.Jordan Rose
For debugging use only; no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177187 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Look through ExprWhenCleanups when trying to track a NULL.Jordan Rose
Silences a few false positives in LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177186 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Refactor checks in IDC visitor for consistency and speedAnna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177138 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[analyzer] Teach trackNullOrUndef to look through ternary operatorsAnna Zaks
Allows the suppression visitors trigger more often. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177137 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14[analyzer] Change the way in which IDC Visitor decides to kick in and make ↵Anna Zaks
sure it attaches in the given edge case In the test case below, the value V is not constrained to 0 in ErrorNode but it is in node N. So we used to fail to register the Suppression visitor. We also need to change the way we determine that the Visitor should kick in because the node N belongs to the ExplodedGraph and might not be on the BugReporter path that the visitor sees. Instead of trying to match the node, turn on the visitor when we see the last node in which the symbol is ‘0’. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177121 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13[analyzer] BugReporter - more precise tracking of C++ referencesAnna Zaks
When BugReporter tracks C++ references involved in a null pointer violation, we want to differentiate between a null reference and a reference to a null pointer. In the first case, we want to track the region for the reference location; in the second, we want to track the null pointer. In addition, the core creates CXXTempObjectRegion to represent the location of the C++ reference, so teach FindLastStoreBRVisitor about it. This helps null pointer suppression to kick in. (Patch by Anna and Jordan.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176969 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13Remove stray space.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176966 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13[analyzer] Handle Objc Fast enumeration for "loop is executed 0 times".Ted Kremenek
Fixes <rdar://problem/12322528> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176965 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13[analyzer] fixed the logic changed by r176949Anton Yartsev
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176956 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13Refactoring:Anton Yartsev
+ Individual Report* method for each bug type + Comment improved: missing non-trivial alloca() case annotated + 'range' parameter of ReportBadFree() capitalized + 'SymbolRef Sym = State->getSVal(A, C.getLocationContext()).getAsSymbol();' shorten to 'SymbolRef Sym = C.getSVal(A).getAsSymbol();' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176949 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-11[analyzer] Look for calls along with lvalue nodes in trackNullOrUndefValue.Jordan Rose
r176737 fixed bugreporter::trackNullOrUndefValue to find nodes for an lvalue even if the rvalue node had already been collected. This commit extends that to call statement nodes as well, so that if a call is contained within implicit casts we can still track the return value. No test case because node reclamation is extremely finicky (dependent on how the AST and CFG are built, and then on our current reclamation rules, and /then/ on how many nodes were generated by the analyzer core and the current set of checkers). I consider this a low-risk change, though, and it will only happen in cases of reclamation when the rvalue node isn't available. <rdar://problem/13340764> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176829 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-09[analyzer] Make Suppress IDC checker aware that it might not start from the ↵Anna Zaks
same node it was registered at The visitor used to assume that the value it’s tracking is null in the first node it examines. This is not true. If we are registering the Suppress Inlined Defensive checks visitor while traversing in another visitor (such as FindlastStoreVisitor). When we restart with the IDC visitor, the invariance of the visitor does not hold since the symbol we are tracking no longer exists at that point. I had to pass the ErrorNode when creating the IDC visitor, because, in some cases, node N is neither the error node nor will be visible along the path (we had not finalized the path at that point and are dealing with ExplodedGraph.) We should revisit the other visitors which might not be aware that they might get nodes, which are later in path than the trigger point. This suppresses a number of inline defensive checks in JavaScriptCore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176756 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-09[analyzer] Rename AttrNonNullChecker -> NonNullParamCheckerAnna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176755 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-09[analyzer] Be more consistent about Objective-C methods that free memory.Jordan Rose
Previously, MallocChecker's pointer escape check and its post-call state update for Objective-C method calls had a fair amount duplicated logic and not-entirely-consistent checks. This commit restructures all this to be more consistent and possibly allow us to be more aggressive in warning about double-frees. New policy (applies to system header methods only): (1) If this is a method we know about, model it as taking/holding ownership of the passed-in buffer. (1a) ...unless there's a "freeWhenDone:" parameter with a zero (NO) value. (2) If there's a "freeWhenDone:" parameter (but it's not a method we know about), treat the buffer as escaping if the value is non-zero (YES) and non-escaping if it's zero (NO). (3) If the first selector piece ends with "NoCopy" (but it's not a method we know about and there's no "freeWhenDone:" parameter), treat the buffer as escaping. The reason that (2) and (3) don't explicitly model the ownership transfer is because we can't be sure that they will actually free the memory using free(), and we wouldn't want to emit a spurious "mismatched allocator" warning (coming in Anton's upcoming patch). In the future, we may have an idea of a "generic deallocation", i.e. we assume that the deallocator is correct but still continue tracking the region so that we can warn about double-frees. Patch by Anton Yartsev, with modifications from me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176744 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08[analyzer] Look for lvalue nodes when tracking a null pointer.Jordan Rose
r176010 introduced the notion of "interesting" lvalue expressions, whose nodes are guaranteed never to be reclaimed by the ExplodedGraph. This was used in bugreporter::trackNullOrUndefValue to find the region that contains the null or undef value being tracked. However, the /rvalue/ nodes (i.e. the loads from these lvalues that produce a null or undef value) /are/ still being reclaimed, and if we couldn't find the node for the rvalue, we just give up. This patch changes that so that we look for the node for either the rvalue or the lvalue -- preferring the former, since it lets us fall back to value-only tracking in cases where we can't get a region, but allowing the latter as well. <rdar://problem/13342842> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176737 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08[analyzer] Don't rely on finding the correct return statement for suppression.Jordan Rose
Previously, ReturnVisitor waited to suppress a null return path until it had found the inlined "return" statement. Now, it checks up front whether the return value was NULL, and suppresses the warning right away if so. We still have to wait until generating the path notes to invalidate the bug report, or counter-suppression will never be triggered. (Counter-suppression happens while generating path notes, but the generation won't happen for reports already marked invalid.) This isn't actually an issue today because we never reclaim nodes for top-level statements (like return statements), but it could be an issue some day in the future. (But, no expected behavioral change and no new test case.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176736 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07[analyzer] Warn on passing a reference to null pointer as an argument in a callAnna Zaks
Warn about null pointer dereference earlier when a reference to a null pointer is passed in a call. The idea is that even though the standard might allow this, reporting the issue earlier is better for diagnostics (the error is reported closer to the place where the pointer was set to NULL). This also simplifies analyzer’s diagnostic logic, which has to track “where the null came from”. As a consequence, some of our null pointer warning suppression mechanisms started triggering more often. TODO: Change the name of the file and class to reflect the new check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176612 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07[analyzer] Check for returning null references in ReturnUndefChecker.Jordan Rose
Officially in the C++ standard, a null reference cannot exist. However, it's still very easy to create one: int &getNullRef() { int *p = 0; return *p; } We already check that binds to reference regions don't create null references. This patch checks that we don't create null references by returning, either. <rdar://problem/13364378> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07[analyzer] Clean up a few doc comments for ProgramState and CallEvent.Jordan Rose
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176600 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06[analyzer] Pass the correct Expr to the bug reporter visitors when dealing ↵Anna Zaks
with CompoundLiteralExpr This allows us to trigger the IDC visitor in the added test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176577 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06[analyzer] IDC: Add config option; perform the idc check on first “null ↵Anna Zaks
node” rather than last “non-null”. The second modification does not lead to any visible result, but, theoretically, is what we should have been looking at to begin with since we are checking if the node was assumed to be null in an inlined function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176576 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05Silence a number of static analyzer warnings with assertions and such.Jordan Rose
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176469 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04[analyzer] Don't let cf_audited_transfer override CFRetain semantics.Jordan Rose
We weren't treating a cf_audited_transfer CFRetain as returning +1 because its name doesn't contain "Create" or "Copy". Oops! Fortunately, the standard definitions of these functions are not marked audited. <rdar://problem/13339601> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176463 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-02[analyzer] Simple inline defensive checks suppressionAnna Zaks
Inlining brought a few "null pointer use" false positives, which occur because the callee defensively checks if a pointer is NULL, whereas the caller knows that the pointer cannot be NULL in the context of the given call. This is a first attempt to silence these warnings by tracking the symbolic value along the execution path in the BugReporter. The new visitor finds the node in which the symbol was first constrained to NULL. If the node belongs to a function on the active stack, the warning is reported, otherwise, it is suppressed. There are several areas for follow up work, for example: - How do we differentiate the cases where the first check is followed by another one, which does happen on the active stack? Also, this only silences a fraction of null pointer use warnings. For example, it does not do anything for the cases where NULL was assigned inside a callee. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176402 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01[analyzer] Special-case bitfields when finding sub-region bindings.Jordan Rose
Previously we were assuming that we'd never ask for the sub-region bindings of a bitfield, since a bitfield cannot have subregions. However, unification of code paths has made that assumption invalid. While we could take advantage of this by just checking for the single possible binding, it's probably better to do the right thing, so that if/when we someday support unions we'll do the right thing there, too. This fixes a handful of false positives in analyzing LLVM. <rdar://problem/13325522> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176388 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01[analyzer] Suppress paths involving a reference whose rvalue is null.Jordan Rose
Most map types have an operator[] that inserts a new element if the key isn't found, then returns a reference to the value slot so that you can assign into it. However, if the value type is a pointer, it will be initialized to null. This is usually no problem. However, if the user /knows/ the map contains a value for a particular key, they may just use it immediately: // From ClangSACheckersEmitter.cpp recordGroupMap[group]->Checkers In this case the analyzer reports a null dereference on the path where the key is not in the map, even though the user knows that path is impossible here. They could silence the warning by adding an assertion, but that means splitting up the expression and introducing a local variable. (Note that the analyzer has no way of knowing that recordGroupMap[group] will return the same reference if called twice in a row!) We already have logic that says a null dereference has a high chance of being a false positive if the null came from an inlined function. This patch simply extends that to references whose rvalues are null as well, silencing several false positives in LLVM. <rdar://problem/13239854> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176371 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28[analyzer] RegionStore: collectSubRegionKeys -> collectSubRegionBindingsJordan Rose
By returning the (key, value) binding pairs, we save lookups afterwards. This also enables further work later on. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176230 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27[analyzer] Teach FindLastStoreBRVisitor to understand stores of the same value.Jordan Rose
Consider this case: int *p = 0; p = getPointerThatMayBeNull(); *p = 1; If we inline 'getPointerThatMayBeNull', we might know that the value of 'p' is NULL, and thus emit a null pointer dereference report. However, we usually want to suppress such warnings as error paths, and we do so by using FindLastStoreBRVisitor to see where the NULL came from. In this case, though, because 'p' was NULL both before and after the assignment, the visitor would decide that the "last store" was the initialization, not the re-assignment. This commit changes FindLastStoreBRVisitor to consider all PostStore nodes that assign to this region. This still won't catches changes made directly by checkers if they re-assign the same value, but it does handle the common case in user-written code and will trigger ReturnVisitor's suppression machinery as expected. <rdar://problem/13299738> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176201 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27[analyzer] Turn on C++ constructor inlining by default.Jordan Rose
This enables constructor inlining for types with non-trivial destructors. The plan is to enable destructor inlining within the next month, but that needs further verification. <rdar://problem/12295329> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27[analyzer] Add stop-gap patch to prevent assertion failure when analyzing ↵Ted Kremenek
LLVM codebase. This potentially reduces a performance optimization of throwing away PreStmtPurgeDeadSymbols nodes. I'll investigate the performance impact soon and see if we need something better. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176149 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27[analyzer] If a struct has a partial lazy binding, its fields aren't Undef.Jordan Rose
This is essentially the same problem as r174031: a lazy binding for the first field of a struct may stomp on an existing default binding for the entire struct. Because of the way RegionStore is set up, we can't help but lose the top-level binding, but then we need to make sure that accessing one of the other fields doesn't come back as Undefined. In this case, RegionStore is now correctly detecting that the lazy binding we have isn't the right type, but then failing to follow through on the implications of that: we don't know anything about the other fields in the aggregate. This fix adds a test when searching for other kinds of default values to see if there's a lazy binding we rejected, and if so returns a symbolic value instead of Undefined. The long-term fix for this is probably a new Store model; see <rdar://problem/12701038>. Fixes <rdar://problem/13292559>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176144 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26[analyzer] Use 'MemRegion::printPretty()' instead of assuming the region is ↵Ted Kremenek
a VarRegion. Fixes PR15358 and <rdar://problem/13295437>. Along the way, shorten path diagnostics that say "Variable 'x'" to just be "'x'". By the context, it is obvious that we have a variable, and so this just consumes text space. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176115 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26[analyzer] Don't look through casts when creating pointer temporaries.Jordan Rose
Normally, we need to look through derived-to-base casts when creating temporary object regions (added in r175854). However, if the temporary is a pointer (rather than a struct/class instance), we need to /preserve/ the base casts that have been applied. This also ensures that we really do create a new temporary region when we need to: MaterializeTemporaryExpr and lvalue CXXDefaultArgExprs. Fixes PR15342, although the test case doesn't include the crash because I couldn't isolate it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176069 91177308-0d34-0410-b5e6-96231b3b80d8