Граф коммитов

36244 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 69a30b838c When we determine that an initialization sequence failed due to an
incomplete type, keep track of the actual type that was
incomplete. Otherwise, we might fail to produce a diagnostic. Fixes
PR12498.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154432 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 20:43:46 +00:00
Douglas Gregor abf65ce5dd Improve the printing of __PRETTY_FUNCTION__ more provide more
information and more closely match GCC's, from Nikola Smiljanic!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154430 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 20:14:15 +00:00
Douglas Gregor 316551f079 Add a query macro for C++11 N3276, decltype does not require complete
return types, from Michel Morin!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 20:00:33 +00:00
Douglas Gregor 50fadd1949 Improve diagnostics in C++11 when a non-type template argument for a
non-type template parameter of pointer type is not a constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154424 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 19:03:30 +00:00
Eric Christopher b2561c7545 This test actually needs label names.
PR9796

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 18:36:52 +00:00
Douglas Gregor 90f5f47348 Include the Objective-C parameter- and return-passing qualifiers when
providing code completions for Objective-C method declarations. Fixes
<rdar://problem/11164498>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154421 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 18:35:07 +00:00
Eric Christopher c07833795a For debug and coverage analysis if we're not optimizing go ahead
and emit a relatively empty block for a plain break statement. This
enables us to track where we went through a switch.

PR9796 & rdar://11215207

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154420 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 18:20:19 +00:00
Douglas Gregor 10ccf12a06 Don't include the ':' following code-completion suggestions for
'public', 'private', or 'protected', unless code completion patterns
are enabled. Fixes <rdar://problem/11189132>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154413 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 17:56:28 +00:00
Fariborz Jahanian e7ea28a585 objective-c: remove IsConstProperty as it does not
seem to get called any more. Also add an assert in
isModifiableLvalue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 17:30:10 +00:00
Argyrios Kyrtzidis 0cc9fdbc55 Add a target triple to test/Index/complete-synthesized.m.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154409 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 17:23:51 +00:00
Argyrios Kyrtzidis 28a83f5700 [code-complete] Introduce CodeCompletionTUInfo which will be used for caching
code-completion related strings specific to a translation unit (ASTContext and related data)

CodeCompletionAllocator does such limited caching, by caching the name assigned
to a DeclContext*, but that is not the appropriate place since that object has
a lifetime that can extend beyond that of an ASTContext.

Introduce CodeCompletionTUInfo which will be always tied to a translation unit
to do this kind of caching and move the caching of CodeCompletionAllocator into this
object, and propagate it to all the places where it will be needed.

The plan is to extend the caching where appropriate, using CodeCompletionTUInfo,
to avoid re-calculating code-completion strings.

Part of rdar://10796159.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154408 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 17:23:48 +00:00
Douglas Gregor 42963612a4 Rework implementation of null non-type template arguments based on
Richard's feedback, to properly catch non-constant expressions and
type mismatches. Finishes <rdar://problem/11193097>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154407 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 17:08:25 +00:00
Fariborz Jahanian 5915561b32 objective-c: add an assertion for property
expression enterring IsConstProperty function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154406 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 16:44:52 +00:00
Chandler Carruth 2c6dbd7f55 Fix GCC's pedantic return-type warning -- this enum is fully covered.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154399 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 16:03:08 +00:00
Manuel Klimek 970b22675d Fix tautological FileCheck by moving the CHECK to an extra line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154393 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 12:12:33 +00:00
David Chisnall e58e6f9114 Don't link lib[std]c++ when -nostdlib is specified (Solaris driver).
Patch by Dmitri Shubin!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154392 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 11:49:50 +00:00
Evgeniy Stepanov e9b4d98f97 Pass -march, -mcpu, -mfpu to linuxtools assembler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154389 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 09:05:40 +00:00
Duncan Sands 8250016fb9 Express the number of ULPs in fpaccuracy metadata as a real rather than a
rational number, eg as 2.5 rather than 5, 2.  OK'd by Peter Collingbourne.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154388 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 08:23:07 +00:00
Eric Christopher 2b124ea9d2 EmitStopPoint already checks if we have debug info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154384 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 05:04:07 +00:00
Eric Christopher fc65ec83f6 Tidy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154383 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 05:04:04 +00:00
Richard Smith c56298d87a Parsing of C++11 attributes:
* Alternative tokens (such as 'compl') are treated as identifiers in
   attribute names.
 * An attribute-list can start with a comma.
 * An ellipsis may not be used with either of our currently-supported
   C++11 attributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154381 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 03:25:07 +00:00
