]> granicus.if.org Git - clang/log
clang
12 years agoComment semantic analysis: treat function typedefs as functions so that one can
Dmitri Gribenko [Fri, 24 Aug 2012 00:05:30 +0000 (00:05 +0000)]
Comment semantic analysis: treat function typedefs as functions so that one can
use \param and \returns in documentation.

Fixes PR13533.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162507 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a few -Wdocumentation warnings.
Dmitri Gribenko [Fri, 24 Aug 2012 00:01:24 +0000 (00:01 +0000)]
Fix a few -Wdocumentation warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162506 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoNow that ASTMultiPtr is nothing more than a array reference, make it a MutableArrayRef.
Benjamin Kramer [Thu, 23 Aug 2012 23:38:35 +0000 (23:38 +0000)]
Now that ASTMultiPtr is nothing more than a array reference, make it a MutableArrayRef.

This required changing all get() calls to data() and using the simpler constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162501 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[scan-build] Accept -fno-objc-arc as well as -fobjc-arc.
Jordan Rose [Thu, 23 Aug 2012 23:16:34 +0000 (23:16 +0000)]
[scan-build] Accept -fno-objc-arc as well as -fobjc-arc.

This is how Xcode lets individual files be marked as non-ARC when the rest
of the project is ARC-enabled, so this is necessary for scan-build xcodebuild.

Patch by Paul Eipper!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162497 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] For now, treat pointers-to-members as non-null void * symbols.
Jordan Rose [Thu, 23 Aug 2012 23:01:43 +0000 (23:01 +0000)]
[analyzer] For now, treat pointers-to-members as non-null void * symbols.

Until we have full support for pointers-to-members, we can at least
approximate some of their use by tracking null and non-null values.
We thus treat &A::m_ptr as a non-null void * symbol, and MemberPointer(0)
as a pointer-sized null constant.

This enables support for what is sometimes called the "safe bool" idiom,
demonstrated in the test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162495 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Handle UserDefinedConversion casts in C++.
Jordan Rose [Thu, 23 Aug 2012 23:01:39 +0000 (23:01 +0000)]
[analyzer] Handle UserDefinedConversion casts in C++.

This is trivial; the UserDefinedConversion always wraps a CXXMemberCallExpr
for the appropriate conversion function, so it's just a matter of
propagating that value to the CastExpr itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162494 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove ASTOwningVector, it doesn't own anything and provides no value over SmallVector.
Benjamin Kramer [Thu, 23 Aug 2012 22:51:59 +0000 (22:51 +0000)]
Remove ASTOwningVector, it doesn't own anything and provides no value over SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162492 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttaching comments to decls: since it was decided that Decl::isImplicit should
Dmitri Gribenko [Thu, 23 Aug 2012 22:40:40 +0000 (22:40 +0000)]
Attaching comments to decls: since it was decided that Decl::isImplicit should
not be set for implicit instantiations, remove the FIXME.  This should be the
last bit for PR13634.  The actual fix happened in r162238.

Motivation: it might be misleading to mark implicit instantiations as
Decl::isImplicit = true.  Because then, in order to be consistent, we should
mark all instantiated members as implicit.  But the user did actually type the
declaration for the member, but the compiler played with it a little bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162488 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add a few helper function to the MSAsmStmt class that are needed
Chad Rosier [Thu, 23 Aug 2012 21:55:11 +0000 (21:55 +0000)]
[ms-inline asm] Add a few helper function to the MSAsmStmt class that are needed
by CodeGen.

