summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* When importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can ↵Argyrios Kyrtzidis2012-09-221-10/+44
| | | | | | | | | | | | point to the FunctionDecl that we are importing the FunctionProtoType for, in which case we'll have infinite recursion when importing. Initially create a FunctionProtoType with null ExceptionSpecDecl/ExceptionSpecTemplate and update the type in ASTNodeImporter::VisitFunctionDecl after the FunctionDecl has been created. llvm-svn: 164450
* [analyzer] Suppress bugs whose paths go through the return of a null pointer.Jordan Rose2012-09-227-13/+140
| | | | | | | | | | | | | | | | | | | | This is a heuristic intended to greatly reduce the number of false positives resulting from inlining, particularly inlining of generic, defensive C++ methods that live in header files. The suppression is triggered in the cases where we ask to track where a null pointer came from, and it turns out that the source of the null pointer was an inlined function call. This change brings the number of bug reports in LLVM from ~1500 down to around ~300, a much more manageable number. Yes, some true positives may be hidden as well, but from what I looked at the vast majority of silenced reports are false positives, and many of the true issues found by the analyzer are still reported. I'm hoping to improve this heuristic further by adding some exceptions next week (cases in which a bug should still be reported). llvm-svn: 164449
* [analyzer] Track a null value back through FindLastStoreBRVisitor.Jordan Rose2012-09-225-225/+879
| | | | | | | Also, tidy up the other tracking visitors so that they mark the right things as interesting and don't do extra work. llvm-svn: 164448
* [analyzer] Always allow BugReporterVisitors to see the bug path.Jordan Rose2012-09-221-21/+57
| | | | | | | | | | | | | | | | | | Before, PathDiagnosticConsumers that did not support actual path output would (sensibly) cause the generation of the full path to be skipped. However, BugReporterVisitors may want to see the path in order to mark a BugReport as invalid. Now, even for a path generation scheme of 'None' we will still create a trimmed graph and walk backwards through the bug path, doing no work other than passing the nodes to the BugReporterVisitors. This isn't cheap, but it's necessary to properly do suppression when the first path consumer does not support path notes. In the future, we should try only generating the path and visitor-provided path notes once, or at least only creating the trimmed graph once. llvm-svn: 164447
* [analyzer] Allow a BugReport to be marked "invalid" during path generation.Jordan Rose2012-09-223-14/+96
| | | | | | | | | | | | | | | | This is intended to allow visitors to make decisions about whether a BugReport is likely a false positive. Currently there are no visitors making use of this feature, so there are no tests. When a BugReport is marked invalid, the invalidator must provide a key that identifies the invaliation (intended to be the visitor type and a context pointer of some kind). This allows us to reverse the decision later on. Being able to reverse a decision about invalidation gives us more flexibility, and allows us to formulate conditions like "this report is invalid UNLESS the original argument is 'foo'". We can use this to fine-tune our false-positive suppression (coming soon). llvm-svn: 164446
* [analyzer] Look through OpaqueValueExprs when tracking a nil value.Jordan Rose2012-09-222-0/+472
| | | | | | | This allows us to show /why/ a particular object is nil, even when it is wrapped in an OpaqueValueExpr. llvm-svn: 164445
* [analyzer] Better path notes for null pointers passed as arguments.Jordan Rose2012-09-222-309/+446
| | | | | | | | | | | | | Rather than saying "Null pointer value stored to 'foo'", we now say "Passing null pointer value via Nth parameter 'foo'", which is much better. The note is also now on the argument expression as well, rather than the entire call. This paves the way for continuing to track arguments back to their sources. <rdar://problem/12211490> llvm-svn: 164444
* Use llvm::getOrdinalSuffix to print ordinal numbers in diagnostics.Jordan Rose2012-09-224-57/+15
| | | | | | Just a refactoring of common infrastructure. No intended functionality change. llvm-svn: 164443
* [analyzer] Check that an ObjCIvarRefExpr's base is non-null even as an lvalue.Jordan Rose2012-09-226-16/+518
| | | | | | | | | | | Like with struct fields, we want to catch cases like this early, so that we can produce better diagnostics and path notes: PointObj *p = nil; int *px = &p->_x; // should warn here *px = 1; llvm-svn: 164442
* [analyzer] Check that a member expr is valid even when the result is an lvalue.Jordan Rose2012-09-223-13/+29
| | | | | | | | | | | We want to catch cases like this early, so that we can produce better diagnostics and path notes: Point *p = 0; int *px = &p->x; // should warn here *px = 1; llvm-svn: 164441
* Fix bug which sometimes resulted in further diagnostics being produced after aRichard Smith2012-09-225-21/+20
| | | | | | | fatal error. Previously, if a fatal error was followed by a diagnostic which was suppressed due to a SFINAETrap, we'd forget that we'd seen a fatal error. llvm-svn: 164437
* [ms-inline asm] Use mnemonicIsValid() in a helpful assert.Chad Rosier2012-09-211-0/+2
| | | | llvm-svn: 164421
* Mark the passed in "self" for a block as an object pointer soEric Christopher2012-09-211-3/+9
| | | | | | | | | that the backend can mark it as the representative pointer for the block. rdar://12001329 llvm-svn: 164418
* Fix build errors.Argyrios Kyrtzidis2012-09-211-2/+4
| | | | llvm-svn: 164417
* [AST importer] Do a correct import of a FunctionProtoType::ExtProtoInfo, ↵Argyrios Kyrtzidis2012-09-211-0/+3
| | | | | | | | | | don't pass nodes from the imported ASTContext. rdar://12348924 llvm-svn: 164416
* objective-C: when diagnosing deprecated/unavailable usage ofFariborz Jahanian2012-09-2110-12/+143
| | | | | | | setter or getter backing a deprecated/unavailable property, also not location of the property. // rdar://12324295 llvm-svn: 164412
* Call CGM.SetLLVMFunctionAttributesForDefinition on thunks so that they getRafael Espindola2012-09-212-2/+19
| | | | | | | attributes like uwtable. Without uwtable a stack unwinder would be unable to go past the thunks. llvm-svn: 164411
* Add four new command line options for MIPS CPU selection:Simon Atanasyan2012-09-214-2/+71
| | | | | | | | -mips32, -mips32r2, -mips64, -mips64r2. The patch reviewed by Eric Christopher. llvm-svn: 164410
* Fix a typo in the PCH internals documentationDouglas Gregor2012-09-211-1/+1
| | | | llvm-svn: 164409
* 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-212-23/+35
| | | | | | | where a call to function marked 'noreturn' is followed by unreachable implicit destructor calls. llvm-svn: 164394
* Re-enable faux-bodies by default.Ted Kremenek2012-09-211-1/+1
| | | | | | Try this again, now that r164392 is in place. llvm-svn: 164393
* 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
* Update comment.Chad Rosier2012-09-211-1/+1
| | | | llvm-svn: 164390
* Use MapVectors to make the order we mark virtual functions used by a vtableRafael Espindola2012-09-211-4/+4
| | | | | | deterministic. Fixes pr13868. llvm-svn: 164382
* Update for encapsulating the "construct*AlignmentFromInt" methods.Bill Wendling2012-09-212-2/+2
| | | | llvm-svn: 164374
* Revert r164364, "Flip "faux-bodies" in the analyzer on by default to flush ↵NAKAMURA Takumi2012-09-211-1/+1
| | | | | | | | out bugs." It crashed test/Analysis/Output/blocks.m on some hosts. llvm-svn: 164368
* Make warnings about uninitialized fields include the field name.Hans Wennborg2012-09-216-40/+38
| | | | | | | | | | | This makes the wording more informative, and consistent with the other warnings about uninitialized variables. Also, me and David who reviewed this couldn't figure out why we would need to do a lookup to get the name of the variable; so just print the name directly. llvm-svn: 164366
* Flip "faux-bodies" in the analyzer on by default to flush out bugs.Ted Kremenek2012-09-211-1/+1
| | | | llvm-svn: 164364
* Simplify getRuntimeDefinition() back to taking no arguments.Ted Kremenek2012-09-214-25/+26
| | | | llvm-svn: 164363
* Doxygen-ify a comment.Craig Topper2012-09-211-4/+4
| | | | llvm-svn: 164360
* PR13890: Warn on abstract final classes.David Blaikie2012-09-214-0/+16
| | | | llvm-svn: 164359
* [PCH] After deserializing a DeclContext, if it has external lexical decls ↵Argyrios Kyrtzidis2012-09-213-0/+30
| | | | | | | | | | | | | | but not external visible decls, call DeclContext::setMustBuildLookupTable so that the "lazy decls" bit of the LookupPtr is set. Previously, in non-C++, if there were no new declarations causing the "lazy decls" bit to be set, then DeclContext::lookups_begin() would fail to return the decls from the PCH. Fixes rdar://12316296. llvm-svn: 164351
* Add faux-body support for dispatch_once().Ted Kremenek2012-09-212-10/+422
| | | | llvm-svn: 164348
* ARM: Use a dedicated intrinsic for vector bitwise select.Jim Grosbach2012-09-212-2/+6
| | | | | | | | | | | The expression based expansion too often results in IR level optimizations splitting the intermediate values into separate basic blocks, preventing the formation of the VBSL instruction as the code author intended. In particular, LICM would often hoist part of the computation out of a loop. rdar://11011471 llvm-svn: 164342
* Tidy up. Trailing whitespace and 80 columns.Jim Grosbach2012-09-211-67/+69
| | | | llvm-svn: 164341
* Implement faux-body-synthesis of well-known functions in the static analyzer ↵Ted Kremenek2012-09-2115-38/+1680
| | | | | | | | | | | | | | | | | | | | | | | 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
* Constify method.Ted Kremenek2012-09-211-1/+1
| | | | llvm-svn: 164338
* Ensure that the Decl* wrapped by an AnalysisDeclContext cannot be changed afterTed Kremenek2012-09-211-1/+1
| | | | | | construction. llvm-svn: 164337
* Remove unused fields.Ted Kremenek2012-09-211-3/+0
| | | | llvm-svn: 164336
* Serialize the 'IsConstexpr' bit of VarDecls. Fixes <rdar://problem/12328814>.Douglas Gregor2012-09-203-1/+16
| | | | llvm-svn: 164335
* Thread-safety analysis: fix bug where shared trylock was treatedDeLesley Hutchins2012-09-202-1/+31
| | | | | | as exclusive. llvm-svn: 164332
* Thread safety analysis: properly canonicalize calls to virtual methods withinDeLesley Hutchins2012-09-202-4/+48
| | | | | | lock expressions. llvm-svn: 164324
* If the range in a for range statement doesn't have a viable begin/end function,Richard Smith2012-09-205-36/+70
| | | | | | | | | | | | | but can be dereferenced to form an expression which does have viable begin/end functions, then typo-correct the range, even if something else goes wrong with the statement (such as inaccessible begin/end or the wrong type of loop variable). In order to ensure we recover correctly and produce any followup diagnostics in this case, redo semantic analysis on the for-range statement outside of the diagnostic trap, after issuing the typo-correction. llvm-svn: 164323
* Fix typo. (s/Explided/Exploded/)David Blaikie2012-09-201-1/+1
| | | | | | Patch by Sean McBride. llvm-svn: 164318
OpenPOWER on IntegriCloud