]> granicus.if.org Git - clang/log
clang
9 years agoclang-format: [JS] Assign proper penalties when breaking a type annotation
Daniel Jasper [Fri, 10 Jul 2015 13:39:26 +0000 (13:39 +0000)]
clang-format: [JS] Assign proper penalties when breaking a type annotation

Before:
  class Test {
    aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa:
                         aaaaaaaaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {}
  }

After:
  class Test {
    aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa):
        aaaaaaaaaaaaaaaaaaaaaa {}
  }

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

9 years agoAdd missing builtins to altivec.h for ABI compliance (vol. 3)
Nemanja Ivanovic [Fri, 10 Jul 2015 13:11:34 +0000 (13:11 +0000)]
Add missing builtins to altivec.h for ABI compliance (vol. 3)

This patch corresponds to review:
http://reviews.llvm.org/D10972

Fix for the handling of dependent features that are enabled by default
on some CPU's (such as -mvsx, -mpower8-vector).

Also provides a number of new interfaces or fixes existing ones in
altivec.h.

Changed signatures to conform to ABI:
vector short vec_perm(vector signed short, vector signed short, vector unsigned char)
vector int vec_perm(vector signed int, vector signed int, vector unsigned char)
vector long long vec_perm(vector signed long long, vector signed long long, vector unsigned char)
vector signed char vec_sld(vector signed char, vector signed char, const int)
vector unsigned char vec_sld(vector unsigned char, vector unsigned char, const int)
vector bool char vec_sld(vector bool char, vector bool char, const int)
vector unsigned short vec_sld(vector unsigned short, vector unsigned short, const int)
vector signed short vec_sld(vector signed short, vector signed short, const int)
vector signed int vec_sld(vector signed int, vector signed int, const int)
vector unsigned int vec_sld(vector unsigned int, vector unsigned int, const int)
vector float vec_sld(vector float, vector float, const int)
vector signed char vec_splat(vector signed char, const int)
vector unsigned char vec_splat(vector unsigned char, const int)
vector bool char vec_splat(vector bool char, const int)
vector signed short vec_splat(vector signed short, const int)
vector unsigned short vec_splat(vector unsigned short, const int)
vector bool short vec_splat(vector bool short, const int)
vector pixel vec_splat(vector pixel, const int)
vector signed int vec_splat(vector signed int, const int)
vector unsigned int vec_splat(vector unsigned int, const int)
vector bool int vec_splat(vector bool int, const int)
vector float vec_splat(vector float, const int)

Added a VSX path to:
vector float vec_round(vector float)

