]> granicus.if.org Git - clang/log
clang
12 years ago[analyzer] Correctly devirtualize virtual method calls in destructors.
Jordan Rose [Wed, 15 Aug 2012 00:51:56 +0000 (00:51 +0000)]
[analyzer] Correctly devirtualize virtual method calls in destructors.

C++11 [class.cdtor]p4: When a virtual function is called directly or
  indirectly from a constructor or from a destructor, including during
  the construction or destruction of the class’s non-static data members,
  and the object to which the call applies is the object under
  construction or destruction, the function called is the final overrider
  in the constructor's or destructor's class and not one overriding it in
  a more-derived class.

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

12 years ago[ms-inline asm] Add support for clobbers in CodeGen.
Chad Rosier [Wed, 15 Aug 2012 00:43:09 +0000 (00:43 +0000)]
[ms-inline asm] Add support for clobbers in CodeGen.

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

12 years ago[ms-inline asm] Have MC start parsing the asms.
Chad Rosier [Wed, 15 Aug 2012 00:42:47 +0000 (00:42 +0000)]
[ms-inline asm] Have MC start parsing the asms.

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

12 years ago[ms-inline asm] Mark getClobber() const.
Chad Rosier [Wed, 15 Aug 2012 00:41:20 +0000 (00:41 +0000)]
[ms-inline asm] Mark getClobber() const.

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

12 years ago[analyzer] A base class needs a complete definition to provide offsets.
Jordan Rose [Wed, 15 Aug 2012 00:36:44 +0000 (00:36 +0000)]
[analyzer] A base class needs a complete definition to provide offsets.

No test case yet; trying to reduce one from a failing internal buildbot.

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

12 years agoCheck local static variables for self reference on initialization.
Richard Trieu [Tue, 14 Aug 2012 23:50:52 +0000 (23:50 +0000)]
Check local static variables for self reference on initialization.

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

12 years ago[ms-inline asm] More test cases to make sure buildMSAsmString() doesn't regress.
Chad Rosier [Tue, 14 Aug 2012 23:48:41 +0000 (23:48 +0000)]
[ms-inline asm] More test cases to make sure buildMSAsmString() doesn't regress.

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

12 years ago[ms-inline asm] Remove the last bits of LineEnds.
Chad Rosier [Tue, 14 Aug 2012 23:14:45 +0000 (23:14 +0000)]
[ms-inline asm] Remove the last bits of LineEnds.

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

12 years agoRemove trailing return flag from FunctionTypeLoc, since we now carry that
Richard Smith [Tue, 14 Aug 2012 22:51:13 +0000 (22:51 +0000)]
Remove trailing return flag from FunctionTypeLoc, since we now carry that
information on FunctionProtoType. (This also fixes one of *many* misalignment
problems in the TypeLoc hierarchy...)

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

12 years agoFix undefined behavior: reference bound to dereferenced null pointer.
Richard Smith [Tue, 14 Aug 2012 22:37:22 +0000 (22:37 +0000)]
Fix undefined behavior: reference bound to dereferenced null pointer.

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

12 years ago[ms-inline asm] Simplify more logic by using the Token::hasLeadingSpace() and
Chad Rosier [Tue, 14 Aug 2012 22:11:17 +0000 (22:11 +0000)]
[ms-inline asm] Simplify more logic by using the Token::hasLeadingSpace() and
Token::isAtStartOfLine() APIs.

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

12 years agoSmall change to avoid confusion on what "used by" means for a compiler.
Rafael Espindola [Tue, 14 Aug 2012 21:58:29 +0000 (21:58 +0000)]
Small change to avoid confusion on what "used by" means for a compiler.
Patch by Jonathan Sauer.

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

12 years ago[ms-inline asm] Address a potential buffer overflow.
Chad Rosier [Tue, 14 Aug 2012 21:48:01 +0000 (21:48 +0000)]
[ms-inline asm] Address a potential buffer overflow.

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

12 years ago[ms-inline asm] Simplify the logic in patchMSAsmString. We no longer need to
Chad Rosier [Tue, 14 Aug 2012 20:58:21 +0000 (20:58 +0000)]
[ms-inline asm] Simplify the logic in patchMSAsmString.  We no longer need to
track the LineEnds now that single line asm statments aren't merged.

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

12 years agoirgen: inline code for several of complex builtin
Fariborz Jahanian [Tue, 14 Aug 2012 20:09:28 +0000 (20:09 +0000)]
irgen: inline code for several of complex builtin
calls. // rdar://8315199

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

