]> granicus.if.org Git - clang/log
clang
11 years ago[libclang] Add test case for r178374.
Argyrios Kyrtzidis [Fri, 29 Mar 2013 22:16:32 +0000 (22:16 +0000)]
[libclang] Add test case for r178374.

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

11 years agoWhen looking for overridden ObjC methods, don't ignore 'hidden' ones.
Argyrios Kyrtzidis [Fri, 29 Mar 2013 21:51:48 +0000 (21:51 +0000)]
When looking for overridden ObjC methods, don't ignore 'hidden' ones.

When using modules we should not ignore overridden methods from
categories that are hidden because the module is not visible.
This will give more consistent results (when imports change) and it's more
correct since the methods are indeed overridden even if they are not "visible"
for lookup purposes.

rdar://13350796

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

11 years ago[libclang] If libclang logging is enabled, print all compiler diagnostics to stderr...
Argyrios Kyrtzidis [Fri, 29 Mar 2013 21:51:44 +0000 (21:51 +0000)]
[libclang] If libclang logging is enabled, print all compiler diagnostics to stderr instead of capturing them.

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

11 years ago[cmake] Add clang-headers as a dependency of libclang and if we have to copy them
Argyrios Kyrtzidis [Fri, 29 Mar 2013 21:51:40 +0000 (21:51 +0000)]
[cmake] Add clang-headers as a dependency of libclang and if we have to copy them
for the IDE case, also create a symlink inside the libclang.dylib directory.

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

11 years agoSema: Warn on sizeof on binary ops on decayed arrays.
Benjamin Kramer [Fri, 29 Mar 2013 21:43:21 +0000 (21:43 +0000)]
Sema: Warn on sizeof on binary ops on decayed arrays.

The array will decay into a pointer, creating an unexpected result.
sizeof(array + int) is an easy to make typo for sizeof(array) + int.

This was motivated by a NetBSD security bug, used sizeof(key - r) instead of
sizeof(key) - r, reducing entropy in a random number generator.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/subr_cprng.c.diff?r1=1.14&r2=1.15&only_with_tag=MAIN&f=h

Differential Revision: http://llvm-reviews.chandlerc.com/D571

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

11 years agoBugfix/Followup for r177086.
Adrian Prantl [Fri, 29 Mar 2013 19:20:35 +0000 (19:20 +0000)]
Bugfix/Followup for r177086.
* Store the .block_descriptor (instead of self) in the alloca so we
  can guarantee that all captured variables are available at -O0.
* Add the missing OpDeref for the alloca.
rdar://problem/12767564

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

11 years agoImprovement on r177086.
Adrian Prantl [Fri, 29 Mar 2013 19:20:29 +0000 (19:20 +0000)]
Improvement on r177086.
* Let DIType for block-captured self to point to the completed cached
  interface type.
rdar://problem/12767564

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

11 years agoHexagon: Set Hexagon tool-chain when configured as OSless target.
Jyotsna Verma [Fri, 29 Mar 2013 19:09:20 +0000 (19:09 +0000)]
Hexagon: Set Hexagon tool-chain when configured as OSless target.

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

11 years agoRemove sign-compare warning on systems that still use 32 bit time_ts.
Benjamin Kramer [Fri, 29 Mar 2013 17:39:43 +0000 (17:39 +0000)]
Remove sign-compare warning on systems that still use 32 bit time_ts.

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

11 years agoFix thinko (and the bots): We still want to warn in C.
Rafael Espindola [Fri, 29 Mar 2013 07:56:05 +0000 (07:56 +0000)]
Fix thinko (and the bots): We still want to warn in C.

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

11 years agoDon't special case one line extern "C" decls.
Rafael Espindola [Fri, 29 Mar 2013 07:02:31 +0000 (07:02 +0000)]
Don't special case one line extern "C" decls.

We already avoided warning for

extern "C" const char *Version_string = "2.9";

now we also don't produce any warnings for

extern "C" {
  extern const char *Version_string2 = "2.9";
}

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

11 years agoAdd RDSEED intrinsic support defined in AVX2 extension
Michael Liao [Fri, 29 Mar 2013 05:17:55 +0000 (05:17 +0000)]
Add RDSEED intrinsic support defined in AVX2 extension

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

11 years agoAdd XTEST intrinsic defined in TSX extension
Michael Liao [Fri, 29 Mar 2013 05:14:06 +0000 (05:14 +0000)]
Add XTEST intrinsic defined in TSX extension

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

