summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Treat analyzer-synthesized function bodies like implicit bodies.Jordan Rose2013-05-242-6/+12
| | | | | | | | | | | | | | | | When generating path notes, implicit function bodies are shown at the call site, so that, say, copying a POD type in C++ doesn't jump you to a header file. This is especially important when the synthesized function itself calls another function (or block), in which case we should try to jump the user around as little as possible. By checking whether a called function has a body in the AST, we can tell if the analyzer synthesized the body, and if we should therefore collapse the call down to the call site like a true implicitly-defined function. <rdar://problem/13978414> llvm-svn: 182677
* [analyzer; new edges] Properly set location after exiting an inlined call.Jordan Rose2013-05-241-22/+7
| | | | | | | | | | | | | | | | | The new edge algorithm would keep track of the previous location in each location context, so that it could draw arrows coming in and out of each inlined call. However, it tried to access the location of the call before it was actually set (at the CallEnter node). This only affected unterminated calls at the end of a path; calls with visible exit nodes already had a valid location. This patch ditches the location context map, since we're processing the nodes in order anyway, and just unconditionally updates the PrevLoc variable after popping out of an inlined call. <rdar://problem/13983470> llvm-svn: 182676
* Make helper functions static.Benjamin Kramer2013-05-231-2/+2
| | | | llvm-svn: 182589
* [analyzer;alternate edges] fix type that was causing the wrong path piece to ↵Ted Kremenek2013-05-231-1/+1
| | | | | | get removed. llvm-svn: 182562
* Insert explicit casts to try appease overload resolution in the buildbotsPete Cooper2013-05-221-1/+1
| | | | llvm-svn: 182514
* Use scope-resolution operator to hopefully unbreak Windows builds.Ted Kremenek2013-05-221-1/+1
| | | | llvm-svn: 182509
* Simplifiy code using return value of erase().Ted Kremenek2013-05-221-3/+1
| | | | llvm-svn: 182506
* [analyzer; alternate edges] remove redundant adjacent "events" with the same ↵Ted Kremenek2013-05-221-0/+27
| | | | | | | | text. Fixes <rdar://problem/13949982> llvm-svn: 182505
* [analyzer;alternate edges] remove puny edges on the same line that span less ↵Ted Kremenek2013-05-221-2/+70
| | | | | | | | | | | than 3 columns. These are legitimate control-flow edges, but visually they add no value. Implements <rdar://problem/13941325>. llvm-svn: 182502
* Remove unnecessary assignment.Ted Kremenek2013-05-221-2/+0
| | | | llvm-svn: 182501
* [analyzer] Don't crash if a block doesn't have a type signature.Jordan Rose2013-05-222-5/+17
| | | | | | | | | | | Currently, blocks instantiated in templates lose their "signature as written"; it's not clear if this is intentional. Change the analyzer's use of BlockDecl::getSignatureAsWritten to check whether or not the signature is actually there. <rdar://problem/13954714> llvm-svn: 182497
* [analyzer] Do not assert on reports ending in calls within macros.Anna Zaks2013-05-221-1/+7
| | | | | | | | | The crash is triggered by the newly added option (-analyzer-config report-in-main-source-file=true) introduced in r182058. Note, ideally, we’d like to report the issue within the main source file here as well. For now, just do not crash. llvm-svn: 182445
* [analyzer;alternate edges] prune out extra edges to a subexpression where we ↵Ted Kremenek2013-05-211-4/+46
| | | | | | | | dive-in and out of a subexpression. Fixes <rdar://problem/13941891>. llvm-svn: 182426
* [analyzer; alternated edges] look through expressions just like Environment ↵Ted Kremenek2013-05-211-1/+3
| | | | | | does. llvm-svn: 182425
* [analyzer; alternate edges] optimize edges for ObjC fast enumeration loops.Ted Kremenek2013-05-211-4/+49
| | | | | | Fixes <rdar://problem/13942300>. llvm-svn: 182342
* [analyzer] New edges: include an edge to the end-of-path location.Jordan Rose2013-05-181-0/+2
| | | | llvm-svn: 182188
* [analyzer] Add a debug dump for PathPieces, a list of PathDiagnosticPieces.Jordan Rose2013-05-181-0/+54
| | | | | | Originally implemented by Ted, extended by me. llvm-svn: 182186
* Revert "[analyzer; alternate edges] improve support for edges with ↵Jordan Rose2013-05-181-107/+4
| | | | | | | | | | | | | PseudoObjectExprs." Ted and I spent a long time discussing this today and found out that neither the existing code nor the new code was doing what either of us thought it was, which is never good. The good news is we found a much simpler way to fix the motivating test case (an ObjCSubscriptExpr). This reverts r182083, but pieces of it will come back in subsequent commits. llvm-svn: 182185
* [analyzer] Address Jordan's review comments for r182058Anna Zaks2013-05-172-4/+7
| | | | llvm-svn: 182156
* [analyzer; alternate edges] improve support for edges with PseudoObjectExprs.Ted Kremenek2013-05-171-4/+107
| | | | | | | | | | | | | | | | | | This optimizes some spurious edges resulting from PseudoObjectExprs. This required far more changes than I anticipated. The current ParentMap does not record any hierarchy information between a PseudoObjectExpr and its *semantic* expressions that may be wrapped in OpaqueValueExprs, which are the expressions actually laid out in the CFG. This means the arrow pruning logic could not map from an expression to its containing PseudoObjectExprs. To solve this, this patch adds a variant of ParentMap that returns the "semantic" parentage of expressions (essentially as they are viewed by the CFG). This alternate ParentMap is then used by the arrow reducing logic to identify edges into pseudo object expressions, and then eliminate them. llvm-svn: 182083
* [analyzer; alternate edges] treat 'if' statements the same way we do as ↵Ted Kremenek2013-05-171-20/+38
| | | | | | | | | 'for' or 'while'. This means adding an extra edge from the 'if' to the condition, which aesthetically looks more pleasing. llvm-svn: 182079
* [analyzer; alternate edges] don't add an edge incoming from the start of a ↵Ted Kremenek2013-05-171-8/+0
| | | | | | | | function for a nested call. This matches what we do with the first stack frame. llvm-svn: 182078
* [analyzer] Don't inline ~shared_ptr.Jordan Rose2013-05-172-0/+30
| | | | | | | | | | | | | The analyzer can't see the reference count for shared_ptr, so it doesn't know whether a given destruction is going to delete the referenced object. This leads to spurious leak and use-after-free warnings. For now, just ban destructors named '~shared_ptr', which catches std::shared_ptr, std::tr1::shared_ptr, and boost::shared_ptr. PR15987 llvm-svn: 182071
* [analyzer] Add an option to use the last location in the main source file as ↵Anna Zaks2013-05-164-10/+86
| | | | | | | | | | | | | the report location. Previously, we’ve used the last location of the analyzer issue path as the location of the report. This might not provide the best user experience, when one analyzer a source file and the issue appears in the header. Introduce an option to use the last location of the path that is in the main source file as the report location. New option can be enabled with -analyzer-config report-in-main-source-file=true. llvm-svn: 182058
* Provide operator<< for stream output of DeclarationNamesDavid Blaikie2013-05-141-3/+1
| | | | | | | | | | | ASTDumper was already trying to do this & instead got an implicit bool conversion by surprise (thus printing out 0 or 1 instead of the name of the declaration). To avoid that issue & simplify call sites, simply make it the normal/expected operator<<(raw_ostream&, ...) overload & simplify all the existing call sites. (bonus: this function doesn't need to be a member or friend, it's just using public API in DeclarationName) llvm-svn: 181832
* Cleanup handling of UniqueExternalLinkage.Rafael Espindola2013-05-131-1/+1
| | | | | | | | | | | | | This patch renames getLinkage to getLinkageInternal. Only code that needs to handle UniqueExternalLinkage specially should call this. Linkage, as defined in the c++ standard, is provided by getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage. Most places in the compiler actually want isExternallyVisible, which handles UniqueExternalLinkage as internal. llvm-svn: 181677
* [analyzer] Do not check if sys/queue.h file is a system header.Anna Zaks2013-05-101-3/+2
| | | | | | | In most cases it is, by just looking at the name. Also, this check prevents the heuristic from working in strange user settings. radar://13839692 llvm-svn: 181615
* [analyzer; alternate arrows] for "loop back" edges add back the extra edge ↵Ted Kremenek2013-05-091-0/+12
| | | | | | to the closing '}' llvm-svn: 181505
* [analyzer;alternate arrows] adapt 'for' loop aesthetic cleanup to 'while' loops.Ted Kremenek2013-05-091-13/+17
| | | | llvm-svn: 181504
* [analyzer; alternate edges] insert an extra edge for 'for' statements to ↵Ted Kremenek2013-05-081-2/+93
| | | | | | conditions. llvm-svn: 181385
* [analyzer;alternate edges] edges from subexpressions of "?:" are important ↵Ted Kremenek2013-05-081-2/+6
| | | | | | to retain llvm-svn: 181384
* [analyzer;alternate arrows] Fix inconsistencies in recorded location context ↵Ted Kremenek2013-05-071-46/+91
| | | | | | when handling interprocedural paths. llvm-svn: 181362
* [analyzer; alternate arrows] add back recording whether we visited the first ↵Ted Kremenek2013-05-071-0/+2
| | | | | | edge. llvm-svn: 181361
* [analyzer; alternate arrows] remove pruning of loop diagnostics.Ted Kremenek2013-05-071-50/+0
| | | | llvm-svn: 181360
* [analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.Ted Kremenek2013-05-071-1/+6
| | | | llvm-svn: 181359
* [analyzer; alternate arrows] include an edge from the "break" or "continue"Ted Kremenek2013-05-071-0/+5
| | | | llvm-svn: 181358
* [analyzer; alternate arrows] the extra edge to the closing '}' in a loop ↵Ted Kremenek2013-05-071-11/+0
| | | | | | adds no value. llvm-svn: 181357
* [analyzer; alternate arrows] the initializer of a ForStmt isn't interesting ↵Ted Kremenek2013-05-071-12/+20
| | | | | | either. llvm-svn: 181356
* [analyzer] Fix a crash triggered by printing a note on a default argumentAnna Zaks2013-05-071-2/+5
| | | | | | Instead, use the location of the call to print the note. llvm-svn: 181337
* [analyzer; alternate arrows] The ForStmt increment is not a critical anchor ↵Ted Kremenek2013-05-071-1/+10
| | | | | | for arrows. llvm-svn: 181333
* [analyzer; alternate edges] simplify optimization rules to look at ↵Ted Kremenek2013-05-071-99/+12
| | | | | | control-flow conditions to prune edges. llvm-svn: 181292
* [analyzer; alternate arrows] use the terminator condition as the location ↵Ted Kremenek2013-05-071-1/+1
| | | | | | for 'entering loop body' llvm-svn: 181291
* [analyzer; alternate arrows] provide a diagnostic for entering a loop for ↵Ted Kremenek2013-05-071-20/+90
| | | | | | the first time. llvm-svn: 181282
* [analyzer; alternate arrows] don't increment the path iterator when we just ↵Ted Kremenek2013-05-061-13/+22
| | | | | | | | | deleted the next iterator. This is an optimization. It is possible that by deleting the next edge we will pattern match again at the current spot. llvm-svn: 181256
* [analyzer] Remove now-unused bindCompoundLiteral helper function.Jordan Rose2013-05-062-30/+0
| | | | | | | | The one user has been changed to use getLValue on the compound literal expression and then use the normal bindLoc to assign a value. No need to special case this in the StoreManager. llvm-svn: 181214
* [analyzer] Handle CXXTemporaryObjectExprs in compound literals.Jordan Rose2013-05-061-19/+25
| | | | | | | | | | | | This occurs because in C++11 the compound literal syntax can trigger a constructor call via list-initialization. That is, "Point{x, y}" and "(Point){x, y}" end up being equivalent. If this occurs, the inner CXXConstructExpr will have already handled the object construction; the CompoundLiteralExpr just needs to propagate that value forwards. <rdar://problem/13804098> llvm-svn: 181213
* [analyzer;alternate edges] start experimenting with control flow "barriers" ↵Ted Kremenek2013-05-041-14/+102
| | | | | | to prevent an edge being optimized away. llvm-svn: 181088
* [analyzer;alternate edges] ignore parentheses when determining edge levels.Ted Kremenek2013-05-041-3/+3
| | | | llvm-svn: 181087
* [analyzer; alternate edges] - eliminate unnecessary edges where between ↵Ted Kremenek2013-05-041-8/+68
| | | | | | parents and subexpressions. llvm-svn: 181086
* [analyzer; alternate edges] - merge control edges where we descend to a ↵Ted Kremenek2013-05-041-0/+20
| | | | | | subexpression and pop back out. llvm-svn: 181085
OpenPOWER on IntegriCloud