Richard Smith 6ee326af4e Disambiguation of '[[':
* In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject
   array sizes and array indexes which begin with a lambda-expression. Recover by
   parsing the lambda as a lambda.
 * In Objective-C++11, either '[' could be the start of a message-send.
   Fully disambiguate this case: it turns out that the grammars of message-sends,
   lambdas and attributes do not actually overlap. Accept any occurrence of '[['
   where either '[' starts a message send, but reject a lambda in an array index
   just like in C++11 mode.

Implement a couple of changes to the attribute wording which occurred after our
attributes implementation landed:
 * In a function-declaration, the attributes go after the exception specification,
   not after the right paren.
 * A reference type can have attributes applied.
 * An 'identifier' in an attribute can also be a keyword. Support for alternative
   tokens (iso646 keywords) in attributes to follow.

And some bug fixes:
 * Parse attributes after declarator-ids, even if they are not simple identifiers.
 * Do not accept attributes after a parenthesized declarator.
 * Accept attributes after an array size in a new-type-id.
 * Partially disamiguate 'delete' followed by a lambda. More work is required
   here for the case where the lambda-introducer is '[]'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154369 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 01:32:12 +00:00
Rafael Espindola 0e9bf71c61 Fix the testcase :-(
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154363 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 00:13:42 +00:00
Fariborz Jahanian f1ee68710a objective-c modern translator: rewriting specific
implicit casts which is needed to produce good c++
code. // rdar://11202764


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154360 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10 00:08:18 +00:00
Rafael Espindola c515154323 Fix an annoying little bug I found while debugging another LTO issue. Gold
requires the -plugin to come before any -plugin-opt options, we were passing
them the other way around. With this one can run (for example):

clang -o foo foo.c -O4 -Wl,-plugin-opt=generate-api-file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154357 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 23:53:34 +00:00
Fariborz Jahanian 2ca35e6ce4 Remove -fobjc-default-synthesize-properties as the option
to c-index-test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154347 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 22:17:37 +00:00
John McCall 63f557804b My original patch missed the virtual-base case for destroying
base-class subojects.

Incidentally, thinking about virtual bases makes it clear to me that
we're not appropriately computing the access to the virtual base's
member because we're not computing the best possible access to the
virtual base at all;  in fact, we're basically assuming it's public.
I'll file a separate PR about that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154346 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 21:51:56 +00:00
John McCall 12d8d80fb0 Fix the access check performed as part of the determination of whether
to define a special member function as deleted so that it properly
establishes an object context for the accesses to the base subobject
members.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154343 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 20:53:23 +00:00
Daniel Dunbar ae7e939bc0 Author: Daniel Dunbar <daniel@zuster.org>
--- log message follows this test ---
[tests] Fixup some tests to work in "CLANG_IS_PRODUCTION" mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154342 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 20:40:11 +00:00
Manuel Klimek 16dc261fec Implementing a test for the use of PWD to base finding the
correct compile commands on, based on an idea by Jordan Rose.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154335 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 19:10:04 +00:00
Fariborz Jahanian e51fe0972a objective-c: remove -fobjc-default-synthesize-properties from the driver.
cc1 option remains though to invoke default property synthesis.
// rdar://11209719


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154334 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 18:58:55 +00:00
Fariborz Jahanian e52e2e6f48 objective-c: Remove -fno-objc-default-synthesize-properties
as the driver option.
// rdar://11209719


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 18:20:28 +00:00
Manuel Klimek 4f5b3ac464 Fixes a fix to finding the current directory:
We currently want to look whether PWD is available - if PWD is available it will
get us the non-resolved current path, while fs::current_path will resolve
symlinks. The long term fix is to not rely on that behavior any more.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 18:08:23 +00:00
David Chisnall 561d62280a Revert r154321, pending more discussion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154327 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 17:25:11 +00:00
David Blaikie eb52f86a62 Fix bugs found by -Wconstant-conversion improvements currently under review.
Specifically, using a an integer outside [0, 1] as a boolean constant seems to
be an easy mistake to make with things like "x == a || b" where the author
intended "x == a || x == b".

The bug caused by calling SkipUntil with three token kinds was also identified
by a VC diagnostic & reported by Francois Pichet as review feedback for my
commit r154163. I've included test cases to verify the error recovery that was
broken/poorly implemented due to this bug.

The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually
reached in any of Clang's tests & is related to Objective C features I'm not
familiar with, so I've not been able to construct a test case for it. Perhaps
someone else can.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 16:37:11 +00:00
David Chisnall 649ee3fec1 Add -fobjc-trace to emit a call before and after each Objective-C message send
for hooking in code flow visualisation applications.  



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154321 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 15:42:15 +00:00
Anton Korobeynikov e2571793ba Factor out ARM floating ABI determination to new routine
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154318 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 13:38:30 +00:00
David Chisnall c3cb07205a Make a modern Objective-C runtime the default target for *BSD. Don't yet change this on GNU/Linux, where the GCC runtime still tends to be used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154315 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-09 12:33:41 +00:00
Chandler Carruth 5081de5ae7 Wire up -fpie and -fPIE to LLVM's newly added TargetOptions. No test
case as we don't currently have any way of dumping target options or
otherwise observing this. Another small step toward fixing PR12380. With
this we generate TLS accesses using the static model instead of the
dynamic model, but we're still generating suboptimal code under the
mistaken assumption that the TLS offset might be greater than 2^32, and
therefor not viable as an immediate offset of a segment register.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154298 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-08 21:09:51 +00:00
Chandler Carruth 5e219cf7f8 Teach Clang about PIE compilations. This is the first step of PR12380.
First, this patch cleans up the parsing of the PIC and PIE family of
options in the driver. The existing logic failed to claim arguments all
over the place resulting in kludges that marked the options as unused.
Instead actually walk all of the arguments and claim them properly.

We now treat -f{,no-}{pic,PIC,pie,PIE} as a single set, accepting the
last one on the commandline. Previously there were lots of ordering bugs
that could creep in due to the nature of the parsing. Let me know if
folks would like weird things such as "-fPIE -fno-pic" to turn on PIE,
but disable full PIC. This doesn't make any sense to me, but we could in
theory support it.

Options that seem to have intentional "trump" status (-static, -mkernel,
etc) continue to do so and are commented as such.

Next, a -pie-level flag is threaded into the frontend, rigged to
a language option, and handled preprocessor, setting up the appropriate
defines. We'll now have the correct defines when compiling with -fpie.

The one place outside of the preprocessor that was inspecting the PIC
level (as opposed to the relocation model, which is set and handled
separately, yay!) is in the GNU ObjC runtime. I changed it to exactly
preserve existing behavior. If folks want to change its behavior in the
face of PIE, they can do that in a separate patch.

Essentially the only functionality changed here is the preprocessor
defines and bug-fixes to the argument management.

Tests have been updated and extended to test all of this a bit more
thoroughly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154291 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-08 16:40:35 +00:00
Chandler Carruth 95794225e9 Rephrase the preprocessor test to directly use CC1 and not bother
testing any of the strange driver behavior. We already have some tiny
tests for the driver behavior, and I'm going to expand them greatly in
the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154290 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-08 16:40:31 +00:00
Chandler Carruth 65ea45a447 FileCheck-ize this test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-08 16:40:30 +00:00
Richard Smith 49149fe0d2 Don't forget to evaluate the subexpression in a null pointer cast. If we're
converting from std::nullptr_t, the subexpression might have side-effects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154278 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-08 08:02:07 +00:00
Francois Pichet b0afd5df3c ext_reserved_user_defined_literal must not default to Error in MicrosoftMode. Hence create ext_ms_reserved_user_defined_literal that doesn't default to Error; otherwise MSVC headers won't parse.
Fixes PR12383.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154273 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 23:09:23 +00:00
Simon Atanasyan 073a780f7c MIPS: Pass -mabi option to the assmbler when compile MIPS targets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154270 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 22:31:29 +00:00
Simon Atanasyan a2768be144 MIPS: Move code calculates CPU and ABI names to the separate function to reuse this function later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154269 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 22:09:23 +00:00
NAKAMURA Takumi 3be55cdbb5 [Cygwin] Work around to flush stdout in a thread, or stdout in threads won't be flushed at exit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154254 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 06:59:28 +00:00
John McCall b9abd87283 Fix several problems with protected access control:
- The [class.protected] restriction is non-trivial for any instance
    member, even if the access lacks an object (for example, if it's
    a pointer-to-member constant).  In this case, it is equivalent to
    requiring the naming class to equal the context class.
  - The [class.protected] restriction applies to accesses to constructors
    and destructors.  A protected constructor or destructor can only be
    used to create or destroy a base subobject, as a direct result.
  - Several places were dropping or misapplying object information.

The standard could really be much clearer about what the object type is
supposed to be in some of these accesses.  Usually it's easy enough to
find a reasonable answer, but still, the standard makes a very confident
statement about accesses to instance members only being possible in
either pointer-to-member literals or member access expressions, which
just completely ignores concepts like constructor and destructor
calls, using declarations, unevaluated field references, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154248 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 03:04:20 +00:00
NAKAMURA Takumi 79c5f95f24 test/lit.cfg: Please pass %INCLUDE% to clang.exe on Win32. MS-compatible clang may refer to %INCLUDE%. It fixes r154188.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154240 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 01:02:53 +00:00
Chad Rosier a53ab5c569 [driver] In general, the driver claims redundant args and uses the last arg.
However, the '-x' option has special handling and wasn't following this
paradigm.  Fix it to do so by claiming the arg as we parse the '-x' option.
rdar://11203340


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154231 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 00:01:31 +00:00