]> granicus.if.org Git - clang/log
clang
10 years agoObjective-C: Improve on various diagnostics related to
Fariborz Jahanian [Mon, 9 Dec 2013 22:04:26 +0000 (22:04 +0000)]
Objective-C: Improve on various diagnostics related to
use of objc_bridge_related attribute. // rdar://15499111

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

10 years ago[CMake] clangSema doesn't depend on LLVM CodeGen any more.
NAKAMURA Takumi [Mon, 9 Dec 2013 19:27:36 +0000 (19:27 +0000)]
[CMake] clangSema doesn't depend on LLVM CodeGen any more.

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

10 years ago[CMake] clang/lib: Satisfy dependencies to add *actually used* libraries on target_li...
NAKAMURA Takumi [Mon, 9 Dec 2013 19:04:43 +0000 (19:04 +0000)]
[CMake] clang/lib: Satisfy dependencies to add *actually used* libraries on target_link_libraries() and LLVM_LINK_COMPONENTS.

I will prune redundant dependencies later.

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

10 years ago[CMake] clangDriver: Move LLVM stuff in target_link_library to LLVM_LINK_COMPONENTS.
NAKAMURA Takumi [Mon, 9 Dec 2013 19:04:19 +0000 (19:04 +0000)]
[CMake] clangDriver: Move LLVM stuff in target_link_library to LLVM_LINK_COMPONENTS.

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

10 years agoclang/test/lit.cfg: Remove get_llc_props. check-clang itself no longer invokes llc.
NAKAMURA Takumi [Mon, 9 Dec 2013 19:04:14 +0000 (19:04 +0000)]
clang/test/lit.cfg: Remove get_llc_props. check-clang itself no longer invokes llc.

Only a few tests depend on llc yet.

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

10 years agoSave another call to GetAddrOfFunction.
Rafael Espindola [Mon, 9 Dec 2013 16:01:03 +0000 (16:01 +0000)]
Save another call to GetAddrOfFunction.

Thread an optional GV down to EmitGlobalFunctionDefinition so that it can
avoid the lookup when we already know the corresponding llvm global value.

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

10 years agoWhen we decide to output a deferred decl, remember the llvm GlobalValue.
Rafael Espindola [Mon, 9 Dec 2013 14:59:08 +0000 (14:59 +0000)]
When we decide to output a deferred decl, remember the llvm GlobalValue.

We can reuse it to avoid a DenseMap+StringMap lookup to find if it was already
emitted or not.

This fixes a 2010 TODO.

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

10 years agoOutput destructors and constructors in a more natural order.
Rafael Espindola [Mon, 9 Dec 2013 14:51:17 +0000 (14:51 +0000)]
Output destructors and constructors in a more natural order.

With this patch we output the in the order
C2
C1

D2
D1
D0

Which means that a destructor or constructor that call another is output after
the callee. This is a bit easier to read IHMO and a tiny bit more efficient
as we don't put a decl in DeferredDeclsToEmit.

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

10 years agoclang-format: Be more conservative about braced list column layout.
Daniel Jasper [Mon, 9 Dec 2013 14:40:19 +0000 (14:40 +0000)]
clang-format: Be more conservative about braced list column layout.

Specifically disable it for nested braced lists as it commonly can look
really weird. Eventually, we'll want to become smarter and format some of
the nested lists better.

Before:
  SomeStruct my_struct_array = {
    { aaaaaa,     aaaaaaaa,   aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaa,    aaa },
    { aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa },
    { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaa,      a,                 aaaaaaaaaa,
      aaaaaaaaa,         aaa },
  };

After:
  SomeStruct my_struct_array = {
    { aaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaa, aaa },
    { aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa },
    { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaa, a, aaaaaaaaaaaaaaaaaaa, aaa },
  };

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

10 years agoRemove old -fdiagnostics-show-name option
Alp Toker [Mon, 9 Dec 2013 14:34:53 +0000 (14:34 +0000)]
Remove old -fdiagnostics-show-name option

This had no effect since the feature was removed in r150612.

I actually miss this option, maybe we can bring it back some day.

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

10 years agoMake the -Wkeyword-compat diag message more accurate
Alp Toker [Mon, 9 Dec 2013 12:41:02 +0000 (12:41 +0000)]
Make the -Wkeyword-compat diag message more accurate

Changed from:

  keyword '__is_empty' will be treated as an identifier for the remainder of the translation unit

To:

  keyword '__is_empty' will be made available as an identifier for the remainder of the translation unit

This is a more accurate description of clang's keyword compatibility feature,
given that some of the keywords are turned into context-sensitive keywords
(e.g. REVERTIBLE_TYPE_TRAIT) rather than being fully disabled.

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

10 years ago[-cxx-abi microsoft] Mangle large integral constants correctly
David Majnemer [Mon, 9 Dec 2013 10:44:32 +0000 (10:44 +0000)]
[-cxx-abi microsoft] Mangle large integral constants correctly