12 years ago[ms-inline asm] Add a helpful assert.
Chad Rosier [Tue, 14 Aug 2012 19:22:06 +0000 (19:22 +0000)]
[ms-inline asm] Add a helpful assert.

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

12 years ago[analyzer]Assume that the properties cannot be overridden when dot
Anna Zaks [Tue, 14 Aug 2012 19:19:18 +0000 (19:19 +0000)]
[analyzer]Assume that the properties cannot be overridden when dot
syntax is used.

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

12 years ago[analyzer] Address Jordan's comments for r161822, r161683.
Anna Zaks [Tue, 14 Aug 2012 18:35:06 +0000 (18:35 +0000)]
[analyzer] Address Jordan's comments for r161822, r161683.

Add a TODO test case for r161822 - calling self from a class method.

Remove a TODO comment for r161683 - value2 is not a property - we just
have method names that look like they are getters/setters for a
property.

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

12 years agoAvoid using i64 types for vld1q_lane/vst1q_lane intrinsics.
Bob Wilson [Tue, 14 Aug 2012 17:27:04 +0000 (17:27 +0000)]
Avoid using i64 types for vld1q_lane/vst1q_lane intrinsics.

The backend has to legalize i64 types by splitting them into two 32-bit pieces,
which leads to poor quality code.  If we produce code for these intrinsics that
uses one-element vector types, which can live in Neon vector registers without
getting split up, then the generated code is much better.  Radar 11998303.

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

12 years agoAttaching comments to redeclarations: fix wrong assumptions
Dmitri Gribenko [Tue, 14 Aug 2012 17:17:18 +0000 (17:17 +0000)]
Attaching comments to redeclarations: fix wrong assumptions

The reason for the recent fallout for "attaching comments to any redeclaration"
change are two false assumptions:
(1) a RawComment is attached to a single decl (not true for 'typedef struct X *Y'
    where we want the comment to be attached to both X and Y);
(2) the whole redeclaration chain has only a single comment (obviously false, the
    user can put a separate comment for each redeclaration).

To fix (1) I revert the part of the recent change where a 'Decl*' member was
introduced to RawComment.  Now ASTContext has a separate DenseMap for mapping
'Decl*' to 'FullComment*'.

To fix (2) I just removed the test with this assumption.  We might not parse
every comment in redecl chain if we already parsed at least one.

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

12 years agoChanging an enumeration to a const int to fix MSVC compiler warnings.
Aaron Ballman [Tue, 14 Aug 2012 16:46:35 +0000 (16:46 +0000)]
Changing an enumeration to a const int to fix MSVC compiler warnings.

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

12 years ago[analyzer] Remove other #if 0 from Retain Count checker.
Anna Zaks [Tue, 14 Aug 2012 15:39:13 +0000 (15:39 +0000)]
[analyzer] Remove other #if 0 from Retain Count checker.

These date back to 2009, 2011.

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

12 years ago[analyzer] Remove autorelease pools code from the Retain Count checker.
Anna Zaks [Tue, 14 Aug 2012 15:39:09 +0000 (15:39 +0000)]
[analyzer] Remove autorelease pools code from the Retain Count checker.

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

12 years agoDo NOT use inline functions with LLVM_ATTRIBUTE_USED.
Benjamin Kramer [Tue, 14 Aug 2012 14:50:32 +0000 (14:50 +0000)]
Do NOT use inline functions with LLVM_ATTRIBUTE_USED.

The function will be emitted into every single TU including the header!

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

12 years agoRemove and simplify unused checking code.
Benjamin Kramer [Tue, 14 Aug 2012 13:24:39 +0000 (13:24 +0000)]
Remove and simplify unused checking code.

This is already handled by CheckCallingConvAttr.

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

12 years agoFix horribly broken sema of __attribute__((pcs())).
Benjamin Kramer [Tue, 14 Aug 2012 13:13:47 +0000 (13:13 +0000)]
Fix horribly broken sema of __attribute__((pcs())).

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

12 years agoAdded description of clang-check -ast-dump* options.
Alexander Kornienko [Tue, 14 Aug 2012 08:31:51 +0000 (08:31 +0000)]
Added description of clang-check -ast-dump* options.

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

