summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Add note why we used a switch.Ted Kremenek2013-02-051-0/+1
| | | | llvm-svn: 174449
* Change subexpressions to be visited in the CFG from left-to-right.Ted Kremenek2013-02-051-19/+56
| | | | | | | | | | | | | | | | | This is a more natural order of evaluation, and it is very important for visualization in the static analyzer. Within Xcode, the arrows will not jump from right to left, which looks very visually jarring. It also provides a more natural location for dataflow-based diagnostics. Along the way, we found a case in the analyzer diagnostics where we needed to indicate that a variable was "captured" by a block. -fsyntax-only timings on sqlite3.c show no visible performance change, although this is just one test case. Fixes <rdar://problem/13016513> llvm-svn: 174447
* [analyzer] add commentAnna Zaks2013-02-051-1/+5
| | | | llvm-svn: 174435
* clang/Analysis: Fix r174245, a valgrind error in ↵NAKAMURA Takumi2013-02-041-0/+1
| | | | | | AnalysisDeclContext::getBody(bool &IsAutosynthesized), to initialize IsAutosynthesized explicitly. llvm-svn: 174303
* [analyzer] Always inline functions with bodies generated by BodyFarm.Anna Zaks2013-02-021-2/+15
| | | | | | | | Inlining these functions is essential for correctness. We often have cases where we do not inline calls. For example, the shallow mode and when reanalyzing previously inlined ObjC methods as top level. llvm-svn: 174245
* -Wuninitialized: warn about uninitialized values resulting from ?: that ↵Ted Kremenek2013-01-191-0/+10
| | | | | | evaluate to lvalues (in C++). llvm-svn: 172875
* Thread-safety analysis: ignore edges from throw expressions in CFG.DeLesley Hutchins2013-01-181-2/+16
| | | | llvm-svn: 172858
* Format strings: don't ever convert %+d to %lu.Jordan Rose2013-01-171-1/+1
| | | | | | | | | | Presumably, if the printf format has the sign explicitly requested, the user wants to treat the data as signed. This is a fix-up for r172739, and also includes several test changes that didn't make it into that commit. llvm-svn: 172762
* Format strings: correct signedness if already correcting width (%d,%u).Jordan Rose2013-01-171-1/+19
| | | | | | | | | | | | It is valid to do this: printf("%u", (int)x); But if we see this: printf("%lu", (int)x); ...our fixit should suggest %d, not %u. llvm-svn: 172739
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-171-7/+5
| | | | | | | | it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). llvm-svn: 172691
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-123-5/+5
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Test commit.Enea Zaffanella2013-01-111-1/+1
| | | | llvm-svn: 172195
* CFG.cpp: Fix wrapping logic when printing block preds/succs.Will Dietz2013-01-071-2/+2
| | | | | | | | | First check only wrapped with i==8, second wrapped at i==2,8,18,28,... This fix restores the intended behavior: i==8,18,28,... Found with -fsanitize=integer. llvm-svn: 171718
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-023-3/+3
| | | | llvm-svn: 171367
* ArrayRefize a CompoundStmt constructor.Nico Weber2012-12-291-3/+1
| | | | llvm-svn: 171238
* [analyzer] Fix typos.Anna Zaks2012-12-211-2/+2
| | | | llvm-svn: 170907
* [analyzer] Re-apply r170826 and make the dumping of the GallGraphAnna Zaks2012-12-211-13/+16
| | | | | | | | | | | | | | | | | | | | | | | deterministic. Commit message for r170826: [analyzer] Traverse the Call Graph in topological order. Modify the call graph by removing the parentless nodes. Instead all nodes are children of root to ensure they are all reachable. Remove the tracking of nodes that are "top level" or global. This information is not used and can be obtained from the Decls stored inside CallGraphNodes. Instead of existing ordering hacks, analyze the functions in topological order over the Call Graph. Together with the addition of devirtualizable ObjC message sends and blocks to the call graph, this gives around 6% performance improvement on several large ObjC benchmarks. llvm-svn: 170906
* Revert r170826. The output ofRafael Espindola2012-12-211-2/+8
| | | | | | | | ./bin/clang -cc1 -internal-isystem /home/espindola/llvm/build/lib/clang/3.3/include/ -analyze -analyzer-checker=debug.DumpCallGraph /home/espindola/llvm/clang/test/Analysis/debug-CallGraph.c -fblocks changes in each run. llvm-svn: 170829
* [analyzer] Traverse the Call Graph in topological order.Anna Zaks2012-12-211-8/+2
| | | | | | | | | | | | | | | | | Modify the call graph by removing the parentless nodes. Instead all nodes are children of root to ensure they are all reachable. Remove the tracking of nodes that are "top level" or global. This information is not used and can be obtained from the Decls stored inside CallGraphNodes. Instead of existing ordering hacks, analyze the functions in topological order over the Call Graph. Together with the addition of devirtualizable ObjC message sends and blocks to the call graph, this gives around 6% performance improvement on several large ObjC benchmarks. llvm-svn: 170826
* [analyzer] Add blocks and ObjC messages to the call graph.Anna Zaks2012-12-211-14/+67
| | | | | | | | | | | This paves the road for constructing a better function dependency graph. If we analyze a function before the functions it calls and inlines, there is more opportunity for optimization. Note, we add call edges to the called methods that correspond to function definitions (declarations with bodies). llvm-svn: 170825
* Thread-safety analysis: check member access on guarded non-primitive types.DeLesley Hutchins2012-12-081-0/+9
| | | | llvm-svn: 169669
* Use the BlockDecl captures list to infer the direct captures for a ↵Ted Kremenek2012-12-061-4/+7
| | | | | | | | | BlockDataRegion. Fixes <rdar://problem/12415065>. We still need to do a recursive walk to determine all static/global variables referenced by a block, which is needed for region invalidation. llvm-svn: 169481
* Format strings: offer a cast to 'unichar' for %C in Objective-C contexts.Jordan Rose2012-12-051-3/+5
| | | | | | | | | | | | | | | | | | | For most cases where a conversion specifier doesn't match an argument, we usually guess that the conversion specifier is wrong. However, if the argument is an integer type and the specifier is %C, it's likely the user really did mean to print the integer as a character. (This is more common than %c because there is no way to specify a unichar literal -- you have to write an integer literal, such as '0x2603', and then cast it to unichar.) This does not change the behavior of %S, since there are fewer cases where printing a literal Unicode *string* is necessary, but this could easily be changed in the future. <rdar://problem/11982013> llvm-svn: 169400
* Format strings: the correct conversion for 'char' is %c, not %d or %hhd.Jordan Rose2012-12-051-1/+1
| | | | | | | We tried to account for 'uint8_t' by saying that /typedefs/ of 'char' should be corrected as %hhd rather than %c, but the condition was wrong. llvm-svn: 169397
* Thread-safety analysis: check locks on method calls, operator=, andDeLesley Hutchins2012-12-051-0/+44
| | | | | | copy constructors. llvm-svn: 169350
* Thread Safety Analysis: refactor to make more methods accept const pointers,DeLesley Hutchins2012-12-051-86/+94
| | | | | | adjust checkAccess. No change in functionality. llvm-svn: 169348
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-0411-26/+23
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Include pruning and general cleanup.Benjamin Kramer2012-12-011-6/+16
| | | | llvm-svn: 169095
* Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't ↵Benjamin Kramer2012-12-013-19/+21
| | | | | | | | | pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092
* Further reduce "-fsyntax-only -Wuninitialized" time on sqlite3.c by another ↵Ted Kremenek2012-11-171-12/+52
| | | | | | 2.5% using intelligent pruning of blocks during the final reporting pass. llvm-svn: 168257
* Switch -Wuninitialized to use a reverse-post order traversal asTed Kremenek2012-11-171-15/+33
| | | | | | | | | an initial baseline for enqueued blocks, but use a simple DFS stack for propagating changes quickly up back edges. This provides a 3.5% reduction in -fsyntax-only time on sqlite3.c. llvm-svn: 168241
* Fix bad CFG construction bug when handling C++ 'try' statements.Ted Kremenek2012-11-131-13/+14
| | | | | | | | | | | | | | | | | This code assigned the last created CFGBlock* to the variable 'Block', which is a scratch variable which is null'ed out after a block is completed. By assigning the last created block to 'Block', we start editing a completed block, inserting CFGStmts that should be in another block. This was the case with 'try'. The test case that showed this had a while loop inside a 'try', and the logic before the while loop was being included as part of the "condition block" for the loop. This showed up as a bogus dead store, but could have lots of implications. Turns out this bug was replicated a few times within CFG.cpp, so I went and fixed up those as well. llvm-svn: 167788
* [analyzer] add LocationContext::inTopFrame() helper.Anna Zaks2012-11-031-0/+4
| | | | llvm-svn: 167351
* Fix potential null deference in CFG printer.Ted Kremenek2012-10-121-2/+2
| | | | llvm-svn: 165836
* Remove dead store.Ted Kremenek2012-10-121-1/+1
| | | | llvm-svn: 165835
* Conditionally use an integral cast for BodyFarm support for ↵Ted Kremenek2012-10-121-6/+19
| | | | | | OSAtomicCompareAndSwap if the return type is not a boolean. llvm-svn: 165774
* Switch over to BodyFarm implementation of OSAtomicCompareAndSwap andTed Kremenek2012-10-111-12/+129
| | | | | | objc_atomicCompareAndSwap. llvm-svn: 165743
* Thread-safety analysis: allow attributes on constructors to refer to 'this'.DeLesley Hutchins2012-10-051-16/+31
| | | | llvm-svn: 165339
* Add FP_CONTRACT support for clang.Lang Hames2012-10-021-1/+1
| | | | | | | | Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). llvm-svn: 164989
* Avoid malloc thrashing in the uninitialized value analysis.Benjamin Kramer2012-09-281-11/+5
| | | | | | | - The size of the packed vector is often small, save mallocs using SmallBitVector. - Copying SmallBitVectors is also cheap, remove a level of indirection. llvm-svn: 164827
* Add clarifying comment.Ted Kremenek2012-09-241-0/+2
| | | | llvm-svn: 164557
* Experiment in BodyFarm of structuring AST creation calls in a hierarchy,Ted Kremenek2012-09-211-12/+21
| | | | | | so that they visually look like an AST dump. llvm-svn: 164401
* Create helper method in BodyFarm for creating simple assignments.Ted Kremenek2012-09-211-4/+12
| | | | llvm-svn: 164400
* Add helper method in BodyFarm to create unary dereferences.Ted Kremenek2012-09-211-8/+11
| | | | llvm-svn: 164399
* Add helper method to BodyFarm for creating lvalue-to-rvalue conversions.Ted Kremenek2012-09-211-9/+12
| | | | llvm-svn: 164397
* Add helper method to BodyFarm for creatinging integral casts.Ted Kremenek2012-09-211-2/+10
| | | | llvm-svn: 164396
* Thread-safety analysis: better handling of unreachable blocks. Fixes a bugDeLesley Hutchins2012-09-211-17/+20
| | | | | | | where a call to function marked 'noreturn' is followed by unreachable implicit destructor calls. llvm-svn: 164394
* Use helper method to create DeclRefExprs in BodyFarm, hopefully allevatingTed Kremenek2012-09-211-20/+34
| | | | | | them being correctly constructed. llvm-svn: 164392
* Add some structuring comments. No functionality change.Ted Kremenek2012-09-211-1/+9
| | | | llvm-svn: 164391
* Add faux-body support for dispatch_once().Ted Kremenek2012-09-211-10/+110
| | | | llvm-svn: 164348
OpenPOWER on IntegriCloud