11 years ago[cfg] Always guard (when AddStaticInitBranches == true) DeclStmts for static variable...
Ted Kremenek [Fri, 29 Mar 2013 00:42:56 +0000 (00:42 +0000)]
[cfg] Always guard (when AddStaticInitBranches == true) DeclStmts for static variables, not just ones with explicit initializers

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

11 years ago[analyzer] Add static initializer test case (from <rdar://problem/13227740>).
Ted Kremenek [Fri, 29 Mar 2013 00:32:36 +0000 (00:32 +0000)]
[analyzer] Add static initializer test case (from <rdar://problem/13227740>).

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

11 years agoRevert r178273 as it broke the Linux bootstrap due to false positives
Timur Iskhodzhanov [Fri, 29 Mar 2013 00:22:03 +0000 (00:22 +0000)]
Revert r178273 as it broke the Linux bootstrap due to false positives

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

11 years agoAdd static analyzer support for conditionally executing static initializers.
Ted Kremenek [Fri, 29 Mar 2013 00:09:28 +0000 (00:09 +0000)]
Add static analyzer support for conditionally executing static initializers.

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

11 years agoAdd configuration plumbing to enable static initializer branching in the CFG for...
Ted Kremenek [Fri, 29 Mar 2013 00:09:22 +0000 (00:09 +0000)]
Add configuration plumbing to enable static initializer branching in the CFG for the analyzer.

This setting still isn't enabled yet in the analyzer.  This is
just prep work.

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

11 years agoObjective-C: Produce precise diagnostic when
Fariborz Jahanian [Thu, 28 Mar 2013 23:39:11 +0000 (23:39 +0000)]
Objective-C: Produce precise diagnostic when
'isa' ivar is accessed provided it is the first
ivar. Fixit hint will follow in another patch.
This is continuation of // rdar://13503456

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

11 years ago[analyzer] Document existence of ConstPointerEscape.
Anna Zaks [Thu, 28 Mar 2013 23:15:32 +0000 (23:15 +0000)]
[analyzer] Document existence of ConstPointerEscape.

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

11 years ago[analyzer] Add support for escape of const pointers and use it to allow “newed” point...
Anna Zaks [Thu, 28 Mar 2013 23:15:29 +0000 (23:15 +0000)]
[analyzer] Add support for escape of const pointers and use it to allow “newed” pointers to escape

Add a new callback that notifies checkers when a const pointer escapes. Currently, this only works
for const pointers passed as a top level parameter into a function. We need to differentiate the const
pointers escape from regular escape since the content pointed by const pointer will not change;
if it’s a file handle, a file cannot be closed; but delete is allowed on const pointers.

This should suppress several false positives reported by the NewDelete checker on llvm codebase.

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

11 years ago[analyzer] Apply the suppression rules to the nil receiver only if the value particip...
Anna Zaks [Thu, 28 Mar 2013 23:15:22 +0000 (23:15 +0000)]
[analyzer] Apply the suppression rules to the nil receiver only if the value participates in the computation of the nil we warn about.

We should only suppress a bug report if the IDCed or null returned nil value is directly related to the value we are warning about. This was
not the case for nil receivers - we would suppress a bug report that had an IDCed nil receiver on the path regardless of how it’s
related to the warning.

1) Thread EnableNullFPSuppression parameter through the visitors to differentiate between tracking the value which
is directly responsible for the bug and other values that visitors are tracking (ex: general tracking of nil receivers).
2) in trackNullOrUndef specifically address the case when a value of the message send is nil due to the receiver being nil.

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

11 years ago[ms-cxxabi] Add more tests for r178297
Reid Kleckner [Thu, 28 Mar 2013 23:11:29 +0000 (23:11 +0000)]
[ms-cxxabi] Add more tests for r178297

This covers a few cases where the class of a member pointer is not a
CXXRecordDecl.

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

11 years ago[sema] Check the result of getAsCXXRecordDecl() to fix the build
Reid Kleckner [Thu, 28 Mar 2013 22:15:11 +0000 (22:15 +0000)]
[sema] Check the result of getAsCXXRecordDecl() to fix the build

I'm not 100% sure what should happen here to find the real
CXXRecordDecl.

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

11 years agoWarn about more than the first unused variable when -Werror is set.
Matt Beaumont-Gay [Thu, 28 Mar 2013 21:46:45 +0000 (21:46 +0000)]
Warn about more than the first unused variable when -Werror is set.

To do this, thread DiagnosticErrorTrap's hasUnrecoverableErrorOccurred through
to Scope.

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