12 years agoEmphasize that clang-fixit is planned but not yet contributed. I should
Chandler Carruth [Tue, 14 Aug 2012 07:36:05 +0000 (07:36 +0000)]
Emphasize that clang-fixit is planned but not yet contributed. I should
really just push the initial version....

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

12 years agoFix some of my terrible spelling.
Chandler Carruth [Tue, 14 Aug 2012 07:21:00 +0000 (07:21 +0000)]
Fix some of my terrible spelling.

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

12 years agoAdd initial documentation about the new tools repository and the
Chandler Carruth [Tue, 14 Aug 2012 07:19:09 +0000 (07:19 +0000)]
Add initial documentation about the new tools repository and the
structure of how we're building concrete tools as well as tooling
infrastructure as part of the Clang project.

This documentation is definitely still rough. If anyone can improve it,
flesh it out, or help structure it in a more natural way, please, help!
=] This is not my forte, and patches here are more than welcome!

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

12 years ago[analyzer] Fixup to r161821
Anna Zaks [Tue, 14 Aug 2012 05:31:46 +0000 (05:31 +0000)]
[analyzer] Fixup to r161821

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

12 years agoFix undefined behavior: don't bind a dereferenced null pointer to a reference.
Richard Smith [Tue, 14 Aug 2012 04:19:29 +0000 (04:19 +0000)]
Fix undefined behavior: don't bind a dereferenced null pointer to a reference.
No functionality change.

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

12 years agoPlacate the mingw32 buildbot by suffixing 64-bit constants with ULL.
Richard Smith [Tue, 14 Aug 2012 03:55:16 +0000 (03:55 +0000)]
Placate the mingw32 buildbot by suffixing 64-bit constants with ULL.

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

12 years agoFix undefined behavior in code completion, caught by
Richard Smith [Tue, 14 Aug 2012 03:13:00 +0000 (03:13 +0000)]
Fix undefined behavior in code completion, caught by
-fcatch-undefined-behavior. Don't try to fit 34 different flags
into 32 bits. Also, don't use 32-bit signed left shifts for this.

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

12 years agoMake __is_convertible_to handle abstract types correctly. PR13591.
Eli Friedman [Tue, 14 Aug 2012 02:06:07 +0000 (02:06 +0000)]
Make __is_convertible_to handle abstract types correctly.  PR13591.

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

12 years agoFix undefined behavior (and wrong code, as far as I can tell) in NEON builtin
Richard Smith [Tue, 14 Aug 2012 01:28:02 +0000 (01:28 +0000)]
Fix undefined behavior (and wrong code, as far as I can tell) in NEON builtin
tablegen code, found by -fcatch-undefined-behavior. I would appreciate if
someone more familiar with the NEON code could point me in the direction of how
to write a test for this. We appear to have essentially no test coverage
whatsoever for these builtins.

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

12 years agoClean up the basic instructions for getting started with clang to always
Chandler Carruth [Tue, 14 Aug 2012 00:41:30 +0000 (00:41 +0000)]
Clean up the basic instructions for getting started with clang to always
return to the same directory.

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

12 years ago[analyzer] Teach live variable analyzes that super uses self pointer.
Anna Zaks [Tue, 14 Aug 2012 00:36:20 +0000 (00:36 +0000)]
[analyzer] Teach live variable analyzes that super uses self pointer.

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

12 years ago[analyzer] Disable autorelease pool tracking.
Anna Zaks [Tue, 14 Aug 2012 00:36:17 +0000 (00:36 +0000)]
[analyzer] Disable autorelease pool tracking.

The autorelease pool has not been implemented completely: we were adding
the autoreleased symbols to the state, but never looking at them. Until
we have a complete implementation, remove the overhead and comment out
the unused code.

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

12 years ago[analyzer] Refactor RetainReleaseChecker to go through a function call
Anna Zaks [Tue, 14 Aug 2012 00:36:15 +0000 (00:36 +0000)]
[analyzer] Refactor RetainReleaseChecker to go through a function call
to set/get/remove the RefBinding.

No functional change here. Having these setter and getter methods will
make it much easier when replacing the underlining representation of
RefBindings (I just went through the exercise). It makes the code more
readable as well.

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

12 years ago[analyzer] Add getStackFrame() to CheckerContext and ExplodedNode.
Anna Zaks [Tue, 14 Aug 2012 00:36:12 +0000 (00:36 +0000)]
[analyzer] Add getStackFrame() to CheckerContext and ExplodedNode.

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