Testing has revealed that large integral constants (i.e. > INT64_MAX)
are always mangled as-if they are negative, even in places where it
would not make sense for them to be negative (like non-type template
parameters of type unsigned long long).

To address this, we change the way we model number mangling: always
mangle as-if our number is an int64_t.  This should result in correct
results when we have large unsigned numbers.

N.B.  Bizarrely, things that are 32-bit displacements like vbptr offsets
are mangled as-if they are unsigned 32-bit numbers.  This is a pretty
egregious waste of space, it would be a 4x savings if we could mangle it
like a signed 32-bit number.  Instead, we explicitly cast these
displacements to uint32_t and let the mangler proceed.

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

10 years agoVersions of GCC newer than 4.8 exist these days =)
Richard Smith [Mon, 9 Dec 2013 08:55:59 +0000 (08:55 +0000)]
Versions of GCC newer than 4.8 exist these days =)

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

10 years agoMinor cleanup and reorg of C++ status page.
Richard Smith [Mon, 9 Dec 2013 08:52:23 +0000 (08:52 +0000)]
Minor cleanup and reorg of C++ status page.

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

10 years agoUpdate compatibility page to list some GCC language extensions that Clang does
Richard Smith [Mon, 9 Dec 2013 07:03:59 +0000 (07:03 +0000)]
Update compatibility page to list some GCC language extensions that Clang does
not support as a possible reason for choosing GCC instead of Clang (and vice
versa). Weaken some of the claimed advantages of Clang in light of GCC
improvements.

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

10 years agoAvoid extra error messages if method definition is inside function.
Serge Pavlov [Mon, 9 Dec 2013 05:25:47 +0000 (05:25 +0000)]
Avoid extra error messages if method definition is inside function.

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

10 years agoAvoid adding some decls to DeferredDeclsToEmit.
Rafael Espindola [Mon, 9 Dec 2013 04:29:47 +0000 (04:29 +0000)]
Avoid adding some decls to DeferredDeclsToEmit.

Before this patch GetOrCreateLLVMFunction would add a decl to
DeferredDeclsToEmit even when it was being called by the function trying to
emit that decl.

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

10 years ago[-cxx-abi microsoft] Properly mangle enums
David Majnemer [Mon, 9 Dec 2013 04:28:34 +0000 (04:28 +0000)]
[-cxx-abi microsoft] Properly mangle enums

While testing our ability to mangle large constants (PR18175), I
incidentally discovered that we did not properly mangle enums correctly.

Previously, we would append the width of the enum in bytes after the
type-tag differentiator.

This would mean "enum : short" would be mangled as 'W2' while "enum :
char" would be mangled as 'W1'.  Upon testing this with several versions
of MSVC, I found that this did not match their behavior: they always use
'W4'.

N.B.  Quick testing uncovered that undname allows different numbers to
follow the 'W' in the following way:

'W0' -> "enum char"
'W1' -> "enum unsigned char"
'W2' -> "enum short"
'W3' -> "enum unsigned short"
'W4' -> "enum"
'W5' -> "enum unsigned int"
'W6' -> "enum long"
'W7' -> "enum unsigned long"

However this scheme appears abandoned, I cannot get MSVC to trigger it.
Furthermore, it's incomplete: it doesn't handle "bool" or "long long".

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

10 years ago[AArch64]Add missing pair intrinsics such as:
Hao Liu [Mon, 9 Dec 2013 03:52:22 +0000 (03:52 +0000)]
[AArch64]Add missing pair intrinsics such as:
    int32_t vminv_s32(int32x2_t a)
which should be compiled into SMINP Vd.2S,Vn.2S,Vm.2S

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

10 years agoRename a variable that I missed in the previous refactoring.
Faisal Vali [Mon, 9 Dec 2013 00:15:23 +0000 (00:15 +0000)]
Rename a variable that I missed in the previous refactoring.

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

10 years agoEliminate the last remaining header NDEBUG
Alp Toker [Mon, 9 Dec 2013 00:12:56 +0000 (00:12 +0000)]
Eliminate the last remaining header NDEBUG

VerifyDiagnosticConsumer is long-lived so the two additional members shouldn't
have any impact on release builds.

The clang headers are now free of NDEBUG conditionals. Let's keep it that way!

Note that they're not yet structurally stable, pending a few fixes in the LLVM
core headers.

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

10 years agoRemove an old stdio.h include from the invalid-array test
Alp Toker [Sun, 8 Dec 2013 22:37:30 +0000 (22:37 +0000)]
Remove an old stdio.h include from the invalid-array test

This should get it up and running on win and other builders without system
headers.

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

10 years agoFix three tests that weren't checking anything
Alp Toker [Sun, 8 Dec 2013 22:22:31 +0000 (22:22 +0000)]
Fix three tests that weren't checking anything

Add -verify and update the test directives to match current expectations.

Also add a FIXME to an ObjC test that has expected-* directives but no -verify.

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

