summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Implement faux-body-synthesis of well-known functions in the static analyzer ↵Ted Kremenek2012-09-214-6/+160
| | | | | | | | | | | | | | | | | | | | | | | when their implementations are unavailable. Start by simulating dispatch_sync(). This change is largely a bunch of plumbing around something very simple. We use AnalysisDeclContext to conjure up a fake function body (using the current ASTContext) when one does not exist. This is controlled under the analyzer-config option "faux-bodies", which is off by default. The plumbing in this patch is largely to pass the necessary machinery around. CallEvent needs the AnalysisDeclContextManager to get the function definition, as one may get conjured up lazily. BugReporter and PathDiagnosticLocation needed to be relaxed to handle invalid locations, as the conjured body has no real source locations. We do some primitive recovery in diagnostic generation to generate some reasonable locations (for arrows and events), but it can be improved. llvm-svn: 164339
* Thread-safety analysis: fix bug where shared trylock was treatedDeLesley Hutchins2012-09-201-1/+1
| | | | | | as exclusive. llvm-svn: 164332
* Thread safety analysis: properly canonicalize calls to virtual methods withinDeLesley Hutchins2012-09-201-4/+16
| | | | | | lock expressions. llvm-svn: 164324
* Thread-safety analysis: Fix warning when EXCLUSIVE_LOCKS_REQUIREDDeLesley Hutchins2012-09-191-0/+14
| | | | | | is placed on a function that has no path to the exit block. llvm-svn: 164244
* Thread-safety analysis: fix ICE when EXCLUSIVE_LOCKS_REQUIRED orDeLesley Hutchins2012-09-191-2/+5
| | | | | | | LOCKS_EXCLUDED is used on a method with a name that is is not a simple identifier. llvm-svn: 164242
* clang/lib/Analysis/ObjCNoReturn.cpp: Fix [-Wnewline-eof]NAKAMURA Takumi2012-09-131-1/+1
| | | | llvm-svn: 163775
* Format strings: offer a fixit for Darwin's %D/%U/%O to ISO %d/%u/%o.Jordan Rose2012-09-131-0/+23
| | | | | | <rdar://problem/12061922> llvm-svn: 163772
* Format strings: %D, %U, and %O are valid on Darwin (same as %d, %u, %o).Jordan Rose2012-09-133-6/+65
| | | | | | | | | These will warn under -Wformat-non-iso, and will still be rejected outright on other platforms. <rdar://problem/12061922> llvm-svn: 163771
OpenPOWER on IntegriCloud