In the long-term, much of the codegen logic will be shared between the GNU-style
and MS-style inline assembly, but for now I'm replicating this logic to avoid
regressions with the GNU-style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162478 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRip out remnants of move semantic emulation and smart pointers in Sema.
Benjamin Kramer [Thu, 23 Aug 2012 21:35:17 +0000 (21:35 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162475 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdded a method to DeclContext that marks the
Sean Callanan [Thu, 23 Aug 2012 21:16:40 +0000 (21:16 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162471 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoChange a bunch of cases where we do "getAs<...>->doSomething()" to
Ted Kremenek [Thu, 23 Aug 2012 20:46:57 +0000 (20:46 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162468 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen disambiguating an expression-statement from a declaraton-statement, if the
Richard Smith [Thu, 23 Aug 2012 20:19:14 +0000 (20:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162464 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Remove an unused argument. This logic can now be reused by the
Chad Rosier [Thu, 23 Aug 2012 20:00:18 +0000 (20:00 +0000)]
[ms-inline asm] Remove an unused argument.  This logic can now be reused by the
ms-style inline asms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162463 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Support C++ default arguments if they are literal values.
Jordan Rose [Thu, 23 Aug 2012 18:10:53 +0000 (18:10 +0000)]
[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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162453 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a bunch of -Wdocumentation warnings.
Dmitri Gribenko [Thu, 23 Aug 2012 17:58:28 +0000 (17:58 +0000)]
Fix a bunch of -Wdocumentation warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162452 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Rename a few induction variables to avoid confusion and silence
Chad Rosier [Thu, 23 Aug 2012 15:44:35 +0000 (15:44 +0000)]
[ms-inline asm] Rename a few induction variables to avoid confusion and silence
a gcc warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162444 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMark these const.
Roman Divacky [Thu, 23 Aug 2012 13:57:21 +0000 (13:57 +0000)]
Mark these const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162443 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix transposed optional / required in Objective-C metadata (GNUstep runtime)
David Chisnall [Thu, 23 Aug 2012 12:17:21 +0000 (12:17 +0000)]
Fix transposed optional / required in Objective-C metadata (GNUstep runtime)

Patch by Niels Grewe!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162441 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttempt to fix clang bootstrap (broken by r162425).
Eli Friedman [Thu, 23 Aug 2012 11:27:56 +0000 (11:27 +0000)]
Attempt to fix clang bootstrap (broken by r162425).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162440 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix undefined behavior: member function calls where 'this' is a null pointer.
Richard Smith [Thu, 23 Aug 2012 06:16:52 +0000 (06:16 +0000)]
Fix undefined behavior: member function calls where 'this' is a null pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162430 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoarray_pod_sort on the addresses of declaration pointers leads to
Douglas Gregor [Thu, 23 Aug 2012 05:05:18 +0000 (05:05 +0000)]
array_pod_sort on the addresses of declaration pointers leads to
inconsistent ordering of results; instead, use use SmallPtrSet to
eliminate duplicates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162429 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix undefined behavior: don't call ObjCInterfaceDecl::isArcWeakrefUnavailable
Richard Smith [Thu, 23 Aug 2012 04:53:18 +0000 (04:53 +0000)]
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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162427 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse the alignment from lvalue emission to more accurately compute the alignment
Eli Friedman [Thu, 23 Aug 2012 03:10:17 +0000 (03:10 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162425 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't recycle loop variables (to keep GCC happy).
Matt Beaumont-Gay [Thu, 23 Aug 2012 01:51:18 +0000 (01:51 +0000)]
Don't recycle loop variables (to keep GCC happy).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162424 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix 80-column violation.
Chad Rosier [Thu, 23 Aug 2012 00:12:51 +0000 (00:12 +0000)]
Fix 80-column violation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162416 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix an assortment of doxygen comment issues found by -Wdocumentation.
Ted Kremenek [Wed, 22 Aug 2012 23:50:41 +0000 (23:50 +0000)]
Fix an assortment of doxygen comment issues found by -Wdocumentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162412 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Compute the inputs and outputs. No test case (yet) as this
Chad Rosier [Wed, 22 Aug 2012 23:42:09 +0000 (23:42 +0000)]
[ms-inline asm] Compute the inputs and outputs.  No test case (yet) as this
requires codegen support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162410 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] c-index-test: Make the printing of the overrides list of a cursor in
Argyrios Kyrtzidis [Wed, 22 Aug 2012 23:15:52 +0000 (23:15 +0000)]
[libclang] c-index-test: Make the printing of the overrides list of a cursor in
a deterministic order, to avoid random test failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162408 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment parsing: parse "<blah" as an HTML tag only if "blah" is a known tag
Dmitri Gribenko [Wed, 22 Aug 2012 22:56:08 +0000 (22:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162407 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Fixup to r162399. Initialize the member variable.
Anna Zaks [Wed, 22 Aug 2012 22:47:58 +0000 (22:47 +0000)]
[analyzer] Fixup to r162399. Initialize the member variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162405 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Refactor code so that we can begin computing the Inputs/Outputs.
Chad Rosier [Wed, 22 Aug 2012 22:10:51 +0000 (22:10 +0000)]
[ms-inline asm] Refactor code so that we can begin computing the Inputs/Outputs.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162403 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add more comments to CallEvent and RuntimeDefinition.
Anna Zaks [Wed, 22 Aug 2012 21:19:59 +0000 (21:19 +0000)]
[analyzer] Add more comments to CallEvent and RuntimeDefinition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162399 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add osx.cocoa.NonNilReturnValue checker.
Anna Zaks [Wed, 22 Aug 2012 21:19:56 +0000 (21:19 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162398 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add comments.
Chad Rosier [Wed, 22 Aug 2012 21:12:19 +0000 (21:12 +0000)]
[ms-inline asm] Add comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162396 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add comments.
Chad Rosier [Wed, 22 Aug 2012 21:08:06 +0000 (21:08 +0000)]
[ms-inline asm] Add comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162394 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add helper function. No functional change intended.
Chad Rosier [Wed, 22 Aug 2012 21:04:07 +0000 (21:04 +0000)]
[ms-inline asm] Add helper function.  No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162393 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Simplify logic. No functional change intended.
Chad Rosier [Wed, 22 Aug 2012 20:57:07 +0000 (20:57 +0000)]
[ms-inline asm] Simplify logic.  No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162392 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReverted clang-check to fully supported CommandLine Library use-case: global
Alexander Kornienko [Wed, 22 Aug 2012 20:52:52 +0000 (20:52 +0000)]
Reverted clang-check to fully supported CommandLine Library use-case: global
static variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162391 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Compute the token range for each instruction within the asm.
Chad Rosier [Wed, 22 Aug 2012 20:30:58 +0000 (20:30 +0000)]
[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().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162388 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDespite me asking Jordan to do r162313, revert it. We can provide
Ted Kremenek [Wed, 22 Aug 2012 19:58:20 +0000 (19:58 +0000)]
Despite me asking Jordan to do r162313, revert it.  We can provide
another way to whitelist these special cases.  This is an intermediate patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162386 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Simplify logic. No functional change intended.
Chad Rosier [Wed, 22 Aug 2012 19:50:28 +0000 (19:50 +0000)]
[ms-inline asm] Simplify logic.  No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162385 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove BasicConstraintManager. It hasn't been in active service for a while.
Ted Kremenek [Wed, 22 Aug 2012 19:47:13 +0000 (19:47 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162384 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Start sending non-simple inline asms to the AsmParser.
Chad Rosier [Wed, 22 Aug 2012 19:18:30 +0000 (19:18 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162382 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake ceil/floor/nearbyint/rint/round const even with -fmath-errno.
Benjamin Kramer [Wed, 22 Aug 2012 18:50:01 +0000 (18:50 +0000)]
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 :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162379 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMath builtin definition tweaks.
Benjamin Kramer [Wed, 22 Aug 2012 18:16:02 +0000 (18:16 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162375 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoASTContext::getCommentForDecl: add comment.
Dmitri Gribenko [Wed, 22 Aug 2012 18:12:19 +0000 (18:12 +0000)]
ASTContext::getCommentForDecl: add comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162374 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttaching comments to declarations: when documentation is requested for an
Dmitri Gribenko [Wed, 22 Aug 2012 17:44:32 +0000 (17:44 +0000)]
Attaching comments to declarations: when documentation is requested for an
implicit instantiation, look for documentation attached to the template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162371 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Restructure discussion of DynamicTypeInfo and RuntimeDefinition.
Jordan Rose [Wed, 22 Aug 2012 17:13:27 +0000 (17:13 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162365 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Per feedback, re-structure the docs for ExprInspection checks.
Jordan Rose [Wed, 22 Aug 2012 17:13:22 +0000 (17:13 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162364 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReduce duplicated hash map lookups.
Benjamin Kramer [Wed, 22 Aug 2012 15:37:55 +0000 (15:37 +0000)]
Reduce duplicated hash map lookups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162361 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMerge existing attributes before processing pragmas in friend template
Rafael Espindola [Wed, 22 Aug 2012 14:52:14 +0000 (14:52 +0000)]
Merge existing attributes before processing pragmas in friend template
declarations.
Fixes pr13662.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162360 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix typo in debug method.
Benjamin Kramer [Wed, 22 Aug 2012 08:38:23 +0000 (08:38 +0000)]
Fix typo in debug method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162352 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRename 'unbindLoc()' (in ProgramState) and 'Remove()' to
Ted Kremenek [Wed, 22 Aug 2012 06:37:46 +0000 (06:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162350 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRename 'currentX' to 'currX' throughout analyzer and libAnalysis.
Ted Kremenek [Wed, 22 Aug 2012 06:26:15 +0000 (06:26 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162349 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRename 'getConjuredSymbol*' to 'conjureSymbol*'.
Ted Kremenek [Wed, 22 Aug 2012 06:26:06 +0000 (06:26 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162348 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove Store::bindDecl() and Store::bindDeclWithNoInit(), and
Ted Kremenek [Wed, 22 Aug 2012 06:00:18 +0000 (06:00 +0000)]
Remove Store::bindDecl() and Store::bindDeclWithNoInit(), and
all forwarding methods.

This functionality is already covered by bindLoc().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162346 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRename 'BindCompoundLiteral' to 'bindCompoundLiteral' and
Ted Kremenek [Wed, 22 Aug 2012 06:00:12 +0000 (06:00 +0000)]
Rename 'BindCompoundLiteral' to 'bindCompoundLiteral' and
add doxygen comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162345 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] IPA document: address Ted's review comments (path
Anna Zaks [Wed, 22 Aug 2012 05:38:38 +0000 (05:38 +0000)]
[analyzer] IPA document: address Ted's review comments (path
bifurcation)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162343 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove stale header file.
Ted Kremenek [Wed, 22 Aug 2012 04:42:05 +0000 (04:42 +0000)]
Remove stale header file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162341 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReview, comment, and reformat IPA.txt, including feedback comments.
Ted Kremenek [Wed, 22 Aug 2012 01:20:05 +0000 (01:20 +0000)]
Review, comment, and reformat IPA.txt, including feedback comments.

Formatting includes:

- removing line wraps (Emacs Cmd-Q), to make text easier to read
- provide useful indentation
- call out caveats and notes more explictly

Stylistically, I prefer the document talk in 3rd person instead of "we".  The
term "we" is unambiguous, and sometimes refers to different things.  I've passed
over the existing paragraphs and made them speak more about specific entities
that compose the analyzer and what they do (e.g., ExprEngine) instead of "we"
referring to the analyzer.

Further, I have substituted some vague concepts such as "state" or "program
state" and replaced them with their precise implementation counterparts (e.g.,
ProgramState).  This makes the document more technically precise throughout the
entire narrative, which would sometimes use vague terms and other times precise
terms.

I've placed several comments within the document, which can be seen with
***TMK/COMMENT***, which indicate places that need to be enhanced or clarified,
or called out as questions about intended bheavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162338 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Document our debug checkers and ExprInspection's "builtins".
Jordan Rose [Wed, 22 Aug 2012 01:03:39 +0000 (01:03 +0000)]
[analyzer] Document our debug checkers and ExprInspection's "builtins".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162336 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoConsilidate SmallPtrSet count() followed by insert() into a single insert().
Ted Kremenek [Wed, 22 Aug 2012 00:02:08 +0000 (00:02 +0000)]
Consilidate SmallPtrSet count() followed by insert() into a single insert().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162330 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Remove the patchMSAsmStrings function. After some discussion
Chad Rosier [Tue, 21 Aug 2012 23:09:21 +0000 (23:09 +0000)]
[ms-inline asm] Remove the patchMSAsmStrings function.  After some discussion
between Bob, Jim, Eric and I, we've decided to take a slightly different
approach.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162327 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd an llvm_unreachable to pacify GCC's -Wreturn-type.
Matt Beaumont-Gay [Tue, 21 Aug 2012 22:27:18 +0000 (22:27 +0000)]
Add an llvm_unreachable to pacify GCC's -Wreturn-type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162325 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomake test pass on linux platforms.
Fariborz Jahanian [Tue, 21 Aug 2012 22:21:43 +0000 (22:21 +0000)]
make test pass on linux platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162324 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Have buildMSAsmString build a vector of unmodified AsmStrings.
Chad Rosier [Tue, 21 Aug 2012 21:56:39 +0000 (21:56 +0000)]
[ms-inline asm] Have buildMSAsmString build a vector of unmodified AsmStrings.
Add a new static function, buildMSAsmPieces, that will break these strings down
into mnemonic and operands.  Upon a match failure, the idea is to use the
ErrorInfo from MatchInstructionImpl to inspect the mnemonic/operand and
decide a course of action.  Unfortunately, there's no easy way to test this at
the moment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162321 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agochange function name in my last patch.
Fariborz Jahanian [Tue, 21 Aug 2012 21:52:02 +0000 (21:52 +0000)]
change function name in my last patch.
// rdar://12103400

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162320 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-C: Change rules for overriding properties in
Fariborz Jahanian [Tue, 21 Aug 2012 21:45:58 +0000 (21:45 +0000)]
objective-C: Change rules for overriding properties in
class extensions a little. clang now allows readonly property
with no ownership rule (assign, unsafe_unretained, weak, retain,
strong, or copy) with a readwrite property with an ownership rule.
// rdar://12103400

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162319 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Set the default IPA mode to 'basic-inlining', which excludes C++.
Jordan Rose [Tue, 21 Aug 2012 21:44:21 +0000 (21:44 +0000)]
[analyzer] Set the default IPA mode to 'basic-inlining', which excludes C++.

Under -analyzer-ipa=basic-inlining, only C functions, blocks, and C++ static
member functions are inlined -- essentially, the calls that behave like simple
C function calls. This is essentially the behavior in Xcode 4.4.

C++ support still has some rough edges, and we don't want users to be worried
about them if they download and run their own checker. (In particular, the
massive number of false positives for analyzing LLVM comes from inlining
defensively-written code in contexts where more aggressive assumptions are
implicitly made. This problem is not unique to C++, but it is exacerbated by
the higher proportion of code that lives in header files in C++.)

The eventual goal is to be comfortable enough with C++ support (and simple
Objective-C support) to advance to -analyzer-ipa=inlining as the default
behavior. See the IPA design notes for more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162318 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] -analyzer-ipa=inlining is now the default. Remove it from tests.
Jordan Rose [Tue, 21 Aug 2012 21:44:07 +0000 (21:44 +0000)]
[analyzer] -analyzer-ipa=inlining is now the default. Remove it from tests.

The actual change here is a little more complicated than the summary above.
What we want to do is have our generic inlining tests run under whatever
mode is the default. However, there are some tests that depend on the
presence of C++ inlining, which still has some rough edges. These tests have
been explicitly marked as -analyzer-ipa=inlining in preparation for a new
mode that limits inlining to C functions and blocks. This will be the
default until the false positives for C++ have been brought down to
manageable levels.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162317 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate comment to match the reality.
Dmitri Gribenko [Tue, 21 Aug 2012 21:35:58 +0000 (21:35 +0000)]
Update comment to match the reality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162316 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCommentBriefParser: allow paragraphs to be separated by line of whitespace.
Dmitri Gribenko [Tue, 21 Aug 2012 21:15:34 +0000 (21:15 +0000)]
CommentBriefParser: allow paragraphs to be separated by line of whitespace.
Skip paragraphs that contain only whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162315 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Push "references are non-null" knowledge up to the common parent.
Jordan Rose [Tue, 21 Aug 2012 20:52:19 +0000 (20:52 +0000)]
[analyzer] Push "references are non-null" knowledge up to the common parent.

This reduces duplication across the Basic and Range constraint managers, and
keeps their internals free of dealing with the semantics of C++. It's still
a little unfortunate that the constraint manager is dealing with this at all,
but this is pretty much the only place to put it so that it will apply to all
symbolic values, even when embedded in larger expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162313 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Do not report a Parser error when matching inline assembly.
Chad Rosier [Tue, 21 Aug 2012 19:37:55 +0000 (19:37 +0000)]
[ms-inline asm] Do not report a Parser error when matching inline assembly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162307 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoModern objc translator: Fixes a crash in rewriter when rewriting the API
Fariborz Jahanian [Tue, 21 Aug 2012 18:56:50 +0000 (18:56 +0000)]
Modern objc translator: Fixes a crash in rewriter when rewriting the API
for structure valued method messaging. // rdar://12142241

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162303 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse LLVM_BUILTIN_TRAP instead of lame volatile int traps.
David Blaikie [Tue, 21 Aug 2012 18:56:49 +0000 (18:56 +0000)]
Use LLVM_BUILTIN_TRAP instead of lame volatile int traps.

(from a todo mentioned in r159469 & originally suggested by Chandler Carruth)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162302 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReduce the amount of state in the Option class by relying on the data from OptTable...
Michael J. Spencer [Tue, 21 Aug 2012 18:51:17 +0000 (18:51 +0000)]
Reduce the amount of state in the Option class by relying on the data from OptTable::Info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162299 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch some realignment calculations over to llvm::RoundUpToAlignment.
Richard Smith [Tue, 21 Aug 2012 18:18:06 +0000 (18:18 +0000)]
Switch some realignment calculations over to llvm::RoundUpToAlignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162297 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Expose the ErrorInfo from the MatchInstructionImpl. In general,
Chad Rosier [Tue, 21 Aug 2012 18:15:08 +0000 (18:15 +0000)]
[ms-inline asm] Expose the ErrorInfo from the MatchInstructionImpl.  In general,
this is the index of the operand that failed to match.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162296 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDeclPrinter, terse mode: don't print function bodies
Dmitri Gribenko [Tue, 21 Aug 2012 17:47:24 +0000 (17:47 +0000)]
DeclPrinter, terse mode: don't print function bodies

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162294 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRename PrintingPolicy::DontRecurseInDeclContext to PrintingPolicy::TerseOutput
Dmitri Gribenko [Tue, 21 Aug 2012 17:36:32 +0000 (17:36 +0000)]
Rename PrintingPolicy::DontRecurseInDeclContext to PrintingPolicy::TerseOutput
to reflect the intention, not the implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162293 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Append identifier for better debugging.
Chad Rosier [Tue, 21 Aug 2012 17:02:27 +0000 (17:02 +0000)]
[ms-inline asm] Append identifier for better debugging.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162289 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Remove this test case and the associated special case code.
Chad Rosier [Tue, 21 Aug 2012 17:01:26 +0000 (17:01 +0000)]
[ms-inline asm] Remove this test case and the associated special case code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162288 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver] Add support for the --param ssp-buffer-size= driver option.
Chad Rosier [Tue, 21 Aug 2012 16:16:06 +0000 (16:16 +0000)]
[driver] Add support for the --param ssp-buffer-size= driver option.
PR9673

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162285 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[asan] If we are compiling with ASan, add metadata indicating dynamically initialized...
Kostya Serebryany [Tue, 21 Aug 2012 06:53:28 +0000 (06:53 +0000)]
[asan] If we are compiling with ASan, add metadata indicating dynamically initialized globals. Patch by Reid Watson, reviewed by Richard Smith

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162259 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix alignment of array of VarDecl* following array of unsigned in LambdaExpr.
Richard Smith [Tue, 21 Aug 2012 05:42:49 +0000 (05:42 +0000)]
Fix alignment of array of VarDecl* following array of unsigned in LambdaExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162255 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen performing a trivial copy of a C++ type, we must be careful not
John McCall [Tue, 21 Aug 2012 04:10:00 +0000 (04:10 +0000)]
When performing a trivial copy of a C++ type, we must be careful not
to overwrite objects that might have been allocated into the type's
tail padding.  This patch is missing some potential optimizations where
the destination is provably a complete object, but it's necessary for
correctness.

Patch by Jonathan Sauer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162254 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAvoid binding a reference to a dereferenced pointer in diagnostic serialization
Richard Smith [Tue, 21 Aug 2012 03:11:53 +0000 (03:11 +0000)]
Avoid binding a reference to a dereferenced pointer in diagnostic serialization
if a diagnostic is emitted outside of any source file. The fix mirrors the
corresponding code in TextDiagnosticPrinter. This required moving the
functional parts of SDiagRenderer into SDiagWriter so they can be reused in the
non-rendering codepath.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162253 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoScrew around with ObjCRuntime some more, changing the
John McCall [Tue, 21 Aug 2012 02:47:43 +0000 (02:47 +0000)]
Screw around with ObjCRuntime some more, changing the
diagnostics for bad deployment targets and adding a few
more predicates.  Includes a patch by Jonathan Schleifer
to enable ARC for ObjFW.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162252 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDeclPrinter: describe what 'terse' output is.
Dmitri Gribenko [Tue, 21 Aug 2012 02:30:28 +0000 (02:30 +0000)]
DeclPrinter: describe what 'terse' output is.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162251 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen this test case was first created it was
Jack Carter [Tue, 21 Aug 2012 00:59:48 +0000 (00:59 +0000)]
When this test case was first created it was
just trying to show it did not crash and burn.

This patch checks that the resultant .ll contents
are correct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162249 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoBetter diagnostics for range-based for loops with bad range types.
Sam Panzer [Tue, 21 Aug 2012 00:52:01 +0000 (00:52 +0000)]
Better diagnostics for range-based for loops with bad range types.

The old error message stating that 'begin' was an undeclared identifier
is replaced with a new message explaining that the error is in the range
expression, along with which of the begin() and end() functions was
problematic if relevant.

Additionally, if the range was a pointer type or defines operator*,
attempt to dereference the range, and offer a FixIt if the modified range
works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162248 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Assume that reference symbols are non-null.
Jordan Rose [Tue, 21 Aug 2012 00:27:33 +0000 (00:27 +0000)]
[analyzer] Assume that reference symbols are non-null.

By doing this in the constraint managers, we can ensure that ANY reference
whose value we don't know gets the effect, even if it's not a top-level
parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162246 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDeclPrinter: add terse output mode and lots of tests
Dmitri Gribenko [Mon, 20 Aug 2012 23:39:06 +0000 (23:39 +0000)]
DeclPrinter: add terse output mode and lots of tests

Add a flag PrintingPolicy::DontRecurseInDeclContext to provide "terse" output
from DeclPrinter.  The motivation is to use DeclPrinter to print declarations
in user-friendly format, without overwhelming user with inner detail of the
declaration being printed.

Also add many tests for DeclPrinter.  There are quite a few things that we
print incorrectly: search for WRONG in DeclPrinterTest.cpp -- and these tests
check our output against incorrect output, so that we can fix/refactor/rewrite
the DeclPrinter later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162245 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a pair of bugs relating to properties in ARC.
John McCall [Mon, 20 Aug 2012 23:36:59 +0000 (23:36 +0000)]
Fix a pair of bugs relating to properties in ARC.

First, when synthesizing an explicitly strong/retain/copy property
of Class type, don't pretend during compatibility checking that the
property is actually assign.  Instead, resolve incompatibilities
by secretly changing the type of *implicitly* __unsafe_unretained
Class ivars to be strong.  This is moderately evil but better than
what we were doing.

Second, when synthesizing the setter for a strong property of
non-retainable type, be sure to use objc_setProperty.  This is
possible when the property is decorated with the NSObject
attribute.  This is an ugly, ugly corner of the language, and
we probably ought to deprecate it.

The first is rdar://problem/12039404;  the second was noticed by
inspection while fixing the first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162244 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReapply:
Eric Christopher [Mon, 20 Aug 2012 23:32:17 +0000 (23:32 +0000)]
Reapply:

Author: Eric Christopher <echristo@apple.com>
Date:   Thu Aug 16 23:50:46 2012 +0000

    Add some caching here for the builtin types.

    rdar://12117935

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162066 91177308-0d34-0410-b5e6-96231b3b80d8

after fixing a thinko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162243 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttaching comments to declarations: ignore implicit decls. Decl::isImplicit()
Dmitri Gribenko [Mon, 20 Aug 2012 22:36:31 +0000 (22:36 +0000)]
Attaching comments to declarations: ignore implicit decls.  Decl::isImplicit()
does not return true for all implicit decls currently.

This should fix PR13634 for now, but Decl::isImplicit() should be fixed, too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162238 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix -Wswitch warning introduced by r162231
David Blaikie [Mon, 20 Aug 2012 22:22:51 +0000 (22:22 +0000)]
Fix -Wswitch warning introduced by r162231

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162236 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused variable.
David Blaikie [Mon, 20 Aug 2012 22:22:48 +0000 (22:22 +0000)]
Remove unused variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162235 91177308-0d34-0410-b5e6-96231b3b80d8