12 years ago[analyzer] Look up DynamicTypeInfo by region instead of symbol.
Jordan Rose [Mon, 13 Aug 2012 23:59:07 +0000 (23:59 +0000)]
[analyzer] Look up DynamicTypeInfo by region instead of symbol.

This allows us to store type info for non-symbolic regions.

No functionality change.

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

12 years ago[analyzer] Reduce code duplication: make CXXDestructorCall a CXXInstanceCall.
Jordan Rose [Mon, 13 Aug 2012 23:46:05 +0000 (23:46 +0000)]
[analyzer] Reduce code duplication: make CXXDestructorCall a CXXInstanceCall.

While there is now some duplication between SimpleCall and the CXXInstanceCall
sub-hierarchy, this is much better than copy-and-pasting the devirtualization
logic shared by both instance methods and destructors.

An unfortunate side effect is that there is no longer a single CallEvent type
that corresponds to "calls written as CallExprs". For the most part this is a
good thing, but the checker callback eval::Call still takes a CallExpr rather
than a CallEvent (since we're not sure if we want to allow checkers to
evaluate other kinds of calls). A mistake here will be caught by a cast<> in
CheckerManager::runCheckersForEvalCall.

No functionality change.

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

12 years ago[analyzer] Be more careful when downcasting for devirtualization.
Jordan Rose [Mon, 13 Aug 2012 23:46:01 +0000 (23:46 +0000)]
[analyzer] Be more careful when downcasting for devirtualization.

Virtual base regions are never layered, so simply stripping them off won't
necessarily get you to the correct casted class. Instead, what we want is
the same logic for evaluating dynamic_cast: strip off base regions if possible,
but add new base regions if necessary.

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

12 years ago[analyzer] Handle dynamic_casts that turn out to be upcasts.
Jordan Rose [Mon, 13 Aug 2012 22:11:42 +0000 (22:11 +0000)]
[analyzer] Handle dynamic_casts that turn out to be upcasts.

This can occur with multiple inheritance, which jumps from one parent to
the other, and with virtual inheritance, since virtual base regions always
wrap the actual object and can't be nested within other base regions.

This also exposed some incorrect logic for multiple inheritance: even if B
is known not to derive from C, D might still derive from both of them.

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

12 years ago[analyzer] Don't strip CXXBaseObjectRegions when checking dynamic_casts.
Jordan Rose [Mon, 13 Aug 2012 22:11:34 +0000 (22:11 +0000)]
[analyzer] Don't strip CXXBaseObjectRegions when checking dynamic_casts.

...and /do/ strip CXXBaseObjectRegions when casting to a virtual base class.

This allows us to enforce the invariant that a CXXBaseObjectRegion can always
provide an offset for its base region if its base region has a known class
type, by only allowing virtual bases and direct non-virtual bases to form
CXXBaseObjectRegions.

This does mean some slight problems for our modeling of dynamic_cast, which
needs to be resolved by finding a path from the current region to the class
we're trying to cast to.

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

12 years ago[ms-inline asm] Add a helpful assert.
Chad Rosier [Mon, 13 Aug 2012 22:04:09 +0000 (22:04 +0000)]
[ms-inline asm] Add a helpful assert.

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

12 years ago[ms-inline asm] Address a potential buffer overflow.
Chad Rosier [Mon, 13 Aug 2012 21:35:47 +0000 (21:35 +0000)]
[ms-inline asm] Address a potential buffer overflow.

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

12 years agoPR13570: When an unresolved overloaded call appeared in a dependent context, we
Richard Smith [Mon, 13 Aug 2012 21:29:18 +0000 (21:29 +0000)]
PR13570: When an unresolved overloaded call appeared in a dependent context, we
forgot to set it as being instantiation-dependent as well as being type- and
value-dependent.

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

12 years agoARM: enable struct byval for AAPCS-VFP.
Manman Ren [Mon, 13 Aug 2012 21:23:55 +0000 (21:23 +0000)]
ARM: enable struct byval for AAPCS-VFP.

rdar://9877866

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

12 years agoc: small refactoring of checking for __attribute__(const))
Fariborz Jahanian [Mon, 13 Aug 2012 21:15:02 +0000 (21:15 +0000)]
c: small refactoring of checking for __attribute__(const))
per Richard's comment.

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