10 years agoRe-enable verification of test and update outdated diag checks
Alp Toker [Sun, 8 Dec 2013 22:22:26 +0000 (22:22 +0000)]
Re-enable verification of test and update outdated diag checks

Going by PR6913 it looks like this one can no longer reach CodeGen so remove
the redundant -emit-llvm case and treat it as an ordinary Sema test.

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

10 years agoRe-enable ms inline asm parser test.
Alp Toker [Sun, 8 Dec 2013 21:12:27 +0000 (21:12 +0000)]
Re-enable ms inline asm parser test.

LLVM r196044 should make it pass.

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

10 years agoRemove all DISABLE lines from tests
Alp Toker [Sun, 8 Dec 2013 21:12:19 +0000 (21:12 +0000)]
Remove all DISABLE lines from tests

There's no evidence that a 'DISABLE' directive ever existed.

Let's see if anything breaks..

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

10 years agoThere's no such thing as %clang_cc1_only
Alp Toker [Sun, 8 Dec 2013 18:49:11 +0000 (18:49 +0000)]
There's no such thing as %clang_cc1_only

These were being substituted into approximately the following:

  clang -cc1 -internal-isystem ../lib/clang/3.5/include_only

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

10 years agoFix a test that hasn't worked since 2007
Alp Toker [Sun, 8 Dec 2013 18:49:05 +0000 (18:49 +0000)]
Fix a test that hasn't worked since 2007

Due to a missing -verify, 2007-10-01-BuildArrayRef.c was a no-op.

The message was changed 5 years ago so also update the test to reflect the new wording.

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

10 years agoRemove duplicated -cc1 in tests
Alp Toker [Sun, 8 Dec 2013 18:06:52 +0000 (18:06 +0000)]
Remove duplicated -cc1 in tests

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

10 years agoGlobalAlias::isDeclaration is always false. Remove dead code.
Rafael Espindola [Sun, 8 Dec 2013 17:19:18 +0000 (17:19 +0000)]
GlobalAlias::isDeclaration is always false. Remove dead code.

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

10 years agoARM: teach Sema that "r" can match 64-bit values
Tim Northover [Sun, 8 Dec 2013 15:24:55 +0000 (15:24 +0000)]
ARM: teach Sema that "r" can match 64-bit values

We already support using "r" on 64-bit values (a GPRPair is
allocated), but Sema doesn't know this yet so issues a warning. This
should fix it.

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

10 years agoMove a generic lambda test into the more logical test file.
Faisal Vali [Sun, 8 Dec 2013 15:11:48 +0000 (15:11 +0000)]
Move a generic lambda test into the more logical test file.

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

10 years agoFix the message to go along with the assertion that was just fixed.
Faisal Vali [Sun, 8 Dec 2013 15:04:03 +0000 (15:04 +0000)]
Fix the message to go along with the assertion that was just fixed.

argh!

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

10 years agoFix an assertion introduced by my previous refactoring.
Faisal Vali [Sun, 8 Dec 2013 15:00:29 +0000 (15:00 +0000)]
Fix an assertion introduced by my previous refactoring.

Add back the test that was triggering the assertion (which I removed mistakenly thinking it was triggering just a warning and not an assertion).  My error was brought to my attention by Rafael (Thanks!).

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

10 years agoExtend assembler handling for NetBSD/MIPS to pass down the correct ABI,
Joerg Sonnenberger [Sun, 8 Dec 2013 13:54:58 +0000 (13:54 +0000)]
Extend assembler handling for NetBSD/MIPS to pass down the correct ABI,
architecture and PIC flag.

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

10 years agoFix pr18174.
Rafael Espindola [Sun, 8 Dec 2013 01:13:22 +0000 (01:13 +0000)]
Fix pr18174.

Clang outputs LLVM one top level decl at a time. This combined with the
visibility computation code looking for the newest NamespaceDecl would cause
it to produce different results for nested namespaces.

The two options for producing consistent results are
* Delay codegen of anything inside a namespace until the end of the file.
* Don't look for the newest NamespaceDecl.

This patch implements the second option.
This matches the gcc behavior too.

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

10 years agoDelete the now unnecessary test/generic-lambda-unimplemented-1y.cpp
Faisal Vali [Sat, 7 Dec 2013 20:57:51 +0000 (20:57 +0000)]
Delete the now unnecessary test/generic-lambda-unimplemented-1y.cpp

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

10 years ago[REFACTOR] Refactored some of the generic-lambda capturing code.
Faisal Vali [Sat, 7 Dec 2013 20:22:44 +0000 (20:22 +0000)]
[REFACTOR] Refactored some of the generic-lambda capturing code.

Employed the following refactorings:
  - Renamed some functions
  - Introduced explaining variables
  - Cleaned up & added comments
  - Used Optional<unsigned> for return value instead of an out parameter
  - Added assertions
  - Constified a few member functions

No functionality change.
All regressions pass.

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

