Commit Graph

58958 Commits

Author SHA1 Message Date
Douglas Gregor e9d95f1ecc 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.

llvm-svn: 241542
2015-07-07 03:57:35 +00:00
Douglas Gregor 85f3f9513d 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.

llvm-svn: 241541
2015-07-07 03:57:15 +00:00
Adrian Prantl 3d2c051cf6 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

llvm-svn: 241534
2015-07-07 00:49:35 +00:00
Reid Kleckner 9fe7f2396b 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.

llvm-svn: 241533
2015-07-07 00:36:30 +00:00
Eric Christopher 3fe5739451 Remember to mark the target attribute as documented and clean up the
Subjects line to avoid redundancy.

llvm-svn: 241529
2015-07-07 00:01:55 +00:00
Benjamin Kramer 1a15f2ec57 [Driver] Use llvm::Triple methods to handle -EL and -EB.
Add a test for ppc64(le), which wasn't handled before.

llvm-svn: 241528
2015-07-06 23:59:45 +00:00
Eric Christopher d151addc00 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.

llvm-svn: 241526
2015-07-06 23:52:01 +00:00
Eric Christopher af4d608d13 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.

llvm-svn: 241525
2015-07-06 23:51:59 +00:00
Eric Christopher 93d6adfb46 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.

llvm-svn: 241524
2015-07-06 23:51:56 +00:00
Richard Smith e869b753e4 Refactor to avoid long if-condition.
llvm-svn: 241518
2015-07-06 22:56:29 +00:00
Adrian Prantl 498fff661d Debug info: Don't emit a bogus location for the global block pointer type
(__block_literal_generic).

The arbitrary nature of the location confuses lldb and prevents type
uniquing.

rdar://problem/21602473

llvm-svn: 241511
2015-07-06 21:31:35 +00:00
Yaron Keren adce68ee88 Support -pthread in mingw toolchain.
"-pthread" appends -lpthread after the object files list passed to the linker.

llvm-svn: 241485
2015-07-06 18:52:19 +00:00
Davide Italiano bf0f7757e2 [Sema] Warn when shifting a negative value.
Example:
 % ./clang -Wshift-negative-value emit.c
emit.c:3:14: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
  int a = -1 << 3;
          ~~ ^
1 warning generated.

PR:		24026
Differential Revision:	 http://reviews.llvm.org/D10938
Reviewed by:	rsmith

llvm-svn: 241478
2015-07-06 18:02:09 +00:00
Adrian Prantl ef8f95417a Update testcase to reflect new behavior in DIBuilder.
llvm-svn: 241471
2015-07-06 16:36:04 +00:00
Teresa Johnson 8749d80431 Resubmit "Pass down the -flto option to the -cc1 job" (r239481)
The patch is the same except for the addition of a new test for the
issue that required reverting the dependent llvm commit.

--Original Commit Message--

Pass down the -flto option to the -cc1 job, and from there into the
CodeGenOptions and onto the PassManagerBuilder. This enables gating
the new EliminateAvailableExternally module pass on whether we are
preparing for LTO.

If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not
included as we want to preserve available externally functions for possible
link time inlining.

llvm-svn: 241467
2015-07-06 16:23:00 +00:00
Douglas Katzman 0dd8eb324d Grammar bug. NFC
llvm-svn: 241451
2015-07-06 15:25:31 +00:00
Daniel Jasper 5c235c0966 clang-format: [JS] Properly reset parse state after parsing interface.
llvm-svn: 241446
2015-07-06 14:26:04 +00:00
Daniel Jasper b2328b1e7f clang-format: [JS] Prevent confusing TypeScript parameters wraps.
Before:
  aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa:
                     aaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {}

After:
  aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa,
                     aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa):
      aaaaaaaaaaaaaaaaaaaaaa {}

llvm-svn: 241444
2015-07-06 14:07:51 +00:00
Daniel Jasper a5fa4d1d7e clang-format: Fix __attribute__ being treated as decl name.
__attribute__ was treated as the name of a function definition, with the
tokens in parentheses being the parameter list. This formats incorrectly
with AlwaysBreakAfterDefinitionReturnType. Fix it by treating
__attribute__ like decltype.

Patch by Strager Neds, thank you.

llvm-svn: 241439
2015-07-06 11:30:34 +00:00
Yaron Keren 5b816061ba Replace some const std::string & with llvm::StringRef or std::string
and std::move to avoid implicit std::string construction.

Patch by Eugene Kosov.

llvm-svn: 241433
2015-07-06 08:47:15 +00:00
Yaron Keren 763a38a80c Teach mingw toolchain the msys2 mingw-w64 distribution C++ dirs.
llvm-svn: 241432
2015-07-06 07:40:10 +00:00
Craig Topper 839a25a8a7 [TableGen] Change a couple methods to return an ArrayRef instead of a const std::vector reference. NFC
llvm-svn: 241431
2015-07-06 06:23:06 +00:00
Alexey Bataev 7d5d33ea33 [OPENMP 4.0] Codegen for 'omp cancel' directive.
Add the next codegen for 'omp cancel' directive:
if (__kmpc_cancel()) {
  __kmpc_cancel_barrier();
  <exit construct>;
}