12 years ago[ms-inline asm] Have patchMSAsmStrings() return a vector or AsmStrings.
Chad Rosier [Mon, 13 Aug 2012 20:32:07 +0000 (20:32 +0000)]
[ms-inline asm] Have patchMSAsmStrings() return a vector or AsmStrings.

The AsmParser expects a single asm instruction, but valid ms-style inline asm
statements may contain  multiple instructions.

This happens with asm blocks

__asm {
  mov ebx, eax
  mov ecx, ebx
}

or when multiple asm statements are adjacent to one another

__asm mov ebx, eax
__asm mov ecx, ebx

and

__asm mov ebx, eax __asm mov ecx, ebx

Currently, asm blocks are not properly handled.

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

12 years agoFactor out computation of whether a typeid's expression is potentially
Richard Smith [Mon, 13 Aug 2012 20:08:14 +0000 (20:08 +0000)]
Factor out computation of whether a typeid's expression is potentially
evaluated into a CXXTypeid member function. No functionality change.

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

12 years agoMinor rework of code example for clarity. No functionality change
Marshall Clow [Mon, 13 Aug 2012 18:56:38 +0000 (18:56 +0000)]
Minor rework of code example for clarity. No functionality change

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

12 years agoc: make __has_attribute(const) work for const
Fariborz Jahanian [Mon, 13 Aug 2012 18:04:58 +0000 (18:04 +0000)]
c: make __has_attribute(const) work for const
function attribute. // rdar://10253857

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

12 years agoIgnore the tools/extra directory.
David Blaikie [Mon, 13 Aug 2012 17:51:45 +0000 (17:51 +0000)]
Ignore the tools/extra directory.

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

12 years agoTeach Git to ignore the tools/extra directory.
David Blaikie [Mon, 13 Aug 2012 17:45:30 +0000 (17:45 +0000)]
Teach Git to ignore the tools/extra directory.

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

12 years agoWhen looking for the comment associated with a declaration, adjust the
Douglas Gregor [Mon, 13 Aug 2012 16:37:30 +0000 (16:37 +0000)]
When looking for the comment associated with a declaration, adjust the
'templated' declaration for a function or class template to refer to
the function or class template itself, to which the documentation will
be attached. Fixes PR13593.

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

12 years agoWhen the header file search resolves a quoted include to a file in the
Douglas Gregor [Mon, 13 Aug 2012 15:47:39 +0000 (15:47 +0000)]
When the header file search resolves a quoted include to a file in the
current directory, propagate the framework and in-index-header-map
from the including header's information down to the included header's
information. Fixes <rdar://problem/11261291>.

As with everything header-map related, we can't really test this in
isolation within Clang, so it's tested elsewhere.

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

12 years agoImplemented -ast-dump, -ast-print, -ast-dump-filter options in clang-check
Alexander Kornienko [Mon, 13 Aug 2012 10:50:08 +0000 (10:50 +0000)]
Implemented -ast-dump, -ast-print, -ast-dump-filter options in clang-check

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

12 years agoAdded some preprocessor memory usage stats to -cc1 -print-stats
Alexander Kornienko [Mon, 13 Aug 2012 10:46:42 +0000 (10:46 +0000)]
Added some preprocessor memory usage stats to -cc1 -print-stats

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

12 years agoThis is always going to be true so the cast isn't necessary.
Eric Christopher [Mon, 13 Aug 2012 02:07:42 +0000 (02:07 +0000)]
This is always going to be true so the cast isn't necessary.

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

12 years agoAttaching comments to declarations: find comment attached to any redeclaration
Dmitri Gribenko [Sat, 11 Aug 2012 00:51:43 +0000 (00:51 +0000)]
Attaching comments to declarations: find comment attached to any redeclaration

Not only look for the comment near the declaration itself, but also walk the
redeclaration chain: the previous declaration might have had a documentation
comment.

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

12 years ago[analyzer] Remove unused StoreManager::CastResult class.
Jordan Rose [Fri, 10 Aug 2012 22:43:32 +0000 (22:43 +0000)]
[analyzer] Remove unused StoreManager::CastResult class.

No functionality change.

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

12 years agoRemoved an unused function I added a while back.
Fariborz Jahanian [Fri, 10 Aug 2012 22:28:13 +0000 (22:28 +0000)]
Removed an unused function I added a while back.

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

12 years ago[analyzer] Strip CXXBaseObjectRegions when devirtualizing method calls.
Jordan Rose [Fri, 10 Aug 2012 22:26:46 +0000 (22:26 +0000)]
[analyzer] Strip CXXBaseObjectRegions when devirtualizing method calls.