10 years agoCodeGen: Don't emit linkage on thunks that aren't emitted because they're vararg.
Benjamin Kramer [Sat, 7 Dec 2013 16:12:52 +0000 (16:12 +0000)]
CodeGen: Don't emit linkage on thunks that aren't emitted because they're vararg.

This can happen when we're trying to emit a thunk with available_externally
linkage with optimization enabled but bail because it doesn't make sense
for vararg functions.

PR18098.

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

10 years agoEliminate the last trivial NDEBUG uses in clang headers
Alp Toker [Sat, 7 Dec 2013 13:51:35 +0000 (13:51 +0000)]
Eliminate the last trivial NDEBUG uses in clang headers

assert(sanity()) reads so much better than preprocessor conditional blocks.

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

10 years agoCommentLexer: eliminate an NDEBUG from the headers
Alp Toker [Sat, 7 Dec 2013 13:51:26 +0000 (13:51 +0000)]
CommentLexer: eliminate an NDEBUG from the headers

Code in headers shouldn't be conditional on the build configuration.

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

10 years agoChanged ConditionValue argument to PPCallbacks If and Elif callbacks to be a 3-state...
John Thompson [Sat, 7 Dec 2013 08:41:15 +0000 (08:41 +0000)]
Changed ConditionValue argument to PPCallbacks If and Elif callbacks to be a 3-state enum.

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

10 years agoTweak r196646
Alp Toker [Sat, 7 Dec 2013 07:32:31 +0000 (07:32 +0000)]
Tweak r196646

There was already a condition earlier in the function so just place the check
there.

Cleanup only.

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

10 years agoType traits: No need for switch to handle __builtin_types_compatible_p
Alp Toker [Sat, 7 Dec 2013 07:20:22 +0000 (07:20 +0000)]
Type traits: No need for switch to handle __builtin_types_compatible_p

__builtin_types_compatible_p() isn't a C++ type trait at all, rather a GNU C
special-case, so it's fine to use BoolTy the default return type for binary
type traits.

This brings BTT in line with other arities that already default to BoolTy.

Cleanup only, no change in behaviour.

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

10 years agoAdd a SubsetSubject in Attr.td to automate checking of where the objc_designated_init...
Argyrios Kyrtzidis [Sat, 7 Dec 2013 06:08:04 +0000 (06:08 +0000)]
Add a SubsetSubject in Attr.td to automate checking of where the objc_designated_initializer
attribute is acceptable.

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

10 years agoGive a more appropriate diagnostic when a template specialization or
Richard Smith [Sat, 7 Dec 2013 05:09:50 +0000 (05:09 +0000)]
Give a more appropriate diagnostic when a template specialization or
instantiation appears in a non-enclosing namespace (the previous diagnostic
talked about the C++98 rule even in C++11 mode).

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

10 years agoPass correct flags to assembler and linker for OpenBSD on AMD64, PowerPC
Joerg Sonnenberger [Sat, 7 Dec 2013 00:57:46 +0000 (00:57 +0000)]
Pass correct flags to assembler and linker for OpenBSD on AMD64, PowerPC
and MIPS64. From Brad Smith.

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

10 years agoObjectiveC. Continuing implementation of objc_bridge_related
Fariborz Jahanian [Sat, 7 Dec 2013 00:34:23 +0000 (00:34 +0000)]
ObjectiveC. Continuing implementation of objc_bridge_related
attribute in sema and issuing a variety of diagnostics lazily
for misuse of this attribute (and what to do) when converting
from CF types to ObjectiveC types (and vice versa).
// rdar://15499111

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

10 years agoFixing assertion failure introduced in 196602.
Warren Hunt [Sat, 7 Dec 2013 00:15:04 +0000 (00:15 +0000)]
Fixing assertion failure introduced in 196602.

Also includes a minor refactor with no functional change.

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

10 years agotest/Driver: Check that @ arguments that aren't files are handled
Justin Bogner [Fri, 6 Dec 2013 22:57:13 +0000 (22:57 +0000)]
test/Driver: Check that @ arguments that aren't files are handled

This tests the bug fix in llvm r196620.

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

10 years agoAdded support for mcpu krait
Ana Pazos [Fri, 6 Dec 2013 22:43:17 +0000 (22:43 +0000)]
Added support for mcpu krait

- krait processor currently modeled with the same features as A9.
- Krait processor additionally has VFP4 (fused multiply add/sub)
and hardware division features enabled.
- krait has currently the same Schedule model as A9
- krait cpu flag is not recognized by the GNU assembler yet,
it is replaced with march=armv7-a to avoid a lower march
from being used.

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

10 years agoFix test case inefficiency
David Peixotto [Fri, 6 Dec 2013 20:42:24 +0000 (20:42 +0000)]
Fix test case inefficiency

Was accidently passing the file to clang twice. No functionaly change.

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