Added interfaces:
vector signed char vec_eqv(vector signed char, vector signed char)
vector signed char vec_eqv(vector bool char, vector signed char)
vector signed char vec_eqv(vector signed char, vector bool char)
vector unsigned char vec_eqv(vector unsigned char, vector unsigned char)
vector unsigned char vec_eqv(vector bool char, vector unsigned char)
vector unsigned char vec_eqv(vector unsigned char, vector bool char)
vector signed short vec_eqv(vector signed short, vector signed short)
vector signed short vec_eqv(vector bool short, vector signed short)
vector signed short vec_eqv(vector signed short, vector bool short)
vector unsigned short vec_eqv(vector unsigned short, vector unsigned short)
vector unsigned short vec_eqv(vector bool short, vector unsigned short)
vector unsigned short vec_eqv(vector unsigned short, vector bool short)
vector signed int vec_eqv(vector signed int, vector signed int)
vector signed int vec_eqv(vector bool int, vector signed int)
vector signed int vec_eqv(vector signed int, vector bool int)
vector unsigned int vec_eqv(vector unsigned int, vector unsigned int)
vector unsigned int vec_eqv(vector bool int, vector unsigned int)
vector unsigned int vec_eqv(vector unsigned int, vector bool int)
vector signed long long vec_eqv(vector signed long long, vector signed long long)
vector signed long long vec_eqv(vector bool long long, vector signed long long)
vector signed long long vec_eqv(vector signed long long, vector bool long long)
vector unsigned long long vec_eqv(vector unsigned long long, vector unsigned long long)
vector unsigned long long vec_eqv(vector bool long long, vector unsigned long long)
vector unsigned long long vec_eqv(vector unsigned long long, vector bool long long)
vector float vec_eqv(vector float, vector float)
vector float vec_eqv(vector bool int, vector float)
vector float vec_eqv(vector float, vector bool int)
vector double vec_eqv(vector double, vector double)
vector double vec_eqv(vector bool long long, vector double)
vector double vec_eqv(vector double, vector bool long long)
vector bool long long vec_perm(vector bool long long, vector bool long long, vector unsigned char)
vector double vec_round(vector double)
vector double vec_splat(vector double, const int)
vector bool long long vec_splat(vector bool long long, const int)
vector signed long long vec_splat(vector signed long long, const int)
vector unsigned long long vec_splat(vector unsigned long long,
vector bool int vec_sld(vector bool int, vector bool int, const int)
vector bool short vec_sld(vector bool short, vector bool short, const int)

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

9 years agoTweak a couple of -fprofile tests in clang/test to accept backslash in path.
NAKAMURA Takumi [Fri, 10 Jul 2015 13:11:08 +0000 (13:11 +0000)]
Tweak a couple of -fprofile tests in clang/test to accept backslash in path.

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

9 years agoTry to fix the test harder, it still fails on windows for unknown reasons.
Benjamin Kramer [Fri, 10 Jul 2015 13:04:41 +0000 (13:04 +0000)]
Try to fix the test harder, it still fails on windows for unknown reasons.

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

9 years agoReapply test for r241811 with a fix for msvc compat mode.
Benjamin Kramer [Fri, 10 Jul 2015 11:37:54 +0000 (11:37 +0000)]
Reapply test for r241811 with a fix for msvc compat mode.

Delayed template parsing interferes with code completion, just distable it for
this test. This reverts r241811.

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

9 years agoRespect alignment when loading up a coerced function argument
Ulrich Weigand [Fri, 10 Jul 2015 11:31:43 +0000 (11:31 +0000)]
Respect alignment when loading up a coerced function argument

Code in CGCall.cpp that loads up function arguments that need to be
coerced to a different type may in some cases ignore the fact that
the source of the argument is not naturally aligned. This may cause
incorrect code to be generated. In some places in CreateCoercedLoad,
we already have setAlignment calls to address this, but I ran into one
where it was missing, causing wrong code generation on SystemZ.

However, in that location, we do not actually know what alignment of
the source location we can rely on; the callers do not pass anything
to this routine. This is already an issue in other places in
CreateCoercedLoad; and the same problem exists for CreateCoercedStore.

To avoid pessimising code, and to fix the FIXMEs already in place,
this patch also adds an alignment argument to the CreateCoerced*
routines and uses it instead of forcing an alignment of 1. The
callers are changed to pass in the best information they have.

This actually requires changes in a number of existing test cases
since we now get better alignment in many places.

Differential Revision: http://reviews.llvm.org/D11033

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

9 years agoRe-use a single SmallString instance to reduce the stack frame size
Daniel Jasper [Fri, 10 Jul 2015 08:25:54 +0000 (08:25 +0000)]
Re-use a single SmallString instance to reduce the stack frame size

In certain builds (msan), this can otherwise exceed the stack frame
limit set for certain environments.

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

9 years agoRemove test that tests referring to the current working directory. You
Daniel Jasper [Fri, 10 Jul 2015 05:57:23 +0000 (05:57 +0000)]
Remove test that tests referring to the current working directory. You
cannot assume that the current working directory is writable in all test
environments. I don't know a better way to write this test of hand, lets
discuss. Possibly, a better option would be to put these together with
other test testing the driver directly.

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

9 years agoRevert test lines added in r241811, "[CodeCompletion] Don't crash on member inits...
NAKAMURA Takumi [Fri, 10 Jul 2015 03:09:19 +0000 (03:09 +0000)]
Revert test lines added in r241811, "[CodeCompletion] Don't crash on member inits of templated constructors.", for now.

It doesn't pass for targeting MS mode.

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

9 years agoDriver: Make all of -f{,no-}sanitize{,-recover,-trap} core options.
Peter Collingbourne [Fri, 10 Jul 2015 02:17:22 +0000 (02:17 +0000)]
Driver: Make all of -f{,no-}sanitize{,-recover,-trap} core options.

This allows them to be used from clang-cl.

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

9 years agoRe-enable 32-bit SEH after the alignment fix
Reid Kleckner [Fri, 10 Jul 2015 00:16:25 +0000 (00:16 +0000)]
Re-enable 32-bit SEH after the alignment fix

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

9 years ago[Static Analyzer] Basic per checker command line option validation.
Gabor Horvath [Thu, 9 Jul 2015 21:43:45 +0000 (21:43 +0000)]
[Static Analyzer] Basic per checker command line option validation.

Differential Revision: http://reviews.llvm.org/D8077

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

9 years agoCFI: Emit correct bit set information if RTTI is disabled under MS ABI.
Peter Collingbourne [Thu, 9 Jul 2015 19:56:14 +0000 (19:56 +0000)]
CFI: Emit correct bit set information if RTTI is disabled under MS ABI.

We were previously creating bit set entries at virtual table offset
sizeof(void*) unconditionally under the Microsoft C++ ABI. This is incorrect
if RTTI data is disabled; in that case the "address point" is at offset
0. This change modifies bit set emission to take into account whether RTTI
data is being emitted.

Also make a start on a blacklisting scheme for records.

Differential Revision: http://reviews.llvm.org/D11048

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

9 years agoRename ModuleContainerGenerator to PCHContainergenerator for consistency
Adrian Prantl [Thu, 9 Jul 2015 19:46:39 +0000 (19:46 +0000)]
Rename ModuleContainerGenerator to PCHContainergenerator for consistency
and re-clang-format (NFC).

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

9 years agoAdd GCC-compatible flags -fprofile-generate and -fprofile-use.
Diego Novillo [Thu, 9 Jul 2015 17:23:53 +0000 (17:23 +0000)]
Add GCC-compatible flags -fprofile-generate and -fprofile-use.

This patch adds support for specifying where the profile is emitted in a
way similar to GCC. These flags are used to specify directories instead
of filenames. When -fprofile-generate=DIR is used, the compiler will
generate code to write to <DIR>/default.profraw.

The patch also adds a couple of extensions: LLVM_PROFILE_FILE can still be
used to override the directory and file name to use and -fprofile-use
accepts both directories and filenames.

To simplify the set of flags used in the backend, all the flags get
canonicalized to -fprofile-instr-{generate,use} when passed to the
backend. The decision to use a default name for the profile is done
in the driver.

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

9 years ago[Driver] semi-annual ubuntu version bump.
Benjamin Kramer [Thu, 9 Jul 2015 15:31:17 +0000 (15:31 +0000)]
[Driver] semi-annual ubuntu version bump.

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

9 years ago[CodeCompletion] Don't crash on member inits of templated constructors.
Benjamin Kramer [Thu, 9 Jul 2015 15:31:10 +0000 (15:31 +0000)]
[CodeCompletion] Don't crash on member inits of templated constructors.

Also fixes a crash (on invalid) member functions with a colon
initializer. PR23948.

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

9 years agoAdd clang_free to libclang to free memory allocated in libclang.
Yaron Keren [Thu, 9 Jul 2015 07:53:23 +0000 (07:53 +0000)]
Add clang_free to libclang to free memory allocated in libclang.

One of the problems libclang tests has running under Windows is memory
allocated in libclang.dll but being freed in the test executable, possibly
by a different memory manager. This patch exposes a new export function,
clang_free(), used to free any allocated memory with the same libclang.dll
memory manager that allocated the memory.

http://reviews.llvm.org/D10949

Reviewed by Reid Kleckner, Douglas Gregor.

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

9 years agoDriver: Include the driver arguments in crash reports
Justin Bogner [Thu, 9 Jul 2015 06:58:31 +0000 (06:58 +0000)]
Driver: Include the driver arguments in crash reports

Similarly to r231989, the driver arguments can be quite helpful in
diagnosing a crash.

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

9 years agoRevert r241770 and add Basic to the dependencies of clang-check instead.
Adrian Prantl [Thu, 9 Jul 2015 02:53:05 +0000 (02:53 +0000)]
Revert r241770 and add Basic to the dependencies of clang-check instead.
PR24067.

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

9 years agoMove the definition of ~PCHContainerOperations from Basic into Frontend.
Adrian Prantl [Thu, 9 Jul 2015 01:01:52 +0000 (01:01 +0000)]
Move the definition of ~PCHContainerOperations from Basic into Frontend.

Fixes PR24067.

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

9 years agoDisable 32-bit SEH, again
Reid Kleckner [Wed, 8 Jul 2015 23:57:03 +0000 (23:57 +0000)]
Disable 32-bit SEH, again

Move the diagnostic back to codegen so that we can compile ATL on the
self-host bot. We don't actually end up emitting code for the __try, so
the diagnostic won't be hit.

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

9 years agoDeclObjC: Move computing the type of self into a separate function (NFC).
Adrian Prantl [Wed, 8 Jul 2015 22:15:59 +0000 (22:15 +0000)]
DeclObjC: Move computing the type of self into a separate function (NFC).
This function will be used for emitting debug info.

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

9 years ago[modules] Fix merging support for forward-declared enums with fixed underlying types...
Richard Smith [Wed, 8 Jul 2015 21:49:31 +0000 (21:49 +0000)]
[modules] Fix merging support for forward-declared enums with fixed underlying types. A visible declaration is enough to make the type complete, but not enough to make the definition visible.

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

9 years agoCleanup the doxygen comments in CGDebugInfo.cpp according to the coding
Adrian Prantl [Wed, 8 Jul 2015 21:18:34 +0000 (21:18 +0000)]
Cleanup the doxygen comments in CGDebugInfo.cpp according to the coding
standards. Remove several hilariously out-of-date and redundant comments
and move the non-redundant ones into the header file.

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

9 years ago[modules] Fix crash when writing an update record for a redeclaration of an empty...
Richard Smith [Wed, 8 Jul 2015 21:15:32 +0000 (21:15 +0000)]
[modules] Fix crash when writing an update record for a redeclaration of an empty namespace.

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

9 years agoCodeGen: Fix off-by-one error in CFI class identification function for MS ABI.
Peter Collingbourne [Wed, 8 Jul 2015 21:08:08 +0000 (21:08 +0000)]
CodeGen: Fix off-by-one error in CFI class identification function for MS ABI.

We were previously ignoring classes laid out at offset zero.

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

9 years agoDriver: enable support for -fsanitize=cfi on Windows.
Peter Collingbourne [Wed, 8 Jul 2015 21:08:05 +0000 (21:08 +0000)]
Driver: enable support for -fsanitize=cfi on Windows.

There are known issues, but the current implementation is good enough for
the check-cfi test suite.

Differential Revision: http://reviews.llvm.org/D11030

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

9 years agoCleanup the doxygen comments in CGDebugInfo.h according to the coding
Adrian Prantl [Wed, 8 Jul 2015 20:53:55 +0000 (20:53 +0000)]
Cleanup the doxygen comments in CGDebugInfo.h according to the coding
standards and clang-format the file.

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

9 years agoFix the spelling of Objective-C.
Adrian Prantl [Wed, 8 Jul 2015 20:53:53 +0000 (20:53 +0000)]
Fix the spelling of Objective-C.

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

9 years agoRemove unused diagnostics. NFC.
Benjamin Kramer [Wed, 8 Jul 2015 19:10:43 +0000 (19:10 +0000)]
Remove unused diagnostics. NFC.

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

9 years ago[Driver] print-multi-os-directory is unsupported.
Davide Italiano [Wed, 8 Jul 2015 18:49:41 +0000 (18:49 +0000)]
[Driver] print-multi-os-directory is unsupported.

Until somebody writes the code for it, be loud about the fact that
it's not implemented yet.

Differential Revision: http://reviews.llvm.org/D11020

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

9 years ago[Static Analyzer] Make the paths relative from the project root when generating refer...
Gabor Horvath [Wed, 8 Jul 2015 18:39:31 +0000 (18:39 +0000)]
[Static Analyzer] Make the paths relative from the project root when generating reference results in the test suite.

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

9 years agoAST: Avoid reading an unitialized value
Justin Bogner [Wed, 8 Jul 2015 18:32:26 +0000 (18:32 +0000)]
AST: Avoid reading an unitialized value

Desugar doesn't necessarily initialize ShouldAKA, but as of r241542 it
may read it. Fix the misuse of the API and initialize this before
passing it in.

Found by ubsan.

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

9 years ago[SEH] Re-enable SEH on x86 Windows after r241699
Reid Kleckner [Wed, 8 Jul 2015 18:27:10 +0000 (18:27 +0000)]
[SEH] Re-enable SEH on x86 Windows after r241699

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

9 years agoUpdate PCHInternals.rst to document PCH wrapped in object file containers.
Adrian Prantl [Wed, 8 Jul 2015 16:52:51 +0000 (16:52 +0000)]
Update PCHInternals.rst to document PCH wrapped in object file containers.

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

9 years agoRevert "Fix a linker issue with clang-check on Linux."
Adrian Prantl [Wed, 8 Jul 2015 15:57:42 +0000 (15:57 +0000)]
Revert "Fix a linker issue with clang-check on Linux."

This reverts commit r241636 as it turned out to be unnecessary.

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

9 years ago[CMake] clang-check: Prune redundant libdeps introduced in r241653.
NAKAMURA Takumi [Wed, 8 Jul 2015 14:13:27 +0000 (14:13 +0000)]
[CMake] clang-check: Prune redundant libdeps introduced in r241653.

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

9 years ago[MIPS] Add support for direct-to-nacl in Clang
Petar Jovanovic [Wed, 8 Jul 2015 13:07:31 +0000 (13:07 +0000)]
[MIPS] Add support for direct-to-nacl in Clang

For Mips direct-to-nacl, the goal is to be close to le32 front-end and
use Mips32EL backend. This patch defines new NaClMips32ELTargetInfo and
modifies it slightly to be close to le32. It also adds necessary parts,
inline with ARM and X86.

Differential Revision: http://reviews.llvm.org/D10739

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

9 years ago[EH] Fix for clang bug 24005 - no cleanup for array of memcpy-able objects in struct...
Alexey Bataev [Wed, 8 Jul 2015 07:31:02 +0000 (07:31 +0000)]
[EH] Fix for clang bug 24005 - no cleanup for array of memcpy-able objects in struct (patch by Denis Zobnin)

The fix is to emit cleanup for arrays of memcpy-able objects in struct if an exception is thrown later during copy-construction.
Differential Revision: http://reviews.llvm.org/D10989

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

9 years agoRevert "parser: wordsmith diagnostic message" and "parser: diagnose empty attribute...
David Majnemer [Wed, 8 Jul 2015 05:55:00 +0000 (05:55 +0000)]
Revert "parser: wordsmith diagnostic message" and "parser: diagnose empty attribute blocks"

This reverts commit r239846 and r239879.  They caused clang's
-fms-extensions behavior to incorrectly parse lambdas and includes a
testcase to ensure we don't regress again.

This issue was found in PR24027.

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

9 years ago[CodeGen] Correctly handle base classes which are passed in memory
David Majnemer [Wed, 8 Jul 2015 05:14:29 +0000 (05:14 +0000)]
[CodeGen] Correctly handle base classes which are passed in memory

We didn't correctly process the case where a base class is classified as
MEMORY.  This would cause us to trip over an assertion.

This fixes PR24020.

Differential Revision: http://reviews.llvm.org/D10907

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

9 years ago[CodeGen] Don't crash classifying a union of an AVX vector and an int
David Majnemer [Wed, 8 Jul 2015 05:07:05 +0000 (05:07 +0000)]
[CodeGen] Don't crash classifying a union of an AVX vector and an int

We forgot to run postMerge after decided that the union had to be
classified as MEMORY.  This left us with Lo == MEMORY and Hi == SSEUp
which is an invalid combination.

This fixes PR24021.

Differential Revision: http://reviews.llvm.org/D10908

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

9 years agoSemaDeclObjC.cpp: Escape \@ in comment lines. [-Wdocumentation]
NAKAMURA Takumi [Wed, 8 Jul 2015 02:35:56 +0000 (02:35 +0000)]
SemaDeclObjC.cpp: Escape \@ in comment lines. [-Wdocumentation]

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

9 years ago[modules] When determining the visible module set during template
Richard Smith [Wed, 8 Jul 2015 02:22:15 +0000 (02:22 +0000)]
[modules] When determining the visible module set during template
instantiation, use the set of modules visible from the template definition, not
from whichever declaration the specialization was instantiated from.

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

9 years ago[CMake] Reorder libdeps. NFC.
NAKAMURA Takumi [Wed, 8 Jul 2015 02:06:29 +0000 (02:06 +0000)]
[CMake] Reorder libdeps. NFC.

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

9 years ago[CMake] Fill up required libs, corresponding to r241653.
NAKAMURA Takumi [Wed, 8 Jul 2015 02:06:21 +0000 (02:06 +0000)]
[CMake] Fill up required libs, corresponding to r241653.

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

9 years agoChange the expectation for test/Tooling/ms-asm-no-target.cpp since
Adrian Prantl [Wed, 8 Jul 2015 01:39:38 +0000 (01:39 +0000)]
Change the expectation for test/Tooling/ms-asm-no-target.cpp since
clang-check now initializes the available targets to support
clang module containers.

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

9 years agoRevert "Revert r241620 and follow-up commits" and move the initialization
Adrian Prantl [Wed, 8 Jul 2015 01:00:30 +0000 (01:00 +0000)]
Revert "Revert r241620 and follow-up commits" and move the initialization
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp.

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

9 years ago[SEH] Switch from frameaddress(0) to localaddress
Reid Kleckner [Tue, 7 Jul 2015 23:23:31 +0000 (23:23 +0000)]
[SEH] Switch from frameaddress(0) to localaddress

This should do the right thing for stack realignment prologues.

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

9 years agoRevert r241620 and follow-up commits while investigating linux buildbot failures.
Adrian Prantl [Tue, 7 Jul 2015 23:19:46 +0000 (23:19 +0000)]
Revert r241620 and follow-up commits while investigating linux buildbot failures.

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

9 years agoFix a linker issue with clang-check on Linux.
Adrian Prantl [Tue, 7 Jul 2015 22:34:51 +0000 (22:34 +0000)]
Fix a linker issue with clang-check on Linux.
There must be a better way to fix this — I'll keep investigating.

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

9 years agoCleanup: Use the C++ API to initialize the backend.
Adrian Prantl [Tue, 7 Jul 2015 22:34:47 +0000 (22:34 +0000)]
Cleanup: Use the C++ API to initialize the backend.

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

9 years agoUpdate clang for intrinsic rename of framerecover to localrecover
Reid Kleckner [Tue, 7 Jul 2015 22:26:07 +0000 (22:26 +0000)]
Update clang for intrinsic rename of framerecover to localrecover

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

9 years agoAdd target requirements to testcases that emit PCH.
Adrian Prantl [Tue, 7 Jul 2015 21:45:48 +0000 (21:45 +0000)]
Add target requirements to testcases that emit PCH.

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

9 years agoAdd LLVM backend dependencies to clang-check also in cmake.
Adrian Prantl [Tue, 7 Jul 2015 21:06:18 +0000 (21:06 +0000)]
Add LLVM backend dependencies to clang-check also in cmake.

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

9 years agoUnderscores in constructor arguments are so passe.
Eric Christopher [Tue, 7 Jul 2015 21:00:42 +0000 (21:00 +0000)]
Underscores in constructor arguments are so passe.

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

9 years agoUpdate testcases that use precompiled headers to require a target after
Adrian Prantl [Tue, 7 Jul 2015 20:31:18 +0000 (20:31 +0000)]
Update testcases that use precompiled headers to require a target after
r241620.

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

9 years agoWrap clang modules and pch files in an object file container.
Adrian Prantl [Tue, 7 Jul 2015 20:11:29 +0000 (20:11 +0000)]
Wrap clang modules and pch files in an object file container.
This patch adds ObjectFilePCHContainerOperations uses the LLVM backend
to put the contents of a PCH into a __clangast section inside a COFF, ELF,
or Mach-O object file container.

This is done to facilitate module debugging by makeing it possible to
store the debug info for the types defined by a module alongside the AST.

rdar://problem/20091852

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

9 years agoUse AlignOf instead of alignOf so that this can go back to being a static_assert...
Aaron Ballman [Tue, 7 Jul 2015 17:12:14 +0000 (17:12 +0000)]
Use AlignOf instead of alignOf so that this can go back to being a static_assert. Amends r241577.

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

9 years agoclang-format: Break after "for (" less eagerly.
Daniel Jasper [Tue, 7 Jul 2015 16:09:39 +0000 (16:09 +0000)]
clang-format: Break after "for (" less eagerly.

Before:
  for (
      auto aaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
      aaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbbbbbbb;
      ++aaaaaaaaaaaaaaaaaaaaaaaaaaa) {

After:
  for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaa(
           aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
       aaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbbbbbbb;
       ++aaaaaaaaaaaaaaaaaaaaaaaaaaa) {

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

9 years agoDon't put anonymous structs within anonymous unions.
Douglas Gregor [Tue, 7 Jul 2015 15:48:11 +0000 (15:48 +0000)]
Don't put anonymous structs within anonymous unions.

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

9 years agoFix first line comment format, NFC.
Yaron Keren [Tue, 7 Jul 2015 15:10:47 +0000 (15:10 +0000)]
Fix first line comment format, NFC.

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

9 years agoclang-format: Don't wrap before the ] of a lambda introducer.
Daniel Jasper [Tue, 7 Jul 2015 13:50:50 +0000 (13:50 +0000)]
clang-format: Don't wrap before the ] of a lambda introducer.

Before:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([=
  ](int iiiiiiiiiiii) {
    return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa;
  });

After:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([=](
      int iiiiiiiiiiii) {
    return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa;
  });

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

9 years agoSilence -Wparentheses warnings (and ran it through clang-format); NFC.
Aaron Ballman [Tue, 7 Jul 2015 13:25:57 +0000 (13:25 +0000)]
Silence -Wparentheses warnings (and ran it through clang-format); NFC.

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

9 years agoSilence a -Wcast-qual warning; NFC.
Aaron Ballman [Tue, 7 Jul 2015 13:22:55 +0000 (13:22 +0000)]
Silence a -Wcast-qual warning; NFC.

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

9 years agoSilence a -Wunused-variable warning; NFC.
Aaron Ballman [Tue, 7 Jul 2015 13:21:26 +0000 (13:21 +0000)]
Silence a -Wunused-variable warning; NFC.

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

9 years agoAppease MSVC 2013 a few more times, which was complaining about a syntax error with...
Aaron Ballman [Tue, 7 Jul 2015 13:19:10 +0000 (13:19 +0000)]
Appease MSVC 2013 a few more times, which was complaining about a syntax error with an unexpected close curly brace. For some reason, the range-based for loop requires curly braces to compile in MSVC.

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

9 years agoAppease MSVC 2013, which was complaining about a syntax error with an unexpected...
Aaron Ballman [Tue, 7 Jul 2015 12:54:02 +0000 (12:54 +0000)]
Appease MSVC 2013, which was complaining about a syntax error with an unexpected close curly brace. For some reason, the range-based for loop requires curly braces to compile in MSVC.

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

9 years agoChanging a use of alignof() into llvm::alignOf() for MSVC compatibility. This require...
Aaron Ballman [Tue, 7 Jul 2015 12:50:30 +0000 (12:50 +0000)]
Changing a use of alignof() into llvm::alignOf() for MSVC compatibility. This requires changing a static_assert into an assert, too.

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

9 years agoAdd a comment to explain how the decision to pass feature "+long-calls" is made.
Akira Hatanaka [Tue, 7 Jul 2015 08:28:42 +0000 (08:28 +0000)]
Add a comment to explain how the decision to pass feature "+long-calls" is made.

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

9 years ago[ARM] Pass subtarget feature "+long-calls" instead of passing backend option
Akira Hatanaka [Tue, 7 Jul 2015 06:42:05 +0000 (06:42 +0000)]
[ARM] Pass subtarget feature "+long-calls" instead of passing backend option
"-arm-long-calls".

This change allows using -mlong-calls/-mno-long-calls for LTO and enabling or
disabling long call on a per-function basis.

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D9414

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

9 years agoDon't rely on the use of non-POD types within unions.
Douglas Gregor [Tue, 7 Jul 2015 06:20:46 +0000 (06:20 +0000)]
Don't rely on the use of non-POD types within unions.

They aren't universally supported and we're not getting any benefit
from using them.

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

9 years agos/__nonnull/_Nonnull in a test for Objective-C __kindof.
Douglas Gregor [Tue, 7 Jul 2015 06:20:41 +0000 (06:20 +0000)]
s/__nonnull/_Nonnull in a test for Objective-C __kindof.

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

9 years ago[AST] Add a comment for ObjCMethodDecl::getSendResultType() function.
Douglas Gregor [Tue, 7 Jul 2015 06:20:39 +0000 (06:20 +0000)]
[AST] Add a comment for ObjCMethodDecl::getSendResultType() function.

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

9 years ago[libclang] Implement proper code-completion in an ObjC type parameter position.
Douglas Gregor [Tue, 7 Jul 2015 06:20:36 +0000 (06:20 +0000)]
[libclang] Implement proper code-completion in an ObjC type parameter position.

rdar://19670303

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

9 years ago[libclang] When inferring nonnull use the contextual keyword for the code-completion...
Douglas Gregor [Tue, 7 Jul 2015 06:20:31 +0000 (06:20 +0000)]
[libclang] When inferring nonnull use the contextual keyword for the code-completion results,
when appropriate.

rdar://20742295

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

9 years ago[libclang] Replace ObjC generic parameters when code-completing method implementations.
Douglas Gregor [Tue, 7 Jul 2015 06:20:27 +0000 (06:20 +0000)]
[libclang] Replace ObjC generic parameters when code-completing method implementations.

rdar://20643768

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

9 years ago[libclang] Fix code-completion of block parameters that are marked with nullability...
Douglas Gregor [Tue, 7 Jul 2015 06:20:22 +0000 (06:20 +0000)]
[libclang] Fix code-completion of block parameters that are marked with nullability specifier.

rdar://20755276

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

9 years ago[libclang] Replace ObjC generic parameters in code-completion results.
Douglas Gregor [Tue, 7 Jul 2015 06:20:19 +0000 (06:20 +0000)]
[libclang] Replace ObjC generic parameters in code-completion results.

rdar://19369529

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

9 years agoThe AST importer had a bug where it would enter into an infinite recursion
Douglas Gregor [Tue, 7 Jul 2015 06:20:12 +0000 (06:20 +0000)]
The AST importer had a bug where it would enter into an infinite recursion
when importing type parameter lists.  The reason is that type parameters
have their DeclContexts set to the interface that is parameterized with those
types, and the importer would follow that loop and blow the stack out.

I've changed the way this works so that the type parameters are only imported
after the interface that contains them has been registered via the Imported()
function.

This is tested by LLDB.

<rdar://problem/20315663>

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

9 years agoFix alignment check for ObjCObjectTypeLoc.
Douglas Gregor [Tue, 7 Jul 2015 04:23:51 +0000 (04:23 +0000)]
Fix alignment check for ObjCObjectTypeLoc.

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

9 years agoUse llvm::alignOf rather than alignof()
Douglas Gregor [Tue, 7 Jul 2015 04:06:31 +0000 (04:06 +0000)]
Use llvm::alignOf rather than alignof()

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

9 years agoFactor the simpleTransform() visitor so that it is not a local class.
Douglas Gregor [Tue, 7 Jul 2015 03:58:59 +0000 (03:58 +0000)]
Factor the simpleTransform() visitor so that it is not a local class.

Older versions of Clang cannot handle such local classes properly
rdar://problem/19386032.

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

9 years agoImplement variance for Objective-C type parameters.
Douglas Gregor [Tue, 7 Jul 2015 03:58:54 +0000 (03:58 +0000)]
Implement variance for Objective-C type parameters.

Introduce co- and contra-variance for Objective-C type parameters,
which allows us to express that (for example) an NSArray is covariant
in its type parameter. This means that NSArray<NSMutableString *> * is
a subtype of NSArray<NSString *> *, which is expected of the immutable
Foundation collections.

Type parameters can be annotated with __covariant or __contravariant
to make them co- or contra-variant, respectively. This feature can be
detected by __has_feature(objc_generics_variance). Implements
rdar://problem/20217490.

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

9 years agoImplement the Objective-C __kindof type qualifier.
Douglas Gregor [Tue, 7 Jul 2015 03:58:42 +0000 (03:58 +0000)]
Implement the Objective-C __kindof type qualifier.

The __kindof type qualifier can be applied to Objective-C object
(pointer) types to indicate id-like behavior, which includes implicit
"downcasting" of __kindof types to subclasses and id-like message-send
behavior. __kindof types provide better type bounds for substitutions
into unspecified generic types, which preserves more type information.

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

9 years agoWarn when an intended Objective-C specialization was actually a useless protocol...
Douglas Gregor [Tue, 7 Jul 2015 03:58:28 +0000 (03:58 +0000)]
Warn when an intended Objective-C specialization was actually a useless protocol qualification.

Warn in cases where one has provided redundant protocol qualification
that might be a typo for a specialization, e.g., NSArray<NSObject>,
which is pointless (NSArray declares that it conforms to NSObject) and
is likely to be a typo for NSArray<NSObject *>, i.e., an array of
NSObject pointers. This warning is very narrow, only applying when the
base type being qualified is parameterized, has the same number of
parameters as their are protocols listed, all of the names can also
refer to types (including Objective-C class types, of course), and at
least one of those types is an Objective-C class (making this a typo
for a missing '*'). The limitations are partly for performance reasons
(we don't want to do redundant name lookup unless we really need to),
and because we want the warning to apply in very limited cases to
limit false positives.

Part of rdar://problem/6294649.

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

9 years agoWarn when an Objective-C collection literal element is converted to an incompatible...
Douglas Gregor [Tue, 7 Jul 2015 03:58:22 +0000 (03:58 +0000)]
Warn when an Objective-C collection literal element is converted to an incompatible type.

Objective-C collection literals produce unspecialized
NSArray/NSDictionary objects that can then be implicitly converted to
specialized versions of these types. In such cases, check that the
elements in the collection are suitable for the specialized
collection. Part of rdar://problem/6294649.

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

9 years agoC++ support for Objective-C lightweight generics.
Douglas Gregor [Tue, 7 Jul 2015 03:58:14 +0000 (03:58 +0000)]
C++ support for Objective-C lightweight generics.

Teach C++'s tentative parsing to handle specializations of Objective-C
class types (e.g., NSArray<NSString *>) as well as Objective-C
protocol qualifiers (id<NSCopying>) by extending type-annotation
tokens to handle this case. As part of this, remove Objective-C
protocol qualifiers from the declaration specifiers, which never
really made sense: instead, provide Sema entry points to make them
part of the type annotation token. Among other things, this properly
diagnoses bogus types such as "<NSCopying> id" which should have been
written as "id <NSCopying>".

Implements template instantiation support for, e.g., NSArray<T>*
in C++. Note that parameterized classes are not templates in the C++
sense, so that cannot (for example) be used as a template argument for
a template template parameter. Part of rdar://problem/6294649.

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

9 years agoImprove the Objective-C common-type computation used by the ternary operator.
Douglas Gregor [Tue, 7 Jul 2015 03:58:01 +0000 (03:58 +0000)]
Improve the Objective-C common-type computation used by the ternary operator.

The Objective-C common-type computation had a few problems that
required a significant rework, including:
  - Quadradic behavior when finding the common base type; now it's
  linear.
  - Keeping around type arguments when computing the common type
  between a specialized and an unspecialized type
  - Introducing redundant protocol qualifiers.

Part of rdar://problem/6294649. Also fixes rdar://problem/19572837 by
addressing a longstanding bug in
ASTContext::CollectInheritedProtocols().

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

9 years agoSubstitute type arguments into uses of Objective-C interface members.
Douglas Gregor [Tue, 7 Jul 2015 03:57:53 +0000 (03:57 +0000)]
Substitute type arguments into uses of Objective-C interface members.

When messaging a method that was defined in an Objective-C class (or
category or extension thereof) that has type parameters, substitute
the type arguments for those type parameters. Similarly, substitute
into property accesses, instance variables, and other references.

This includes general infrastructure for substituting the type
arguments associated with an ObjCObject(Pointer)Type into a type
referenced within a particular context, handling all of the
substitutions required to deal with (e.g.) inheritance involving
parameterized classes. In cases where no type arguments are available
(e.g., because we're messaging via some unspecialized type, id, etc.),
we substitute in the type bounds for the type parameters instead.

Example:

  @interface NSSet<T : id<NSCopying>> : NSObject <NSCopying>
  - (T)firstObject;
  @end

  void f(NSSet<NSString *> *stringSet, NSSet *anySet) {
    [stringSet firstObject]; // produces NSString*
    [anySet firstObject]; // produces id<NSCopying> (the bound)
  }

When substituting for the type parameters given an unspecialized
context (i.e., no specific type arguments were given), substituting
the type bounds unconditionally produces type signatures that are too
strong compared to the pre-generics signatures. Instead, use the
following rule:

  - In covariant positions, such as method return types, replace type
    parameters with “id” or “Class” (the latter only when the type
    parameter bound is “Class” or qualified class, e.g,
    “Class<NSCopying>”)
  - In other positions (e.g., parameter types), replace type
    parameters with their type bounds.
  - When a specialized Objective-C object or object pointer type
    contains a type parameter in its type arguments (e.g.,
    NSArray<T>*, but not NSArray<NSString *> *), replace the entire
    object/object pointer type with its unspecialized version (e.g.,
    NSArray *).

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

9 years agoHandle Objective-C type arguments.
Douglas Gregor [Tue, 7 Jul 2015 03:57:35 +0000 (03:57 +0000)]
Handle Objective-C type arguments.

Objective-C type arguments can be provided in angle brackets following
an Objective-C interface type. Syntactically, this is the same
position as one would provide protocol qualifiers (e.g.,
id<NSCopying>), so parse both together and let Sema sort out the
ambiguous cases. This applies both when parsing types and when parsing
the superclass of an Objective-C class, which can now be a specialized
type (e.g., NSMutableArray<T> inherits from NSArray<T>).

Check Objective-C type arguments against the type parameters of the
corresponding class. Verify the length of the type argument list and
that each type argument satisfies the corresponding bound.

Specializations of parameterized Objective-C classes are represented
in the type system as distinct types. Both specialized types (e.g.,
NSArray<NSString *> *) and unspecialized types (NSArray *) are
represented, separately.

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

9 years agoParsing, semantic analysis, and AST for Objective-C type parameters.
Douglas Gregor [Tue, 7 Jul 2015 03:57:15 +0000 (03:57 +0000)]
Parsing, semantic analysis, and AST for Objective-C type parameters.

Produce type parameter declarations for Objective-C type parameters,
and attach lists of type parameters to Objective-C classes,
categories, forward declarations, and extensions as
appropriate. Perform semantic analysis of type bounds for type
parameters, both in isolation and across classes/categories/extensions
to ensure consistency.

Also handle (de-)serialization of Objective-C type parameter lists,
along with sundry other things one must do to add a new declaration to
Clang.

Note that Objective-C type parameters are typedef name declarations,
like typedefs and C++11 type aliases, in support of type erasure.

Part of rdar://problem/6294649.

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

9 years agoDebug info: Emit distinct __block_literal_generic types for blocks with
Adrian Prantl [Tue, 7 Jul 2015 00:49:35 +0000 (00:49 +0000)]
Debug info: Emit distinct __block_literal_generic types for blocks with
different function signatures. (Previously clang would emit all block
pointer types with the type of the first block pointer in the compile
unit.)

rdar://problem/21602473

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

9 years agoRevert "Revert 241171, 241187, 241199 (32-bit SEH)."
Reid Kleckner [Tue, 7 Jul 2015 00:36:30 +0000 (00:36 +0000)]
Revert "Revert 241171, 241187, 241199 (32-bit SEH)."

This reverts commit r241244, but restricts SEH support to Win64.

This way, Chromium builds will still fall back on TUs with SEH, and
Clang developers can work on this incrementally upstream while patching
this small predicate locally. It'll also make it easier to review small
fixes.

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

9 years agoRemember to mark the target attribute as documented and clean up the
Eric Christopher [Tue, 7 Jul 2015 00:01:55 +0000 (00:01 +0000)]
Remember to mark the target attribute as documented and clean up the
Subjects line to avoid redundancy.

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

9 years ago[Driver] Use llvm::Triple methods to handle -EL and -EB.
Benjamin Kramer [Mon, 6 Jul 2015 23:59:45 +0000 (23:59 +0000)]
[Driver] Use llvm::Triple methods to handle -EL and -EB.

Add a test for ppc64(le), which wasn't handled before.

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

9 years agoUpdate target attribute support for post-commit feedback.
Eric Christopher [Mon, 6 Jul 2015 23:52:01 +0000 (23:52 +0000)]
Update target attribute support for post-commit feedback.

Use const auto rather than duplicating the type name and fix the
error message when the attribute is applied to an incorrect entity.

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

9 years agoHandle arbitrary whitespace in the target attribute support.
Eric Christopher [Mon, 6 Jul 2015 23:51:59 +0000 (23:51 +0000)]
Handle arbitrary whitespace in the target attribute support.

This allows us to deal a bit more gracefully with inclusions done
by macros, token pasting, or just code layout/formatting.

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

9 years agoAdd some basic documentation for the __attribute__((target(""))) support.
Eric Christopher [Mon, 6 Jul 2015 23:51:56 +0000 (23:51 +0000)]
Add some basic documentation for the __attribute__((target(""))) support.

Describes the general syntax of how it's used with the unfortunate
usage of "subtarget features" and some examples from the x86 port
to help users.

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