This was causing a crash when we tried to re-apply a base object region to
itself. It probably also caused incorrect offset calculations in RegionStore.

PR13569 / <rdar://problem/12076683>

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

12 years ago[analyzer] Try to devirtualize even if the static callee has no definition.
Jordan Rose [Fri, 10 Aug 2012 22:26:43 +0000 (22:26 +0000)]
[analyzer] Try to devirtualize even if the static callee has no definition.

This mostly affects pure virtual methods, but would also affect parent
methods defined inline in the header when analyzing the child's source file.

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

12 years ago[analyzer] Add clang_analyzer_checkInlined for debugging purposes.
Jordan Rose [Fri, 10 Aug 2012 22:26:29 +0000 (22:26 +0000)]
[analyzer] Add clang_analyzer_checkInlined for debugging purposes.

This check is also accessible through the debug.ExprInspection checker.
Like clang_analyzer_eval, you can use it to test the analyzer engine's
current state; the argument should be true or false to indicate whether or
not you expect the function to be inlined.

When used in the positive case (clang_analyzer_checkInlined(true)), the
analyzer prints the message "TRUE" if the function is ever inlined. However,
clang_analyzer_checkInlined(false) should never print a message; this asserts
that there should be no paths on which the current function is inlined, but
then there are no paths on which to print a message! (If the assertion is
violated, the message "FALSE" will be printed.)

This asymmetry comes from the fact that the only other chance to print a
message is when the function is analyzed as a top-level function. However,
when we do that, we can't be sure it isn't also inlined elsewhere (such as
in a recursive function, or if we want to analyze in both general or
specialized cases). Rather than have all checkInlined calls have an appended,
meaningless "FALSE" or "TOP-LEVEL" case, there is just no message printed.

void clang_analyzer_checkInlined(int);

For debugging purposes only!

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

12 years agoobjective-C: test for delayed parsing of K&R funcitons
Fariborz Jahanian [Fri, 10 Aug 2012 22:01:36 +0000 (22:01 +0000)]
objective-C: test for delayed parsing of K&R funcitons
inside objc class implementation. // rdar://10387088

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

12 years ago[ms-inline asm] Avoid extra allocations by making this an array of StringRefs.
Chad Rosier [Fri, 10 Aug 2012 21:36:25 +0000 (21:36 +0000)]
[ms-inline asm] Avoid extra allocations by making this an array of StringRefs.

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

12 years agoAdd comments for turning on byval
Manman Ren [Fri, 10 Aug 2012 21:32:09 +0000 (21:32 +0000)]
Add comments for turning on byval

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

12 years ago[ms-inline asm] PatchMSAsmString() doesn't correctly patch non-simple asm
Chad Rosier [Fri, 10 Aug 2012 21:27:11 +0000 (21:27 +0000)]
[ms-inline asm] PatchMSAsmString() doesn't correctly patch non-simple asm
statements.  Therefore, we can't pass the PatchedAsmString to the AsmParser
and expect things to work.

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

12 years agoDon't emit an invoke whose normal destination is a landingpad. Fixes test
Eli Friedman [Fri, 10 Aug 2012 21:26:17 +0000 (21:26 +0000)]
Don't emit an invoke whose normal destination is a landingpad.  Fixes test
regression on test/CodeGenObjC/2008-10-3-EhValue.m on non-Darwin targets.

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

12 years agoobjective-C++: dalyed parsing of ctors with member
Fariborz Jahanian [Fri, 10 Aug 2012 21:15:06 +0000 (21:15 +0000)]
objective-C++: dalyed parsing of ctors with member
initializer list defined inside an objc class
implementation. wip

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

12 years ago[ms-inline asm] Fix a memory leak introduced in r161686.
Chad Rosier [Fri, 10 Aug 2012 21:06:19 +0000 (21:06 +0000)]
[ms-inline asm] Fix a memory leak introduced in r161686.

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

12 years agoFix horrible regression in control of warnings caused by introduction of -Wpedantic.
Ted Kremenek [Fri, 10 Aug 2012 20:50:00 +0000 (20:50 +0000)]
Fix horrible regression in control of warnings caused by introduction of -Wpedantic.
While -Wpedantic was reasonable, -Wno-pedantic would turn off a bunch of warnings that
are on by default.  This counters the intention of this warning flag.

