Commit Graph

39770 Commits

Author SHA1 Message Date
Benjamin Kramer 62b95d88dc Rip out remnants of move semantic emulation and smart pointers in Sema.
These were nops for quite a while and only lead to confusion. ASTMultiPtr
now behaves like a proper dumb array reference.

llvm-svn: 162475
2012-08-23 21:35:17 +00:00
Sean Callanan 845db1087c Added a method to DeclContext that marks the
lookup table as needing to be built.

This is required for LLDB, which provides the
contents of many DeclContexts through a custom
ExternalASTSource.

llvm-svn: 162471
2012-08-23 21:16:40 +00:00
Ted Kremenek 2883175e4c Change a bunch of cases where we do "getAs<...>->doSomething()" to
"castAs<...>->doSomething()".  The analyzer was flagging these
as potential null dereferences, which is technically true.  The
invariants appear to be that these casts should never fail, so
let's use castAs<> instead and avoid a runtime check.

llvm-svn: 162468
2012-08-23 20:46:57 +00:00
Richard Smith 7aed66bbee When disambiguating an expression-statement from a declaraton-statement, if the
statement starts with an identifier for which name lookup will fail either way,
look at later tokens to disambiguate in order to improve error recovery.

llvm-svn: 162464
2012-08-23 20:19:14 +00:00
Chad Rosier 59df25b659 [ms-inline asm] Remove an unused argument. This logic can now be reused by the
ms-style inline asms.

llvm-svn: 162463
2012-08-23 20:00:18 +00:00
Jordan Rose e5d5393efc [analyzer] Support C++ default arguments if they are literal values.
A CXXDefaultArgExpr wraps an Expr owned by a ParmVarDecl belonging to the
called function. In general, ExprEngine and Environment ought to treat this
like a ParenExpr or other transparent wrapper expression, with the inside
expression evaluated first.

However, if we call the same function twice, we'd produce a CFG that contains
the same wrapped expression twice, and we're not set up to handle that. I've
added a FIXME to the CFG builder to come back to that, but meanwhile we can
at least handle expressions that don't need to be explicitly evaluated:
literals. This probably handles many common uses of default parameters:
true/false, null, etc.

Part of PR13385 / <rdar://problem/12156507>

llvm-svn: 162453
2012-08-23 18:10:53 +00:00
Dmitri Gribenko adba9be7c5 Fix a bunch of -Wdocumentation warnings.
llvm-svn: 162452
2012-08-23 17:58:28 +00:00
Chad Rosier 8e0744312b [ms-inline asm] Rename a few induction variables to avoid confusion and silence
a gcc warning.

llvm-svn: 162444
2012-08-23 15:44:35 +00:00
Roman Divacky 497decbd9b Mark these const.
llvm-svn: 162443
2012-08-23 13:57:21 +00:00
David Chisnall 12d8135cd5 Fix transposed optional / required in Objective-C metadata (GNUstep runtime)
Patch by Niels Grewe!

llvm-svn: 162441
2012-08-23 12:17:21 +00:00
Eli Friedman 5d14c48dbb Attempt to fix clang bootstrap (broken by r162425).
llvm-svn: 162440
2012-08-23 11:27:56 +00:00
Richard Smith 802c4b7015 Fix undefined behavior: member function calls where 'this' is a null pointer.
llvm-svn: 162430
2012-08-23 06:16:52 +00:00
Douglas Gregor 7bdc8ae20b array_pod_sort on the addresses of declaration pointers leads to
inconsistent ordering of results; instead, use use SmallPtrSet to
eliminate duplicates.

llvm-svn: 162429
2012-08-23 05:05:18 +00:00
Richard Smith 9db4b0020c Fix undefined behavior: don't call ObjCInterfaceDecl::isArcWeakrefUnavailable
on a null pointer. (This function happens to work for a null 'this' pointer, so
no test.)

llvm-svn: 162427
2012-08-23 04:53:18 +00:00
Eli Friedman a5dd5684dc Use the alignment from lvalue emission to more accurately compute the alignment
of a pointer for builtin emission, instead of just depending on the type of the
pointee.  <rdar://problem/11314941>.