llvm-svn: 241429
2015-07-06 05:50:32 +00:00
Richard Smith fc805cad14 PR24030, PR24033: Consistently check whether a new declaration conflicts with
an existing using shadow declaration if they define entities of the same kind
in different namespaces.

We'd previously check this consistently if the using-declaration came after the
other declaration, but not if it came before.

llvm-svn: 241428
2015-07-06 04:43:58 +00:00
Richard Smith 88fe69ce21 DR1909: Diagnose all invalid cases of a class member sharing its name with the class.
llvm-svn: 241425
2015-07-06 01:45:27 +00:00
Richard Smith a60a6db73f When we see something that looks like a constructor with a return type, only issue one error, not two.
llvm-svn: 241424
2015-07-06 01:04:39 +00:00
NAKAMURA Takumi 258c068008 Mark clang/test/Modules/signal.m as REQUIRES:crash-recovery.
llvm-svn: 241421
2015-07-05 23:00:44 +00:00
Yaron Keren e41dee1da4 Document problems when trying libclang tests on Windows 7.
llvm-svn: 241407
2015-07-05 17:53:00 +00:00
Nemanja Ivanovic e00fa61412 Add the missing return statements from revision 241399.
llvm-svn: 241405
2015-07-05 10:54:10 +00:00
NAKAMURA Takumi 5f6278968c [CMake] clang-*.*: Prevent versioning if the buildhost is targeting for Win32.
CMake-2.8.12 is hardcoded to create symlinked clang.exe if the target property VERSION is present and the host is not Win32.
Then clang.exe-*.* is generated and clang.exe is symlinked to it.

  lrwxrwxrwx. 1 bb bb      13 Jul  5 18:04 clang.exe -> clang.exe-3.7
  -rwxr-x---. 1 bb bb  244763 Jul  5 18:04 clang++.exe
  -rwxr-x---. 1 bb bb  244763 Jul  5 18:04 clang.exe-3.7

It made me unhappy when built binaries were copied to the Windows target.

FIXME: Could we just remove the target property VERSION in add_llvm_executable() ?
llvm-svn: 241403
2015-07-05 10:16:24 +00:00
NAKAMURA Takumi 86042f1d2e clang/test/CodeGen/builtins-ppc-vsx.c: Fix for -Asserts.
llvm-svn: 241401
2015-07-05 08:37:54 +00:00
Nemanja Ivanovic 1c7ad715ec Add missing builtins to altivec.h for ABI compliance (vol. 2)
This patch corresponds to review:
http://reviews.llvm.org/D10875

The bulk of the second round of additions to altivec.h.
The following interfaces were added:
vector double vec_floor(vector double)
vector double vec_madd(vector double, vector double, vector double)
vector float vec_msub(vector float, vector float, vector float)
vector double vec_msub(vector double, vector double, vector double)
vector float vec_mul(vector float, vector float)
vector double vec_mul(vector double, vector double)
vector float vec_nmadd(vector float, vector float, vector float)
vector double vec_nmadd(vector double, vector double, vector double)
vector double vec_nmsub(vector double, vector double, vector double)
vector double vec_nor(vector double, vector double)
vector double vec_or(vector double, vector double)
vector float vec_rint(vector float)
vector double vec_rint(vector double)
vector float vec_nearbyint(vector float)
vector double vec_nearbyint(vector double)
vector float vec_sqrt(vector float)
vector double vec_sqrt(vector double)
vector double vec_rsqrte(vector double)
vector double vec_sel(vector double, vector double, vector unsigned long long)
vector double vec_sel(vector double, vector double, vector unsigned long long)
vector double vec_sub(vector double, vector double)
vector double vec_trunc(vector double)
vector double vec_xor(vector double, vector double)
vector double vec_xor(vector double, vector bool long long)
vector double vec_xor(vector bool long long, vector double)

New VSX paths for the following interfaces:
vector float vec_madd(vector float, vector float, vector float)
vector float vec_nmsub(vector float, vector float, vector float)
vector float vec_rsqrte(vector float)
vector float vec_trunc(vector float)
vector float vec_floor(vector float)

llvm-svn: 241399
2015-07-05 06:40:52 +00:00
Birunthan Mohanathas b001a0ba5e clang-format: Add MacroBlock{Begin,End} options
The MacroBlockBegin and MacroBlockEnd options make matching macro identifiers
behave like '{' and '}', respectively, in terms of indentation.

Mozilla code, for example, uses several macros that begin and end a scope.
Previously, Clang-Format removed the indentation resulting in:

    MACRO_BEGIN(...)
    MACRO_ENTRY(...)
    MACRO_ENTRY(...)
    MACRO_END