10 years agoAdd option to use temporary file for assembling with clang
David Peixotto [Fri, 6 Dec 2013 20:27:33 +0000 (20:27 +0000)]
Add option to use temporary file for assembling with clang

This commit adds the flag '-via-file-asm' to the clang driver. The
purpose of this flag is to have a way to test that clang can consume
the assembly code that it outputs. When passed this flag, clang will
generate a temporary file that contains the assembly output from the
compile step. This assembly file will then be consumed by either the
integrated assembler or the external assembler. To test that the
integrated assembler can consume its own output compile with:

  $ clang -integrated-assembler -via-file-asm

Without the '-via-file-asm' flag, clang would directly create the
object file when using the integrated assembler. With the flag it
will first create the temporary assembly file and then read that
file and assemble it with the integrated assembler.

The flow is similar to -save-temps, except that it only effects
the assembly input and the temporary file is not saved.

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

10 years ago[MS-ABI] adds padding before all vbases after a bitfield
Warren Hunt [Fri, 6 Dec 2013 20:16:49 +0000 (20:16 +0000)]
[MS-ABI] adds padding before all vbases after a bitfield

MS-ABI adds padding before *every* vbase if the last field in a record
is a bit-field. This changes clangs behavior to match. I also fix some
windows-style line endings in the test file.

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

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

10 years ago[MS-ABI] Fix alias-avoidance padding between bases
Warren Hunt [Fri, 6 Dec 2013 19:54:25 +0000 (19:54 +0000)]
[MS-ABI] Fix alias-avoidance padding between bases

Adds padding between bases or virtual bases in an attempt to avoid
aliasing of zero-sized sub-objects.  The approach used by the ABI adds
two more bits of state.  Detailed comments are in the code.  Test cases
included.

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

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

10 years agoFixup to r196593.
Anna Zaks [Fri, 6 Dec 2013 19:28:16 +0000 (19:28 +0000)]
Fixup to r196593.

This is another regression fixed by reverting r189090.

In this case, the problem is not live variables but the approach that was taken in r189090. This regression was caused by explicitly binding "true" to the condition when we take the true branch. Normally that's okay, but in this case we're planning to reuse that condition as the value of the expression.

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

10 years agoRevert "[analyzer] Refactor conditional expression evaluating code"
Anna Zaks [Fri, 6 Dec 2013 18:56:29 +0000 (18:56 +0000)]
Revert "[analyzer] Refactor conditional expression evaluating code"

This reverts commit r189090.

The original patch introduced regressions (see the added live-variables.* tests). The patch depends on the correctness of live variable analyses, which are not computed correctly. I've opened PR18159 to track the proper resolution to this problem.

The patch was a stepping block to r189746. This is why part of the patch reverts temporary destructor tests that started crashing. The temporary destructors feature is disabled by default.

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

10 years agoTurning the __w64 attribute into an ignored attribute to match other Microsoft extens...
Aaron Ballman [Fri, 6 Dec 2013 18:56:03 +0000 (18:56 +0000)]
Turning the __w64 attribute into an ignored attribute to match other Microsoft extensions we do not currently support. Note that __w64 has been deprecated in MSVC since 2008.

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

10 years ago[libclang] Rename CXSkippedRanges to CXSourceRangeList to make it more future-proof.
Argyrios Kyrtzidis [Fri, 6 Dec 2013 18:55:45 +0000 (18:55 +0000)]
[libclang] Rename CXSkippedRanges to CXSourceRangeList to make it more future-proof.

Suggested by Alp Toker.

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

10 years agoMove the body of GCCInstallationDetector ctor into an init() function
Roman Divacky [Fri, 6 Dec 2013 18:32:18 +0000 (18:32 +0000)]
Move the body of GCCInstallationDetector ctor into an init() function
and call it from its only user. The linux toolchain. This saves quite
a lot of directory searching on other platforms.

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

10 years agoAdd flag -fauto-profile as alias to -fprofile-sample-use.
Diego Novillo [Fri, 6 Dec 2013 17:58:19 +0000 (17:58 +0000)]
Add flag -fauto-profile as alias to -fprofile-sample-use.

Summary:
GCC uses -fauto-profile to enable sample-based PGO. This patch
adds it to Clang as an alias for -fprofile-sample-use.

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

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

10 years agoFix code typos spotted while working on type traits
Alp Toker [Fri, 6 Dec 2013 17:56:43 +0000 (17:56 +0000)]
Fix code typos spotted while working on type traits

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

10 years agoTweak the ordering of a conditional to possibly avoid a few strcmps.
Aaron Ballman [Fri, 6 Dec 2013 16:26:55 +0000 (16:26 +0000)]
Tweak the ordering of a conditional to possibly avoid a few strcmps.

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

10 years agoReverting changes from r196415; this patch exposed a different, but unrelated bug...
Aaron Ballman [Fri, 6 Dec 2013 15:58:47 +0000 (15:58 +0000)]
Reverting changes from r196415; this patch exposed a different, but unrelated bug regarding the __has_attribute implementation. Reverting to unblock the Chrome tsan builds.

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