llvm-svn: 162425
2012-08-23 03:10:17 +00:00
Matt Beaumont-Gay 1e774bc835 Don't recycle loop variables (to keep GCC happy).
llvm-svn: 162424
2012-08-23 01:51:18 +00:00
Chad Rosier 0cf0615571 Fix 80-column violation.
llvm-svn: 162416
2012-08-23 00:12:51 +00:00
Ted Kremenek 78094caa56 Fix an assortment of doxygen comment issues found by -Wdocumentation.
llvm-svn: 162412
2012-08-22 23:50:41 +00:00
Chad Rosier f4958d1f10 [ms-inline asm] Compute the inputs and outputs. No test case (yet) as this
requires codegen support.

llvm-svn: 162410
2012-08-22 23:42:09 +00:00
Argyrios Kyrtzidis 079ff5c6da [libclang] c-index-test: Make the printing of the overrides list of a cursor in
a deterministic order, to avoid random test failures.

llvm-svn: 162408
2012-08-22 23:15:52 +00:00
Dmitri Gribenko 107618a6cb Comment parsing: parse "<blah" as an HTML tag only if "blah" is a known tag
name.  This should reduce the amount of warning false positives about bad HTML
in comments when the comment author intended to put a reference to a template.
This change will also enable us parse the comment as intended in these cases.

Fixes part 1 of PR13374.

llvm-svn: 162407
2012-08-22 22:56:08 +00:00
Anna Zaks 9159e16f21 [analyzer] Fixup to r162399. Initialize the member variable.
llvm-svn: 162405
2012-08-22 22:47:58 +00:00
Chad Rosier dc5311aab6 [ms-inline asm] Refactor code so that we can begin computing the Inputs/Outputs.
No functional change intended.

llvm-svn: 162403
2012-08-22 22:10:51 +00:00
Anna Zaks 7d63968d30 [analyzer] Add more comments to CallEvent and RuntimeDefinition.
llvm-svn: 162399
2012-08-22 21:19:59 +00:00
Anna Zaks 5a5a1755f2 [analyzer] Add osx.cocoa.NonNilReturnValue checker.
The checker adds assumptions that the return values from the known APIs
are non-nil. Teach the checker about NSArray/NSMutableArray/NSOrderedSet
objectAtIndex, objectAtIndexedSubscript.

llvm-svn: 162398
2012-08-22 21:19:56 +00:00
Chad Rosier eb7deb2851 [ms-inline asm] Add comments.
llvm-svn: 162396
2012-08-22 21:12:19 +00:00
Chad Rosier 53d79d9905 [ms-inline asm] Add comments.
llvm-svn: 162394
2012-08-22 21:08:06 +00:00
Chad Rosier bb365caf80 [ms-inline asm] Add helper function. No functional change intended.
llvm-svn: 162393
2012-08-22 21:04:07 +00:00
Chad Rosier 6b6a8a363b [ms-inline asm] Simplify logic. No functional change intended.
llvm-svn: 162392
2012-08-22 20:57:07 +00:00
Alexander Kornienko 01387267c7 Reverted clang-check to fully supported CommandLine Library use-case: global
static variables.

llvm-svn: 162391
2012-08-22 20:52:52 +00:00
Chad Rosier 060c0ea89a [ms-inline asm] Compute the token range for each instruction within the asm.
Eventually, we'll need a way of mapping tokens (and their IdentifierInfo*) to
the operands computed by buildMSAsmPieces().

llvm-svn: 162388
2012-08-22 20:30:58 +00:00
Ted Kremenek 326702f1a1 Despite me asking Jordan to do r162313, revert it. We can provide
another way to whitelist these special cases.  This is an intermediate patch.

llvm-svn: 162386
2012-08-22 19:58:20 +00:00
Chad Rosier a766697f4e [ms-inline asm] Simplify logic. No functional change intended.
llvm-svn: 162385
2012-08-22 19:50:28 +00:00
Ted Kremenek a056d62961 Remove BasicConstraintManager. It hasn't been in active service for a while.
As part of this change, I discovered that a few of our tests were not testing
the RangeConstraintManager.  Luckily all of those passed when I moved them
over to use that constraint manager.

llvm-svn: 162384
2012-08-22 19:47:13 +00:00
Chad Rosier d997bd1422 [ms-inline asm] Start sending non-simple inline asms to the AsmParser.
The parser still can't handle all cases, so fall back to emitting a simple
MSAsmStmt if we get into trouble.