To fix this, -Wpedantic now includes extentions that are not on by default.  The
remaining warnings will manifest anyway, and won't accidentally get turned off
by -Wno-pedantic.

Fixes <rdar://problem/12076105>

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

12 years agoARM: enable struct byval for AAPCS.
Manman Ren [Fri, 10 Aug 2012 20:42:31 +0000 (20:42 +0000)]
ARM: enable struct byval for AAPCS.

rdar://9877866
PR://13350

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

12 years agoobjective-C++: delay parsing of ctor with try block
Fariborz Jahanian [Fri, 10 Aug 2012 20:34:17 +0000 (20:34 +0000)]
objective-C++: delay parsing of ctor with try block
with member initializer list defined inside
an objc implementation block. wip.

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

12 years agoThread-safety-analysis: adds existential quantification over lock
DeLesley Hutchins [Fri, 10 Aug 2012 20:29:46 +0000 (20:29 +0000)]
Thread-safety-analysis:  adds existential quantification over lock
expressions.  The syntax &MyClass::mutex is interpreted as a
pattern that matches m->mutex for any object m of type MyClass.

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

12 years agoThread safety analysis: refactor to support more sophisticated handling
DeLesley Hutchins [Fri, 10 Aug 2012 20:19:55 +0000 (20:19 +0000)]
Thread safety analysis: refactor to support more sophisticated handling
of expressions, and better error messages.

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

12 years ago[ms-inline asm] Add clobbers to AST representation.
Chad Rosier [Fri, 10 Aug 2012 19:13:14 +0000 (19:13 +0000)]
[ms-inline asm] Add clobbers to AST representation.

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

12 years agoFrontend: define _LP64 in a target-independent way
Dylan Noblesmith [Fri, 10 Aug 2012 19:12:37 +0000 (19:12 +0000)]
Frontend: define _LP64 in a target-independent way

Instead of adding it to each individual subclass in
Targets.cpp, simply check the appropriate target
values.

Where before it was only on x86_64 and ppc64, it's now
also defined on mips64 and nvptx64.

Also add a bunch of negative tests to ensure it is *not*
defined on any other architectures while we're here.

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

12 years ago[analyzer] ObjC Inlining: add tests for ivars and properties.
Anna Zaks [Fri, 10 Aug 2012 18:56:01 +0000 (18:56 +0000)]
[analyzer] ObjC Inlining: add tests for ivars and properties.

TODO:
 - Handle @syncronized properties.
 - Always inline properties declared publicly (do not split the path).
This is tricky since there is no mapping from a Decl to the property in
the AST as far as I can tell.

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

12 years ago[analyzer] Track if a region can be a subclass in the dynamic type info.
Anna Zaks [Fri, 10 Aug 2012 18:55:58 +0000 (18:55 +0000)]
[analyzer] Track if a region can be a subclass in the dynamic type info.

When object is allocated with alloc or init, we assume it cannot be a
subclass (currently used only for bifurcation purposes).

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

12 years ago[analyzer] Optimize dynamic dispatch bifurcation by detecting the cases
Anna Zaks [Fri, 10 Aug 2012 18:55:53 +0000 (18:55 +0000)]
[analyzer] Optimize dynamic dispatch bifurcation by detecting the cases
when we don't need to split.

In some cases we know that a method cannot have a different
implementation in a subclass:
 - the class is declared in the main file (private)
 - all the method declarations (including the ones coming from super
classes) are in the main file.

This can be improved further, but might be enough for the heuristic.
(When we are too aggressive splitting the state, efficiency suffers.
When we fail to split the state coverage might suffer.)

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

12 years agoRefactor thread safety analysis to use a different data structure
DeLesley Hutchins [Fri, 10 Aug 2012 18:39:05 +0000 (18:39 +0000)]
Refactor thread safety analysis to use a different data structure
to track locksets.  This is in preparation for further changes.

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

12 years ago[ms-inline asm] Use asserts as these calls are now guarded by identical checks.
Chad Rosier [Fri, 10 Aug 2012 18:20:12 +0000 (18:20 +0000)]
[ms-inline asm] Use asserts as these calls are now guarded by identical checks.

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

12 years agoobjective-C++: delayed parsing of member function with
Fariborz Jahanian [Fri, 10 Aug 2012 18:10:56 +0000 (18:10 +0000)]
objective-C++: delayed parsing of member function with
function-try-block occuring in objc's implementation
block. wip.

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