10 years agoclang-format: Change line break decisions for array subscripts.
Daniel Jasper [Fri, 6 Dec 2013 15:19:50 +0000 (15:19 +0000)]
clang-format: Change line break decisions for array subscripts.

Before:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      [aaaaaaaaaaaa];
After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int>
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa];

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

10 years agoAllow string literals as module names.
Daniel Jasper [Fri, 6 Dec 2013 09:25:54 +0000 (09:25 +0000)]
Allow string literals as module names.

In order to make the migration to modules easier, it seems to be helpful
to allow a 1:1 mapping between target names of a current build system
and the corresponding C++ modules. As  such targets commonly contain
characters like "-". ":" and "/", allowing arbitrary quote-escaped
strings seems to be a straightforward option.

After several offline discussions, the precise mechanisms for C++
module names especially regarding submodules and import statements has
yet to be determined. Thus, this patch only enables string literals as
names inside the module map files which can be used by automatic module
import (through #include).

Also improve the error message on missing use-declarations.

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

10 years agoAdd introductory paragraph to the C++ status page
Alp Toker [Fri, 6 Dec 2013 06:35:49 +0000 (06:35 +0000)]
Add introductory paragraph to the C++ status page

Use internal links to provide easier access to recent and ongoing work.

Also shift up the order of standards in the page title in order to avoid web
search results focusing on C++98 in the summary.

This is done to highlight the modern standards support in clang that was
previously languishing at the bottom of the page.

  "C++98/03 is sooooo yesterday" - dgregor

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

10 years agoPR18152: When computing the semantic form for an initializer list, keep track
Richard Smith [Fri, 6 Dec 2013 01:27:24 +0000 (01:27 +0000)]
PR18152: When computing the semantic form for an initializer list, keep track
of whether the initializer list is dependent.

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

10 years agoSupport MS-ABI's concept of "Required Alignment" imposed by
Warren Hunt [Fri, 6 Dec 2013 00:01:17 +0000 (00:01 +0000)]
Support MS-ABI's concept of "Required Alignment" imposed by
__declspec(align())

This patch implements required alignment in a way that makes
__declspec(align()) and #pragma pack play correctly together. In the
MS-ABI, __declspec(align()) is a hard rule and cannot be overridden by
#pragma pack. This cases each record to have two interesting alignments
"preferred alignment" (which matches Itanium's concept of alignment) and
"required alignment" which is an alignment that must never be violated,
even in the case of #pragma pack. This patch introduces the concept of
Required Alignment to the record builder and tracks/uses it
appropriately. Test cases are included.

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

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

10 years ago-Wassign-enum: compare unqualified types
Dmitri Gribenko [Thu, 5 Dec 2013 23:06:53 +0000 (23:06 +0000)]
-Wassign-enum: compare unqualified types

This commit changes -Wassign-enum to compare unqualified types.  One could
think that this does not matter much, because who wants a value of enum type
that is const-qualified?  But this breaks the intended pattern to silence this
warning with an explicit cast:

    static const enum Foo z = (enum Foo) 42;

In this case, source type is 'enum Foo', and destination type is 'const enum
Foo', and if we compare qualified types, they don't match, so we used warn.

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

10 years agoAllow the warning 'case value not in enumerated type' to be silenced with
Dmitri Gribenko [Thu, 5 Dec 2013 22:52:07 +0000 (22:52 +0000)]
Allow the warning 'case value not in enumerated type' to be silenced with
the following pattern.

If 'case' expression refers to a static const variable of the correct enum
type, then we count this as a sufficient declaration of intent by the user,
so we silence the warning.

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

10 years ago[ms-cxxabi] bitcast to i8* to deref a data member pointer
Reid Kleckner [Thu, 5 Dec 2013 22:44:07 +0000 (22:44 +0000)]
[ms-cxxabi] bitcast to i8* to deref a data member pointer

This was causing us to miscompile
llvm::SymbolTableListTraits::getListOwner(), which uses data member
pointers.

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

10 years agoFor NetBSD, use arm1176jzf-s as default CPU for ARMv6.
Joerg Sonnenberger [Thu, 5 Dec 2013 21:27:58 +0000 (21:27 +0000)]
For NetBSD, use arm1176jzf-s as default CPU for ARMv6.

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

10 years agoImplemented vget/vset_lane_f16 intrinsics
Ana Pazos [Thu, 5 Dec 2013 21:13:24 +0000 (21:13 +0000)]
Implemented vget/vset_lane_f16 intrinsics

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

10 years agoMark auto-generated file as auto-generated, as suggested by Alp.
Richard Smith [Thu, 5 Dec 2013 21:08:20 +0000 (21:08 +0000)]
Mark auto-generated file as auto-generated, as suggested by Alp.

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

10 years agoPass down the target CPU to the system assembler for NetBSD/ARM.
Joerg Sonnenberger [Thu, 5 Dec 2013 21:07:29 +0000 (21:07 +0000)]
Pass down the target CPU to the system assembler for NetBSD/ARM.

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

10 years agoObjectiveC: Don't warn when method implemented in
Fariborz Jahanian [Thu, 5 Dec 2013 20:52:31 +0000 (20:52 +0000)]
ObjectiveC: Don't warn when method implemented in
category is declared in category's primary
class's super class. Because the super class is
expected to implemented the method. // rdar://15580969

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

10 years ago[c-index-test] For the '-remap-file' option use a comma for separator which is more
Argyrios Kyrtzidis [Thu, 5 Dec 2013 20:13:27 +0000 (20:13 +0000)]
[c-index-test] For the '-remap-file' option use a comma for separator which is more
Windows friendly than the colon.

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

10 years agoFix assertion failure left over from changes to move away from "darwin" triples.
Bob Wilson [Thu, 5 Dec 2013 19:38:42 +0000 (19:38 +0000)]
Fix assertion failure left over from changes to move away from "darwin" triples.

I happened to notice this while trying to write a test for an iOS simulator
target. I suspect we just missed this when we added separate "macosx" and "ios"
triples instead of the generic "darwin" OS.

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

10 years agoAttributeList: tweak the conditional order to avoid two strcmps
Alp Toker [Thu, 5 Dec 2013 18:04:42 +0000 (18:04 +0000)]
AttributeList: tweak the conditional order to avoid two strcmps

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

10 years agoclang-format vsix cmake build: use ${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}
Hans Wennborg [Thu, 5 Dec 2013 17:49:58 +0000 (17:49 +0000)]
clang-format vsix cmake build: use ${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}
as the location for grabbing clang-format.exe, and also output the .vsix here.

This allows us to find clang-format.exe when building from a MSVC Solution.

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

10 years agoCheck the initial line number without going through PresumedLoc
Alp Toker [Thu, 5 Dec 2013 17:28:42 +0000 (17:28 +0000)]
Check the initial line number without going through PresumedLoc

No practical difference in this case and would return 1 either way, but this is
more self-explanatory.

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

10 years agoFix a tranche of comment, test and doc typos
Alp Toker [Thu, 5 Dec 2013 16:25:25 +0000 (16:25 +0000)]
Fix a tranche of comment, test and doc typos

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

10 years agoPR17983: Fix crasher bug in C++1y mode when performing a non-global array
Richard Smith [Thu, 5 Dec 2013 08:30:59 +0000 (08:30 +0000)]
PR17983: Fix crasher bug in C++1y mode when performing a non-global array
delete on a class which has no array cookie and has no class-specific operator
new.

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

10 years ago[libclang] Record ranges skipped by the preprocessor and expose them with libclang.
Argyrios Kyrtzidis [Thu, 5 Dec 2013 08:19:32 +0000 (08:19 +0000)]
[libclang] Record ranges skipped by the preprocessor and expose them with libclang.

Patch by Erik Verbruggen!

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

10 years ago[c-index-test] Enhance perform_test_reparse_source() to allow remapping a file
Argyrios Kyrtzidis [Thu, 5 Dec 2013 08:19:23 +0000 (08:19 +0000)]
[c-index-test] Enhance perform_test_reparse_source() to allow remapping a file
at a particular reparsing iteration.

Passing '-remap-file-1=from:to' will remap the files in the second iteration.

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

10 years ago[c-index-test] For the '-remap-file=' option use ':' instead of ';' for separator.
Argyrios Kyrtzidis [Thu, 5 Dec 2013 08:19:18 +0000 (08:19 +0000)]
[c-index-test] For the '-remap-file=' option use ':' instead of ';' for separator.

lldb does not like semicolon as part of an option.

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

10 years agoclang-format-diff.py: pass through errors to stderr, not stdout
Alp Toker [Thu, 5 Dec 2013 08:14:54 +0000 (08:14 +0000)]
clang-format-diff.py: pass through errors to stderr, not stdout

Also use write() for unified diff output to avoid further processing by the
print function (e.g. trailing newline).

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

10 years agoUpdate C++ status from 'SVN' to 'Clang 3.4' in preparation for release. Leave
Richard Smith [Thu, 5 Dec 2013 07:52:05 +0000 (07:52 +0000)]
Update C++ status from 'SVN' to 'Clang 3.4' in preparation for release. Leave
boxes yellow until we release, though.

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

10 years agoImplement DR482: namespace members can be redeclared with a qualified name
Richard Smith [Thu, 5 Dec 2013 07:51:02 +0000 (07:51 +0000)]
Implement DR482: namespace members can be redeclared with a qualified name
within their namespace, and such a redeclaration isn't required to be a
definition any more.

Update DR status page to say Clang 3.4 instead of SVN and add new Clang 3.5
category (but keep Clang 3.4 yellow for now).

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

10 years agoFix comment typo in r196476
Alp Toker [Thu, 5 Dec 2013 07:16:23 +0000 (07:16 +0000)]
Fix comment typo in r196476

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

10 years ago[objc] If an interface has no initializer marked as designated and introduces at...
Argyrios Kyrtzidis [Thu, 5 Dec 2013 07:07:03 +0000 (07:07 +0000)]
[objc] If an interface has no initializer marked as designated and introduces at least one new initializer,
don't assume that it inherits the designated initializers from the super class.

If the assumption was wrong because a new initializer was a designated one that was not marked as such,
we will emit misleading warnings for subclasses of the interface.

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

10 years agoCorrect hyphenations in comments and assert messages
Alp Toker [Thu, 5 Dec 2013 04:47:09 +0000 (04:47 +0000)]
Correct hyphenations in comments and assert messages

This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.

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

10 years agoPer [dcl.meaning]p1, a name in an inline namespace can be redeclared using a
Richard Smith [Thu, 5 Dec 2013 04:30:04 +0000 (04:30 +0000)]
Per [dcl.meaning]p1, a name in an inline namespace can be redeclared using a
name from the enclosing namespace set if the name is specified as a
qualified-id.

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

10 years agoFixed a bad assert from r194968. r194969 removed the assert.
Richard Trieu [Thu, 5 Dec 2013 04:27:16 +0000 (04:27 +0000)]
Fixed a bad assert from r194968.  r194969 removed the assert.

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

10 years agoAdd an assert to make it clear we're on the first line
Alp Toker [Thu, 5 Dec 2013 03:41:20 +0000 (03:41 +0000)]
Add an assert to make it clear we're on the first line

A raw lexer in its initial state is guaranteed to be on line number one.

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

10 years agoRemove unused variable.
Richard Trieu [Thu, 5 Dec 2013 02:52:09 +0000 (02:52 +0000)]
Remove unused variable.

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

10 years agoFix non-MSVC build error in ASTContext::getAdjustedType
Reid Kleckner [Thu, 5 Dec 2013 01:41:37 +0000 (01:41 +0000)]
Fix non-MSVC build error in ASTContext::getAdjustedType

Use FunctionTypeUnwrapper like we do in AttributedType to try to keep
some sugar.  We can actually do one better here in the future by
avoiding the AdjustedType node altogether when no sugar would be lost.

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

10 years agoFix init-captures for generic lambdas.
Faisal Vali [Thu, 5 Dec 2013 01:40:41 +0000 (01:40 +0000)]
Fix init-captures for generic lambdas.

For an init capture, process the initialization expression
right away.  For lambda init-captures such as the following:
const int x = 10;
 auto L = [i = x+1](int a) {
   return [j = x+2,
          &k = x](char b) { };
 };
keep in mind that each lambda init-capture has to have:
 - its initialization expression executed in the context
   of the enclosing/parent decl-context.
 - but the variable itself has to be 'injected' into the
   decl-context of its lambda's call-operator (which has
   not yet been created).
Each init-expression is a full-expression that has to get
Sema-analyzed (for capturing etc.) before its lambda's
call-operator's decl-context, scope & scopeinfo are pushed on their
respective stacks.  Thus if any variable is odr-used in the init-capture
it will correctly get captured in the enclosing lambda, if one exists.
The init-variables above are created later once the lambdascope and
call-operators decl-context is pushed onto its respective stack.

Since the lambda init-capture's initializer expression occurs in the
context of the enclosing function or lambda, therefore we can not wait
till a lambda scope has been pushed on before deciding whether the
variable needs to be captured.  We also need to process all
lvalue-to-rvalue conversions and discarded-value conversions,
so that we can avoid capturing certain constant variables.
For e.g.,
 void test() {
  const int x = 10;
  auto L = [&z = x](char a) { <-- don't capture by the current lambda
    return [y = x](int i) { <-- don't capture by enclosing lambda
         return y;
    }
  };
If x was not const, the second use would require 'L' to capture, and
that would be an error.
Make sure TranformLambdaExpr is also aware of this.

Patch approved by Richard (Thanks!!)
http://llvm-reviews.chandlerc.com/D2092

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

10 years agoParse: Recover better from bad definitions with base specifiers
David Majnemer [Thu, 5 Dec 2013 01:36:53 +0000 (01:36 +0000)]
Parse: Recover better from bad definitions with base specifiers

We would skip until the next comma, hoping good things whould lie there,
however this would fail when we have such things as this:

struct A {};
template <typename>
struct D;
template <>
struct D<C> : B, A::D;

Once this happens, we would believe that D with a nested namespace
specifier of A was a variable that was being declared. We would go on
to complain that there was an extraneous 'template <>' on their variable
declaration.

Crashes would happen when 'A' gets defined as 'enum class A {}' as
various asserts would fire.

Instead, we should skip up until the semicolon if we see that we are in
the middle of a definition and the current token is a ':'

This fixes PR17084.

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