llvm-svn: 162382
2012-08-22 19:18:30 +00:00
Benjamin Kramer c4aecf9994 Make ceil/floor/nearbyint/rint/round const even with -fmath-errno.
The conditions described by POSIX can never happen with IEEE-754 floats.
When the function is const we can emit a single sse4.1 instruction for
it, without losing anything :)

llvm-svn: 162379
2012-08-22 18:50:01 +00:00
Benjamin Kramer 6f0bf8049a Math builtin definition tweaks.
There were missed optimizations when the system headers didn't have attributes
in place, specifically:

- Add copysign, exp2, log2, nearbyint, rint and trunc to the list.
  These are functions that get inlined by LLVM's optimizer, but only when they
  have the right attributes.
- Mark copysign, fabs, fmax, fmin and trunc const unconditionally.
  Previously these were only const with -fno-math-errno, but they never set
  errno per POSIX.

For ceil/floor/nearbyint/round I'm not aware of any implementation that sets
errno, but POSIX says it may signal overflow so I left them alone for now.

llvm-svn: 162375
2012-08-22 18:16:02 +00:00
Dmitri Gribenko bfda9f75d6 ASTContext::getCommentForDecl: add comment.
llvm-svn: 162374
2012-08-22 18:12:19 +00:00
Dmitri Gribenko 90631809cb Attaching comments to declarations: when documentation is requested for an
implicit instantiation, look for documentation attached to the template.

llvm-svn: 162371
2012-08-22 17:44:32 +00:00
Jordan Rose 40dd4d9bf3 [analyzer] Restructure discussion of DynamicTypeInfo and RuntimeDefinition.
Since DynamicTypeInfo is not inherently related to inlining or to dynamic
calls, it makes more sense (to me) to discuss it first.

Also fix some typos, massage some grammar, and (hopefully) improve precision
and clarity.

llvm-svn: 162365
2012-08-22 17:13:27 +00:00
Jordan Rose d3d6ac65f8 [analyzer] Per feedback, re-structure the docs for ExprInspection checks.
Also, remove the FIXME about merging -analyzer-stats and the debug.Stats
checker. This would be a bad idea because simply running debug.Stats can
affect the output of -analyzer-stats.

llvm-svn: 162364
2012-08-22 17:13:22 +00:00
Benjamin Kramer fc6eb7d383 Reduce duplicated hash map lookups.
llvm-svn: 162361
2012-08-22 15:37:55 +00:00
Rafael Espindola 0c6c405e23 Merge existing attributes before processing pragmas in friend template
declarations.
Fixes pr13662.

llvm-svn: 162360
2012-08-22 14:52:14 +00:00
Benjamin Kramer 7f19035fe0 Fix typo in debug method.
llvm-svn: 162352
2012-08-22 08:38:23 +00:00
Ted Kremenek 6269888166 Rename 'unbindLoc()' (in ProgramState) and 'Remove()' to
'killBinding()'.  The name is more specific, and one just forwarded
to the other.

Add some doxygen comments along the way.

llvm-svn: 162350
2012-08-22 06:37:46 +00:00
Ted Kremenek d94854a42e Rename 'currentX' to 'currX' throughout analyzer and libAnalysis.
Also rename 'getCurrentBlockCounter()' to 'blockCount()'.

This ripples a bunch of code simplifications; mostly aesthetic,
but makes the code a bit tighter.

llvm-svn: 162349
2012-08-22 06:26:15 +00:00
Ted Kremenek d227833cba Rename 'getConjuredSymbol*' to 'conjureSymbol*'.
No need to have the "get", the word "conjure" is a verb too!
Getting a conjured symbol is the same as conjuring one up.

This shortening is largely cosmetic, but just this simple changed
cleaned up a handful of lines, making them less verbose.

llvm-svn: 162348
2012-08-22 06:26:06 +00:00
Ted Kremenek 1afcb7442f Remove Store::bindDecl() and Store::bindDeclWithNoInit(), and
all forwarding methods.

This functionality is already covered by bindLoc().

llvm-svn: 162346
2012-08-22 06:00:18 +00:00
Ted Kremenek 2cd56c4c6e Rename 'BindCompoundLiteral' to 'bindCompoundLiteral' and
add doxygen comments.

llvm-svn: 162345
2012-08-22 06:00:12 +00:00
Anna Zaks 545588f9ed [analyzer] IPA document: address Ted's review comments (path
bifurcation)

llvm-svn: 162343
2012-08-22 05:38:38 +00:00