Now, using the options

    MacroBlockBegin: "^[A-Z_]+_BEGIN$"
    MacroBlockEnd: "^[A-Z_]+_END$"

will yield the expected result:

    MACRO_BEGIN(...)
      MACRO_ENTRY(...)
      MACRO_ENTRY(...)
    MACRO_END

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

llvm-svn: 241363
2015-07-03 17:25:16 +00:00
Renato Golin 15b86155c9 Revert "Refactored ARMTargetInfo in order to use the API of llvm/lib/Support/TargetParser.cpp
This reverts commit r241343, as it was, again, breaking all ARM buildbots.

llvm-svn: 241362
2015-07-03 16:41:13 +00:00
Benjamin Kramer bfc8413fdb StmtIterator: Put stmt and decl group pointer into a union.
Reduce the size of StmtIterator without changing behavior.

llvm-svn: 241356
2015-07-03 15:12:36 +00:00
Benjamin Kramer 973431b22f Rewrite users of Stmt::child_begin/end into for-range loops.
No functionality change intended.

llvm-svn: 241355
2015-07-03 15:12:24 +00:00
Alexandros Lamprineas eb73228888 - Refactored ARMTargetInfo in order to use the API of llvm/lib/Support/TargetParser.cpp
for extracting target specific information.
- Patch for commit 241267: ShouldUseInlineAtomic was set incorrectly when subArch was
  not specified, causing regressions.

Change-Id: Iabb35d59722f4972f1a3ab4365880add5bbcfdcc
llvm-svn: 241343
2015-07-03 11:57:23 +00:00
Daniel Jasper 5a3de1d0e1 clang-format: [JS] Allow line breaks after TypeScript type colons.
llvm-svn: 241339
2015-07-03 10:37:23 +00:00
Daniel Jasper 043ac05010 clang-format: [Java/JS] Properly support instanceof and its precedence.
llvm-svn: 241337
2015-07-03 10:12:53 +00:00
Alexey Bataev 81c7ea0ec3 [OPENMP 4.0] Fixed codegen for 'cancellation point' construct.
Generate the next code for 'cancellation point':
if (__kmpc_cancellationpoint()) {
  __kmpc_cancel_barrier();
  <exit construct>;
}

llvm-svn: 241336
2015-07-03 09:56:58 +00:00
Yaron Keren 40178c352e Revert r241330. It compiled with Visual C++ 2013 and gcc 4.9.1 (mingw) but now fails the bots.
llvm-svn: 241335
2015-07-03 09:30:33 +00:00
Yaron Keren 452670165c Replace some const std::string & with llvm::StringRef or std::string
and std::move to avoid implicit std::string construction.

Patch by Eugene Kosov.

llvm-svn: 241330
2015-07-03 09:16:20 +00:00
NAKAMURA Takumi 24536c8b47 clang/test/CodeGenCXX/trap-fnattr.cpp: Tweak to match MS-mangled names.
llvm-svn: 241328
2015-07-03 08:21:27 +00:00
Justin Bogner 2d74ae53f2 Driver: Replace a couple of out of date terms in the docs
The Job base class was removed in r241310, so replace a couple of
references to it with Command. Also change another use of Job with
Action, since that's the term used in the source.

llvm-svn: 241327
2015-07-03 08:03:43 +00:00
Yaron Keren d30f5ffddc Revert r241319, investigating.
llvm-svn: 241321
2015-07-03 05:31:54 +00:00
Yaron Keren 25bb2e4709 Replace some const std::string & with llvm::StringRef or std::string
and std::move to avoid implicit std::string construction.

Part 1/2.

Patch by Eugene Kosov.

llvm-svn: 241319
2015-07-03 05:09:59 +00:00
Akira Hatanaka 6f9cfaf85b Make corrections to r241314.
The return type of a function follows the signext attribute.

llvm-svn: 241315
2015-07-03 01:05:19 +00:00
Akira Hatanaka 5720be5e34 Fix test case to appease buildbot.
Test case trap-fnattr.cpp was failng on clang-ppc64-elf-linux2 because ppc64
sign-extends the i32 return value.
 
This is a follow-up to r241306.

llvm-svn: 241314
2015-07-03 00:50:30 +00:00
Justin Bogner 0cd9248d9e Driver: Remove the Job class. NFC
We had a strange relationship here where we made a list of Jobs
inherit from a single Job, but there weren't actually any places where
this arbitrary nesting was used or needed.

Simplify all of this by removing Job entirely and updating all of the
users to either work with a JobList or a single Command.

llvm-svn: 241310
2015-07-02 22:52:08 +00:00
Justin Bogner 94817612e2 Driver: Don't use reserved names. NFC
llvm-svn: 241309
2015-07-02 22:52:04 +00:00