12 years agoWhitespace.
Chad Rosier [Fri, 10 Aug 2012 17:56:09 +0000 (17:56 +0000)]
Whitespace.

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

12 years agoobjective-C++: Delayed parsing of most common
Fariborz Jahanian [Fri, 10 Aug 2012 15:54:40 +0000 (15:54 +0000)]
objective-C++: Delayed parsing of most common
member functions defined inside an objc class
implementation. wip.

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

12 years agoAdd missing cctype includes.
Joerg Sonnenberger [Fri, 10 Aug 2012 10:58:18 +0000 (10:58 +0000)]
Add missing cctype includes.

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

12 years agoDecrementing std::string::end is not portable, use array access instead.
Joerg Sonnenberger [Fri, 10 Aug 2012 10:57:52 +0000 (10:57 +0000)]
Decrementing std::string::end is not portable, use array access instead.

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

12 years agoFix a couple of pedantic gcc warnings.
Benjamin Kramer [Fri, 10 Aug 2012 10:06:13 +0000 (10:06 +0000)]
Fix a couple of pedantic gcc warnings.

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

12 years agoc-arcmt-test, c-index-test: Appease Cygwin, to link to libclang.a, not clang.dll.
NAKAMURA Takumi [Fri, 10 Aug 2012 06:10:58 +0000 (06:10 +0000)]
c-arcmt-test, c-index-test: Appease Cygwin, to link to libclang.a, not clang.dll.

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

12 years agoCheck access to friend declarations. There's a number of different
John McCall [Fri, 10 Aug 2012 03:15:35 +0000 (03:15 +0000)]
Check access to friend declarations.  There's a number of different
things going on here that were problematic:
  - We were missing the actual access check, or rather, it was suppressed
    on account of being a redeclaration lookup.
  - The access check would naturally happen during delay, which isn't
    appropriate in this case.
  - We weren't actually emitting dependent diagnostics associated with
    class templates, which was unfortunate.
  - Access was being propagated incorrectly for friend method declarations
    that couldn't be matched at parse-time.

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

12 years agoUpdate VerifyDiagnosticConsumer to only get directives during parsing.
Jordan Rose [Fri, 10 Aug 2012 01:06:16 +0000 (01:06 +0000)]
Update VerifyDiagnosticConsumer to only get directives during parsing.

The old behavior was to re-scan any files (like modules) where we may have
directives but won't actually be parsing during the -verify invocation.
Now, we keep the old behavior in Debug builds as a sanity check (though
modules are a known entity), and expect all legitimate directives to come
from comments seen by the preprocessor.

This also affects the ARC migration tool, which captures diagnostics in
order to filter some out. This change adds an explicit cleanup to
CaptureDiagnosticsConsumer in order to let its sub-consumer handle the
real end of diagnostics.

This was originally split into four patches, but the tests do not run
cleanly without all four, so I've combined them into one commit.

Patches by Andy Gibbs, with slight modifications from me.

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

12 years agoMake sure to call EndSourceFile even if we can't continue compiling.
Jordan Rose [Fri, 10 Aug 2012 01:06:08 +0000 (01:06 +0000)]
Make sure to call EndSourceFile even if we can't continue compiling.

Patch by Andy Gibbs!

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

12 years agoProvide isConst/Volatile on CXXMethodDecl.
David Blaikie [Fri, 10 Aug 2012 00:55:35 +0000 (00:55 +0000)]
Provide isConst/Volatile on CXXMethodDecl.

This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce
the implementation with other callers (& update those other callers).

Patch contributed by Sam Panzer (panzer@google.com).

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

12 years ago[ms-inline asm] Use the new Inline Asm Non-Standard Dialect attribute.
Chad Rosier [Fri, 10 Aug 2012 00:00:34 +0000 (00:00 +0000)]
[ms-inline asm] Use the new Inline Asm Non-Standard Dialect attribute.

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

12 years ago[analyzer] Merge RegionStore's KillStruct and CopyLazyBindings: BindAggregate.
Jordan Rose [Thu, 9 Aug 2012 22:55:54 +0000 (22:55 +0000)]
[analyzer] Merge RegionStore's KillStruct and CopyLazyBindings: BindAggregate.

Both methods need to clear out existing bindings and provide a new default
binding. Originally KillStruct always provided UnknownVal as the default,
but it's allowed symbolic values for quite some time (for handling returned
structs in C).

No functionality change.

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