11 years ago[sema] Remove unused variable from r178283
Reid Kleckner [Thu, 28 Mar 2013 20:54:13 +0000 (20:54 +0000)]
[sema] Remove unused variable from r178283

Wouldn't it be cool if we had a compiler for Windows that could warn
about these things?

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

11 years ago[ms-cxxabi] Correctly compute the size of member pointers
Reid Kleckner [Thu, 28 Mar 2013 20:02:56 +0000 (20:02 +0000)]
[ms-cxxabi] Correctly compute the size of member pointers

Summary:
This also relaxes the requirement on Windows that the member pointer
class type be a complete type (http://llvm.org/PR12070).  We still ask
for a complete type to instantiate any templates (MSVC does this), but
if that fails we continue as normal, relying on any inheritance
attributes on the declaration.

Reviewers: rjmccall

CC: triton, timurrrr, cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D568

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

11 years agoObjective-C: Provide fixit suggestions when class object
Fariborz Jahanian [Thu, 28 Mar 2013 19:50:55 +0000 (19:50 +0000)]
Objective-C: Provide fixit suggestions when class object
is accessed via accessing 'isa' ivar to use
object_getClass/object_setClass apis.
// rdar://13503456

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

11 years agoProvide a fixit to static_cast for reinterpret_casts within a class hierarchy.
Jordan Rose [Thu, 28 Mar 2013 19:09:40 +0000 (19:09 +0000)]
Provide a fixit to static_cast for reinterpret_casts within a class hierarchy.

The suggestion was already in the text of the note; this just adds the
actual fixit and the appropriate test cases.

Patch by Alexander Zinenko!

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

11 years agoImplemented a warning when an input several bitwise operations are
Sam Panzer [Thu, 28 Mar 2013 19:07:11 +0000 (19:07 +0000)]
Implemented a warning when an input several bitwise operations are
likely be implicitly truncated:

  * All forms of Bitwise-and, bitwise-or, and integer multiplication.
  * The assignment form of integer addition, subtraction, and exclusive-or
  * The RHS of the comma operator
  * The LHS of left shifts.

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

11 years agoRename clang::driver::tools::linuxtools to clang::driver::tools::gnutools.
Thomas Schwinge [Thu, 28 Mar 2013 19:04:25 +0000 (19:04 +0000)]
Rename clang::driver::tools::linuxtools to clang::driver::tools::gnutools.

This is about the GNU Binutils' assembler and linker, so reflect that in the
name.

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

11 years agoRename LinuxDistro to Distro.
Thomas Schwinge [Thu, 28 Mar 2013 19:02:48 +0000 (19:02 +0000)]
Rename LinuxDistro to Distro.

The concept of such a software distribution is not tied to the Linux kernel;
for example Debian GNU/Linux, Debian GNU/Hurd, and Debian GNU/kFreeBSD all
share the same source packages and generally the same user-space configuration.

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

11 years agoUse early return in printing logic. Minor cleanup.
Ted Kremenek [Thu, 28 Mar 2013 18:43:18 +0000 (18:43 +0000)]
Use early return in printing logic.  Minor cleanup.

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

11 years agoAdd CFG logic to create a conditional branch for modeling static initializers.
Ted Kremenek [Thu, 28 Mar 2013 18:43:15 +0000 (18:43 +0000)]
Add CFG logic to create a conditional branch for modeling static initializers.

This is an optional variant of the CFG.  This allows analyses to model whether
or not a static initializer has run, e.g.:

  static Foo x = bar();

For basic dataflow analysis in Sema we will just assume that the initializer
always runs.  For the static analyzer we can use this branch to accurately
track whether or not initializers are on.

This patch just adds the (opt-in) functionality to the CFG.  The
static analyzer still needs to be modified to adopt this feature.

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

11 years agoFixed handling of comments before preprocessor directives.
Alexander Kornienko [Thu, 28 Mar 2013 18:40:55 +0000 (18:40 +0000)]
Fixed handling of comments before preprocessor directives.

Comments before preprocessor directives used to be stored with InPPDirective
flag set, which prevented correct comment splitting in this case. Fixed by
flushing comments before switching on InPPDirective. Added a new test and fixed
one of the existing tests.

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

11 years agoFix order of initialization warning.
Eric Christopher [Thu, 28 Mar 2013 18:22:58 +0000 (18:22 +0000)]
Fix order of initialization warning.

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

11 years ago[analyzer] These implements unix.MismatchedDeallocatorChecker checker.
Anton Yartsev [Thu, 28 Mar 2013 17:05:19 +0000 (17:05 +0000)]
[analyzer] These implements unix.MismatchedDeallocatorChecker checker.
+ Improved display names for allocators and deallocators

The checker checks if a deallocation function matches allocation one. ('free' for 'malloc', 'delete' for 'new' etc.)

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

11 years agoThese are all simple pointer wrappers. Pass them by value.
Rafael Espindola [Thu, 28 Mar 2013 16:26:16 +0000 (16:26 +0000)]
These are all simple pointer wrappers. Pass them by value.

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

11 years ago[analyzer] For now assume all standard global 'operator new' functions allocate memor...
Anton Yartsev [Thu, 28 Mar 2013 16:10:38 +0000 (16:10 +0000)]
[analyzer] For now assume all standard global 'operator new' functions allocate memory in heap.
+ Improved test coverage for cplusplus.NewDelete checker.

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

11 years agoAdd support for gcc-compatible -mpopcntd -mno-popcntd PPC options
Hal Finkel [Thu, 28 Mar 2013 13:51:36 +0000 (13:51 +0000)]
Add support for gcc-compatible -mpopcntd -mno-popcntd PPC options

gcc provides -mpopcntd and -mno-popcntd for controlling the popcntd target
feature; support these options as well.

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

11 years agoUpdating LibASTMatchersReference
Edwin Vane [Thu, 28 Mar 2013 13:50:22 +0000 (13:50 +0000)]
Updating LibASTMatchersReference

The generator for LibASTMatchersReference.html didn't get run last time
ASTMatchers changes were made. Here are up-to-date docs.

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

11 years ago[Mips] Handle pseudo-target flags '-EL' and '-EB' and properly adjust
Simon Atanasyan [Thu, 28 Mar 2013 11:36:22 +0000 (11:36 +0000)]
[Mips] Handle pseudo-target flags '-EL' and '-EB' and properly adjust
toolchain flags for MIPS targets.

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

11 years agoAdd support for gcc-compatible -mmfcrf -mno-mfcrf PPC options
Hal Finkel [Thu, 28 Mar 2013 08:38:53 +0000 (08:38 +0000)]
Add support for gcc-compatible -mmfcrf -mno-mfcrf PPC options

gcc provides -mmfcrf and -mno-mfcrf for controlling what we call
the mfocrf target feature. Also, PPC is now making use of the
static function AddTargetFeature used by the Mips Driver code.

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

11 years agoDefine __SIZE_MAX__ preprocessor macro.
Evgeniy Stepanov [Thu, 28 Mar 2013 08:36:54 +0000 (08:36 +0000)]
Define __SIZE_MAX__ preprocessor macro.

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

11 years agoFor -Wignored-qualifiers, don't warn on qualifiers which we acquire via a
Richard Smith [Thu, 28 Mar 2013 03:27:52 +0000 (03:27 +0000)]
For -Wignored-qualifiers, don't warn on qualifiers which we acquire via a
typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic
type qualifier.

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

11 years agoTeach -Wigored-qualifiers about exotic flavors of declarator and the _Atomic type...
Richard Smith [Thu, 28 Mar 2013 02:51:21 +0000 (02:51 +0000)]
Teach -Wigored-qualifiers about exotic flavors of declarator and the _Atomic type qualifier.

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

11 years agoRevert "Update debug info test for schema change made to LLVM."
David Blaikie [Thu, 28 Mar 2013 02:44:15 +0000 (02:44 +0000)]
Revert "Update debug info test for schema change made to LLVM."

This reverts commit 5035c483b7fcbf0fa2a7afba24fa35a10995d195.

This schema change wasn't necessary after all. I'm going ith a different
solution that will hopefully use space more conservatively.

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

11 years agoRemove outdated FIXME.
Richard Smith [Thu, 28 Mar 2013 01:56:34 +0000 (01:56 +0000)]
Remove outdated FIXME.

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

11 years agoSupport C11 _Atomic type qualifier. This is more-or-less just syntactic sugar for...
Richard Smith [Thu, 28 Mar 2013 01:55:44 +0000 (01:55 +0000)]
Support C11 _Atomic type qualifier. This is more-or-less just syntactic sugar for the _Atomic type specifier.

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

11 years agoFold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, each...
Richard Smith [Thu, 28 Mar 2013 00:03:10 +0000 (00:03 +0000)]
Fold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, each of which was only present in one version:
 * Give the right diagnostic for 'restrict' applied to a non-pointer, non-reference type.
 * Don't reject 'restrict' applied indirectly to an Objective-C object pointer type (eg, through template instantiation).

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

11 years ago[Parser] Don't code-complete twice.
Argyrios Kyrtzidis [Wed, 27 Mar 2013 23:58:17 +0000 (23:58 +0000)]
[Parser] Don't code-complete twice.

When we are consuming the current token just to enter a new token stream, we push
the current token in the back of the stream so that we get it again.

Unfortunately this had the effect where if the current token is a code-completion one,
we would code-complete once during consuming it and another time after the stream ended.

Fix this by making sure that, in this case, ConsumeAnyToken() will consume a code-completion
token without invoking code-completion.

rdar://12842503

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

11 years agoDon't reject __restrict applied to a dependent type; it might instantiate to a pointe...
Richard Smith [Wed, 27 Mar 2013 23:36:39 +0000 (23:36 +0000)]
Don't reject __restrict applied to a dependent type; it might instantiate to a pointer or reference type.

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

11 years agoSimplify test to use a count for the number of notes expected.
Bill Wendling [Wed, 27 Mar 2013 23:26:09 +0000 (23:26 +0000)]
Simplify test to use a count for the number of notes expected.

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

11 years agoUBSan: Don't diagnose inf/nan conversions between floating-point types. It's far...
Richard Smith [Wed, 27 Mar 2013 23:20:25 +0000 (23:20 +0000)]
UBSan: Don't diagnose inf/nan conversions between floating-point types. It's far from clear whether these have undefined behavior, and these checks are helping no-one. Keep the double->float overflow warnings, though, since those are useful in practice, even though it's unclear whether such operations have defined behavior.

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

11 years agoRemove unnecessary attributes from test case.
Chad Rosier [Wed, 27 Mar 2013 21:54:09 +0000 (21:54 +0000)]
Remove unnecessary attributes from test case.

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

11 years agoAdd a front-end test case for r178186.
Chad Rosier [Wed, 27 Mar 2013 21:50:39 +0000 (21:50 +0000)]
Add a front-end test case for r178186.

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

11 years agoFixes a typo in my last patch.
Fariborz Jahanian [Wed, 27 Mar 2013 21:33:52 +0000 (21:33 +0000)]
Fixes a typo in my last patch.

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

11 years agoRevert "[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__."
Argyrios Kyrtzidis [Wed, 27 Mar 2013 21:22:45 +0000 (21:22 +0000)]
Revert "[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__."

Per feedback by Doug, we should avoid platform-specific implementations
in lib/Headers as much as possible.

This reverts commit r178110.

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

11 years agoObjective-C: Issue more precise warning when user
Fariborz Jahanian [Wed, 27 Mar 2013 21:19:25 +0000 (21:19 +0000)]
Objective-C: Issue more precise warning when user
is accessing 'isa' as an object pointer.
// rdar://13503456. FixIt to follow in another patch.

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

11 years agoCleanup clang's specializations of simplify_type.
Rafael Espindola [Wed, 27 Mar 2013 19:38:14 +0000 (19:38 +0000)]
Cleanup clang's specializations of simplify_type.

Now that the basic implementation in llvm has been fixed, simplify the
specializations in clang.

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

11 years agoUpdate the error handing static functions for r178161.
Chad Rosier [Wed, 27 Mar 2013 18:28:23 +0000 (18:28 +0000)]
Update the error handing static functions for r178161.
Part of rdar://13296693

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

11 years ago[analyzer] Use evalBind for C++ new of scalar types.
Jordan Rose [Wed, 27 Mar 2013 18:10:35 +0000 (18:10 +0000)]
[analyzer] Use evalBind for C++ new of scalar types.

These types will not have a CXXConstructExpr to do the initialization for
them. Previously we just used a simple call to ProgramState::bindLoc, but
that doesn't trigger proper checker callbacks (like pointer escape).

Found by Anton Yartsev.

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

11 years ago[analyzer] Cleanup: only get the PostStmt when we need the underlying Stmt + comment
Anna Zaks [Wed, 27 Mar 2013 17:36:01 +0000 (17:36 +0000)]
[analyzer] Cleanup: only get the PostStmt when we need the underlying Stmt + comment

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

11 years ago[analyzer] Ensure that the node NilReceiverBRVisitor is looking for is not reclaimed
Anna Zaks [Wed, 27 Mar 2013 17:35:58 +0000 (17:35 +0000)]
[analyzer] Ensure that the node NilReceiverBRVisitor is looking for is not reclaimed

The visitor should look for the PreStmt node as the receiver is nil in the PreStmt and this is the node. Also, tag the nil
receiver nodes with a special tag for consistency.

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

11 years ago[modules] Make sure enabled diagnostic pragmas inside the module don't affect the...
Argyrios Kyrtzidis [Wed, 27 Mar 2013 17:17:23 +0000 (17:17 +0000)]
[modules] Make sure enabled diagnostic pragmas inside the module don't affect the translation unit that
imports the module.

Getting diagnostic sections from modules properly working is a fixme.

rdar://13516663

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

11 years agoInsert extra new line before access specifiers.
Alexander Kornienko [Wed, 27 Mar 2013 17:08:02 +0000 (17:08 +0000)]
Insert extra new line before access specifiers.

Summary: Insert extra new line before access specifiers.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D581

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

11 years ago<rdar://problem/13509689> Introduce -module-file-info option that provides informatio...
Douglas Gregor [Wed, 27 Mar 2013 16:47:18 +0000 (16:47 +0000)]
<rdar://problem/13509689> Introduce -module-file-info option that provides information about a particular module file.

This option can be useful for end users who want to know why they
ended up with a ton of different variants of the "std" module in their
module cache. This problem should go away over time, as we reduce the
need for module variants, but it will never go away entirely.

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

11 years agoAdd const in preparation for a simplify_type change in llvm.
Rafael Espindola [Wed, 27 Mar 2013 15:37:54 +0000 (15:37 +0000)]
Add const in preparation for a simplify_type change in llvm.

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

11 years agoAdd another expected note. Two errors => two notes.
Tim Northover [Wed, 27 Mar 2013 13:50:57 +0000 (13:50 +0000)]
Add another expected note. Two errors => two notes.

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

11 years agoDisable ASan/MSan symbolization of reports in tests.
Evgeniy Stepanov [Wed, 27 Mar 2013 13:11:46 +0000 (13:11 +0000)]
Disable ASan/MSan symbolization of reports in tests.

It was using an instrumented symbolizer binary, which is a potential fork bomb.

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

11 years agoMark comment-to-html-xml-conversion test as XFAIL:msan, in addition to valgrind.
Evgeniy Stepanov [Wed, 27 Mar 2013 13:05:40 +0000 (13:05 +0000)]
Mark comment-to-html-xml-conversion test as XFAIL:msan, in addition to valgrind.

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

11 years ago<rdar://problem/13317030> Consider using directives when performing unqualified name...
Douglas Gregor [Wed, 27 Mar 2013 12:51:49 +0000 (12:51 +0000)]
<rdar://problem/13317030> Consider using directives when performing unqualified name lookup into declarations contexts represented by the qualified-id but not in the actual scope hierarchy.

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

11 years agoSplit line comments
Alexander Kornienko [Wed, 27 Mar 2013 11:52:18 +0000 (11:52 +0000)]
Split line comments

Summary:
Split line comments that exceed column limit + fixed leading whitespace
handling when splitting block comments.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D577

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

11 years agoFix testcase to add expected note.
Bill Wendling [Wed, 27 Mar 2013 06:45:37 +0000 (06:45 +0000)]
Fix testcase to add expected note.

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

11 years agoPass the diagnostic in for better error messages.
Bill Wendling [Wed, 27 Mar 2013 06:06:26 +0000 (06:06 +0000)]
Pass the diagnostic in for better error messages.

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

11 years ago[lib/Headers] Break the module import cycle between _Builtin_intrinsics.sse and _Buil...
Argyrios Kyrtzidis [Wed, 27 Mar 2013 05:12:34 +0000 (05:12 +0000)]
[lib/Headers] Break the module import cycle between _Builtin_intrinsics.sse and _Builtin_intrinsics.sse2

Module "sse" implicitly exports module "sse2".
This is bad because we also have module "sse2" export module "sse" (as intended) so we end up with a cycle
in the module import graph:
1. sse2 -> (also imports) sse
2. sse -> (also imports) sse2

To eliminate the cycle remove 2.; importing module "sse2" will also import module "sse", but just importing
module "sse" will not also import module "sse2".

rdar://13240552

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

11 years agoImplement compiler intrinsics needed for compatibility with MSVC 2012 <type_traits>.
Joao Matos [Wed, 27 Mar 2013 01:34:16 +0000 (01:34 +0000)]
Implement compiler intrinsics needed for compatibility with MSVC 2012 <type_traits>.

Patch by me and Ryan Molden.

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

11 years ago[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__.
Argyrios Kyrtzidis [Wed, 27 Mar 2013 01:25:37 +0000 (01:25 +0000)]
[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__.

This makes it identical with the system definition.

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

11 years ago[modules] Before marking the module imported macros as ambiguous, check if this is...
Argyrios Kyrtzidis [Wed, 27 Mar 2013 01:25:34 +0000 (01:25 +0000)]
[modules] Before marking the module imported macros as ambiguous, check if this is a case where
the system macro uses a not identical definition compared to a macro from the clang headers.

For example (these come from different modules):
   \#define LONG_MAX __LONG_MAX__ (clang's limits.h)
   \#define LONG_MAX 0x7fffffffffffffffL (system's limits.h)
in which case don't mark them ambiguous to avoid the "ambiguous macro expansion" warning.

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

11 years agoRemove IdentifierInfo::setHadMacroDefinition()
Argyrios Kyrtzidis [Wed, 27 Mar 2013 01:25:31 +0000 (01:25 +0000)]
Remove IdentifierInfo::setHadMacroDefinition()

It's not used anymore.

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

11 years ago[PCH/modules] Remove HiddenName::MacroUndef
Argyrios Kyrtzidis [Wed, 27 Mar 2013 01:25:28 +0000 (01:25 +0000)]
[PCH/modules] Remove HiddenName::MacroUndef

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

11 years ago[Preprocessor] Remove PPMutationListener.
Argyrios Kyrtzidis [Wed, 27 Mar 2013 01:25:24 +0000 (01:25 +0000)]
[Preprocessor] Remove PPMutationListener.

It's not used anymore.

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

11 years ago[modules] Re-enable the "ambiguous expansion of macro" warning.
Argyrios Kyrtzidis [Wed, 27 Mar 2013 01:25:19 +0000 (01:25 +0000)]
[modules] Re-enable the "ambiguous expansion of macro" warning.

Also update "test/Modules/macros.c" to test modified semantics:
-When there is an ambiguous macro, expand using the latest introduced version, not the first one.
-#undefs in submodules cause the macro to not be exported by that submodule, it doesn't cause
 undefining of macros in the translation unit that imported that submodule.
 This reduces macro namespace interference across modules.

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

11 years agoPR15597: Fix a confusion between the implicit exception specification and the
Richard Smith [Wed, 27 Mar 2013 00:22:47 +0000 (00:22 +0000)]
PR15597: Fix a confusion between the implicit exception specification and the
uninstantiated exception specification when a special member within a class
template is both defaulted and given an exception specification on its first
declaration.

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

11 years agoIf we're unable to create the TargetMachine, then just quit producing the
Chad Rosier [Wed, 27 Mar 2013 00:14:35 +0000 (00:14 +0000)]
If we're unable to create the TargetMachine, then just quit producing the
backend output; there's no need to report a fatal error.  This reverts r178042.
Part of rdar://13295753 and rdar://13401547

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

11 years agoUpdate debug info test for schema change made to LLVM.
David Blaikie [Wed, 27 Mar 2013 00:08:24 +0000 (00:08 +0000)]
Update debug info test for schema change made to LLVM.

This accounts for the addition of another field to DIScopes that will be used
to store a list of DIImportedModules in the future.

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

11 years agoMake the -Wreinterpret-base-class logic safe against invalid
John McCall [Wed, 27 Mar 2013 00:03:48 +0000 (00:03 +0000)]
Make the -Wreinterpret-base-class logic safe against invalid
declarations at any point. Patch by Alexander Zinenko, and
report by Richard Smith.

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

11 years agoSplit "incomplete implementation" warnings for ObjC into separate warnings.
Ted Kremenek [Wed, 27 Mar 2013 00:02:21 +0000 (00:02 +0000)]
Split "incomplete implementation" warnings for ObjC into separate warnings.

Previously all unimplemented methods for a class were grouped under
a single warning, with all the unimplemented methods mentioned
as notes.  Based on feedback from users, most users would like
a separate warning for each method, with a note pointing back to
the original method declaration.

Implements <rdar://problem/13350414>

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

11 years ago<rdar://problem/13278115> Improve diagnostic when failing to bind an rvalue reference...
Douglas Gregor [Tue, 26 Mar 2013 23:59:23 +0000 (23:59 +0000)]
<rdar://problem/13278115> Improve diagnostic when failing to bind an rvalue reference to an lvalue of compatible type.

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

11 years ago[analyzer] Better test for r178063.
Anna Zaks [Tue, 26 Mar 2013 23:58:52 +0000 (23:58 +0000)]
[analyzer] Better test for r178063.

Jordan pointed out that my previously committed test was bogus.

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

11 years ago[analyzer] Make sure IDC works for ‘NSContainer value/key is nil’ checks.
Anna Zaks [Tue, 26 Mar 2013 23:58:49 +0000 (23:58 +0000)]
[analyzer] Make sure IDC works for ‘NSContainer value/key is nil’ checks.

Register the nil tracking visitors with the region and refactor trackNullOrUndefValue a bit.

Also adds the cast and paren stripping before checking if the value is an OpaqueValueExpr
or ExprWithCleanups.

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

11 years agoRemove magic number usage from CGDebugInfo with new DICompositeType::setContainingType
David Blaikie [Tue, 26 Mar 2013 23:47:35 +0000 (23:47 +0000)]
Remove magic number usage from CGDebugInfo with new DICompositeType::setContainingType

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

11 years ago[driver] Do not generate crash diagnostics if the compilation command failed
Chad Rosier [Tue, 26 Mar 2013 23:41:30 +0000 (23:41 +0000)]
[driver] Do not generate crash diagnostics if the compilation command failed
to execute as the crash will surely reoccur while generating the diagnostics.
rdar://13362359

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

11 years ago<rdar://problem/13267210> Ensure that Sema::CompareReferenceRelationship returns...
Douglas Gregor [Tue, 26 Mar 2013 23:36:30 +0000 (23:36 +0000)]
<rdar://problem/13267210> Ensure that Sema::CompareReferenceRelationship returns consistent results with invalid types.

When Sema::RequireCompleteType() is given a class template
specialization type that then fails to instantiate, it returns
'true'. On subsequent invocations, it can return false. Make sure that
this difference doesn't change the result of
Sema::CompareReferenceRelationship, which is expected to remain stable
while we're checking an initialization sequence.

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

11 years agoRemove a FIXME that's not planned to be fixed. We only generated crash
Chad Rosier [Tue, 26 Mar 2013 23:25:41 +0000 (23:25 +0000)]
Remove a FIXME that's not planned to be fixed.  We only generated crash
diagnostics for the first failing command.

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

11 years ago<rdar://problem/13473493> Handle 'this->' insertion recovery within trailing return...
Douglas Gregor [Tue, 26 Mar 2013 22:43:55 +0000 (22:43 +0000)]
<rdar://problem/13473493> Handle 'this->' insertion recovery within trailing return types.

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

11 years agoDebug Info: remove use of magic numbers to tweak specific debug info metadata fields
David Blaikie [Tue, 26 Mar 2013 22:09:53 +0000 (22:09 +0000)]
Debug Info: remove use of magic numbers to tweak specific debug info metadata fields

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

11 years ago[analyzer] Change inlining policy to inline small functions when reanalyzing ObjC...
Anna Zaks [Tue, 26 Mar 2013 18:57:58 +0000 (18:57 +0000)]
[analyzer] Change inlining policy to inline small functions when reanalyzing ObjC methods as top level.

This allows us to better reason about(inline) small wrapper functions.

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

11 years ago[analyzer] micro optimization as per Jordan’s feedback on r177905.
Anna Zaks [Tue, 26 Mar 2013 18:57:51 +0000 (18:57 +0000)]
[analyzer] micro optimization as per Jordan’s feedback on r177905.

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

11 years agoclang/test/CodeGenCXX/debug-info-namespace.cpp: Disable it on non-bash lit for now.
NAKAMURA Takumi [Tue, 26 Mar 2013 18:57:40 +0000 (18:57 +0000)]
clang/test/CodeGenCXX/debug-info-namespace.cpp: Disable it on non-bash lit for now.

With dosish filename, it misgenerates an improper extra entry.

!1 = metadata !{metadata !"E:\5Cllvm\5Cllvm-project\5Cclang\5Ctest\5CCodeGenCXX/debug-info-namespace.cpp", metadata !"E:\5Cllvm\5Cbuild\5Cninja-win32-vs11\5Ctools\5Cclang\5Ctest\5CCodeGenCXX"}

!8 = metadata !{metadata !"E:\5Cllvm\5Cllvm-project\5Cclang\5Ctest\5CCodeGenCXX\5Cdebug-info-namespace.cpp", metadata !"E:\5Cllvm\5Cbuild\5Cninja-win32-vs11\5Ctools\5Cclang\5Ctest\5CCodeGenCXX"}

!8 is unexpected.

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