]> granicus.if.org Git - clang/log
clang
9 years agoclang-format: [Proto] Don't linewrap top-level options.
Daniel Jasper [Thu, 23 Apr 2015 09:54:10 +0000 (09:54 +0000)]
clang-format: [Proto] Don't linewrap top-level options.

They are very similar to import statements.

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

9 years agoclang-format: Support nested block formatting with ColumnLimit=0.
Daniel Jasper [Thu, 23 Apr 2015 09:23:17 +0000 (09:23 +0000)]
clang-format: Support nested block formatting with ColumnLimit=0.

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

9 years ago[OPENMP] Fix for failed tests for 'omp atomic write' construct.
Alexey Bataev [Thu, 23 Apr 2015 07:56:25 +0000 (07:56 +0000)]
[OPENMP] Fix for failed tests for 'omp atomic write' construct.

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

9 years ago[MS ABI] Add support for mangling VLA types
David Majnemer [Thu, 23 Apr 2015 07:42:08 +0000 (07:42 +0000)]
[MS ABI] Add support for mangling VLA types

Treat a VLA type like an incomplete array type.

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

9 years ago[OPENMP] Codegen for 'atomic capture'.
Alexey Bataev [Thu, 23 Apr 2015 06:35:10 +0000 (06:35 +0000)]
[OPENMP] Codegen for 'atomic capture'.

Adds codegen for 'atomic capture' constructs with the following forms of expressions/statements:

v = x binop= expr;
v = x++;
v = ++x;
v = x--;
v = --x;
v = x = x binop expr;
v = x = expr binop x;
{v = x; x = binop= expr;}
{v = x; x++;}
{v = x; ++x;}
{v = x; x--;}
{v = x; --x;}
{x = x binop expr; v = x;}
{x binop= expr; v = x;}
{x++; v = x;}
{++x; v = x;}
{x--; v = x;}
{--x; v = x;}
{x = x binop expr; v = x;}
{x = expr binop x; v = x;}
{v = x; x = expr;}
If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted.
Otherwise compare-and-swap sequence is emitted.
Update of 'v' is not required to be be atomic with respect to the read or write of the 'x'.

bb:
...
atomic load <x>
cont:
<expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ]
<desired> = <expected> binop <expr>
<res> = cmpxchg atomic &<x>, desired, expected
<new_failed> = <res>.field1;
br <res>field2, label %exit, label %cont
exit:
atomic store <old/new x>, <v>
...
Differential Revision: http://reviews.llvm.org/D9049

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

9 years ago[MS ABI] Treat ConstantArrayType like IncompleteArrayType in args
David Majnemer [Thu, 23 Apr 2015 05:21:20 +0000 (05:21 +0000)]
[MS ABI] Treat ConstantArrayType like IncompleteArrayType in args

Type backreferences for arguments use the DecayedType's original type.
Because of this, arguments with the same canonical type with the same
mangling would not backreference each other if one was a
ConstantArrayType while the other was an IncompleteArrayType.  Solve
this by canonicalizing the ConstantArrayType to a suitable
IncompleteArrayType.

This fixes PR23325.

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

9 years ago[modules] Actually allocate the extra space we use for the tail-allocated array
Richard Smith [Thu, 23 Apr 2015 04:13:52 +0000 (04:13 +0000)]
[modules] Actually allocate the extra space we use for the tail-allocated array
in this class.

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

9 years agoUnify the way we report overflow in increment/decrement operator.
Alexey Samsonov [Thu, 23 Apr 2015 01:50:45 +0000 (01:50 +0000)]
Unify the way we report overflow in increment/decrement operator.

Summary:
Make sure signed overflow in "x--" is checked with
llvm.ssub.with.overflow intrinsic and is reported as:
  "-2147483648 - 1 cannot be represented in type 'int'"
instead of:
  "-2147483648 + -1 cannot be represented in type 'int'"
, like we do for unsigned overflow.

Test Plan: clang + compiler-rt regression test suite

Reviewers: rsmith

Subscribers: cfe-commits

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

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

9 years agoInstrProf: Fix a shadowing error that would break length of profile names
Justin Bogner [Thu, 23 Apr 2015 00:31:16 +0000 (00:31 +0000)]
InstrProf: Fix a shadowing error that would break length of profile names

We try to use the member variable "FuncName" here, but we've also used
that name as a parameter. This ends with us getting the length of the
function name wrong when we generate the coverage data.

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

9 years ago[WinEH] Don't emit an exceptional cleanup for llvm.eh.endcatch
Reid Kleckner [Wed, 22 Apr 2015 23:39:15 +0000 (23:39 +0000)]
[WinEH] Don't emit an exceptional cleanup for llvm.eh.endcatch

These extra endcatch markers aren't helping identify regions to outline,
so let's get rid of them.  LLVM outlines (more or less) from begincatch
to endcatch.  Any unwind edge from an enclosed invoke is a transition to
a new exception handler, which has it's own outlining markers.

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

9 years agoFix another test broken by r235537
Reid Kleckner [Wed, 22 Apr 2015 21:39:55 +0000 (21:39 +0000)]
Fix another test broken by r235537

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

9 years agoRevert "Revert r234581, it might have caused a few miscompiles in Chromium."
David Majnemer [Wed, 22 Apr 2015 21:38:15 +0000 (21:38 +0000)]
Revert "Revert r234581, it might have caused a few miscompiles in Chromium."

This reverts commit r234700.  It turns out that the lifetime markers
were not the cause of Chromium failing but a bug which was uncovered by
optimizations exposed by the markers.

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

9 years agoFix test failure caused by r235537. It does not run on Windows due to REQUIRES: shell
Reid Kleckner [Wed, 22 Apr 2015 21:14:25 +0000 (21:14 +0000)]
Fix test failure caused by r235537. It does not run on Windows due to REQUIRES: shell

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

9 years agoSet normal LLVM function attributes on global initializer functions
Reid Kleckner [Wed, 22 Apr 2015 19:37:32 +0000 (19:37 +0000)]
Set normal LLVM function attributes on global initializer functions

Otherwise -fno-omit-frame-pointer and other flags like it aren't
applied.

Basic idea taken from Gao's patch, thanks!

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

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

9 years agoSilencing a -Wunused-variable warning; NFC.
Aaron Ballman [Wed, 22 Apr 2015 15:25:05 +0000 (15:25 +0000)]
Silencing a -Wunused-variable warning; NFC.

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

9 years ago[OPENMP] Codegen for 'if' clause in 'task' directive.
Alexey Bataev [Wed, 22 Apr 2015 13:57:31 +0000 (13:57 +0000)]
[OPENMP] Codegen for 'if' clause in 'task' directive.

If condition evaluates to true, the code executes task by calling @__kmpc_omp_task() runtime function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:

call void @__kmpc_omp_task_begin_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
proxy_task_entry(<gtid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
call void @__kmpc_omp_task_complete_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
Also it checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D9143

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

9 years ago[OPENMP] Codegen for 'reduction' clause in 'for' directive.
Alexey Bataev [Wed, 22 Apr 2015 13:43:03 +0000 (13:43 +0000)]
[OPENMP] Codegen for 'reduction' clause in 'for' directive.

Emit a code for reduction clause. Next code should be emitted for reductions:

static kmp_critical_name lock = { 0 };

void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
    *(Type0*)lhs[0] = ReductionOperation0(*(Type0*)lhs[0], *(Type0*)rhs[0]);
      ...
        *(Type<n>-1*)lhs[<n>-1] =
          ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1],
            *(Type<n>-1*)rhs[<n>-1]);
}

 ...
  void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]};
   switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
      case 1:
        <LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]);
          ...
            <LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]);
             __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
              break;
               case 2:
                 Atomic(<LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]));
                   ...
                     Atomic(<LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]));
                      break;
                       default:;
                        }
                        Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D9139

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

9 years ago[OPENMP] Codegen for 'private' clause in 'for' directive.
Alexey Bataev [Wed, 22 Apr 2015 12:24:45 +0000 (12:24 +0000)]
[OPENMP] Codegen for 'private' clause in 'for' directive.

This patch generates helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'for' directive. These generated variables are initialized by default (with the default constructor, if any). In OpenMP region references to original variables are replaced by the references to these private helper variables.
Differential Revision: http://reviews.llvm.org/D9106

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

9 years ago[OPENMP] Fixed test incompatibility for simd codegen.
Alexey Bataev [Wed, 22 Apr 2015 12:20:41 +0000 (12:20 +0000)]
[OPENMP] Fixed test incompatibility for simd codegen.

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

9 years ago[OPENMP] Fix use of unsigned counters in loops with zero trip count.
Alexey Bataev [Wed, 22 Apr 2015 11:59:37 +0000 (11:59 +0000)]
[OPENMP] Fix use of unsigned counters in loops with zero trip count.

Patch fixes bugs in codegen for loops with unsigned counters and zero trip count. Previously preconditions for all loops were built using logic (Upper - Lower) > 0. But if the loop is a loop with zero trip count, then Upper - Lower is < 0 only for signed integer, for unsigned we're running into an underflow situation.
In this patch we're using original Lower<Upper condition to check that loop body can be executed at least once. Also this allows to skip code generation for loops, if it is known that preconditions for the loop are always false.
Differential Revision: http://reviews.llvm.org/D9103

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

9 years ago[OPENMP] Codegen for 'ordered' directive.
Alexey Bataev [Wed, 22 Apr 2015 11:15:40 +0000 (11:15 +0000)]
[OPENMP] Codegen for 'ordered' directive.

Add codegen for 'ordered' directive:

__kmpc_ordered(ident_t *, gtid);
<associated statement>;
__kmpc_end_ordered(ident_t *, gtid);
Also for 'for' directives with the dynamic scheduling and an 'ordered' clause added a call to '__kmpc_dispatch_fini_(4|8)[u]()' function after increment expression for loop control variable:

while(__kmpc_dispatch_next(&LB, &UB)) {
  idx = LB;
  while (idx <= UB) { BODY; ++idx;
    __kmpc_dispatch_fini_(4|8)[u](); // For ordered loops only.
  } // inner loop
}
Differential Revision: http://reviews.llvm.org/D9070

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

9 years agoclang-format: Fix for #pragma option formatting.
Daniel Jasper [Wed, 22 Apr 2015 09:45:42 +0000 (09:45 +0000)]
clang-format: Fix for #pragma option formatting.

Adapted patch from Sergey Razmetov. Thank you.

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

9 years agoDon't dllimport/export class members with internal linkage (PR23308)
Hans Wennborg [Wed, 22 Apr 2015 04:05:17 +0000 (04:05 +0000)]
Don't dllimport/export class members with internal linkage (PR23308)

For example, a function taking a parameter with internal linkage will
itself have internal linkage since it cannot be called outside the
translation unit.

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

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

9 years agoWrap to 80 columns, fix typo in comment. No behavior change.
Nico Weber [Wed, 22 Apr 2015 03:44:51 +0000 (03:44 +0000)]
Wrap to 80 columns, fix typo in comment. No behavior change.

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

9 years ago[modules] Cope with partial module macro information, fix memory leak found by buildbot.
Richard Smith [Wed, 22 Apr 2015 02:09:43 +0000 (02:09 +0000)]
[modules] Cope with partial module macro information, fix memory leak found by buildbot.

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

9 years ago[modules] Build a DAG of module macros for each identifier.
Richard Smith [Wed, 22 Apr 2015 00:26:11 +0000 (00:26 +0000)]
[modules] Build a DAG of module macros for each identifier.

This graph will be used to determine the current set of active macros. This is
foundation work for getting macro visibility correct across submodules of the
current module. No functionality change for now.

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

9 years agoExpose -fdiagnostics-parseable-fixits to clang-cl
Hans Wennborg [Tue, 21 Apr 2015 23:12:03 +0000 (23:12 +0000)]
Expose -fdiagnostics-parseable-fixits to clang-cl

Patch by Daniel Cheng!

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

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

9 years ago[cuda] Allow using integral non-type template parameters as launch_bounds attribute...
Artem Belevich [Tue, 21 Apr 2015 22:55:54 +0000 (22:55 +0000)]
[cuda] Allow using integral non-type template parameters as launch_bounds attribute arguments.

 - Changed CUDALaunchBounds arguments from integers to Expr* so they can
   be saved in AST for instantiation.
 - Added support for template instantiation of launch_bounds attrubute.
 - Moved evaluation of launch_bounds arguments to NVPTXTargetCodeGenInfo::
   SetTargetAttributes() where it can be done after template instantiation.
 - Added a warning on negative launch_bounds arguments.
 - Amended test cases.

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

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

9 years ago[cuda] Added support for CUDA built-in variables.
Artem Belevich [Tue, 21 Apr 2015 22:14:13 +0000 (22:14 +0000)]
[cuda] Added support for CUDA built-in variables.

Added cuda_builtin_vars.h which implements built-in CUDA variables
using __declattr(property).

Fields of built-in variables (except for warpSize) are implemented
using __declattr(property) which replaces read/write of a member field
with a call to a getter/setter member function, in this case with
appropriate NVPTX builtin.

Added a test case to check diagnostics on attempt to construct or
improperly access a built-in variable.

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

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

9 years ago[modules] Move list of exported module macros from IdentifierInfo lookup table to...
Richard Smith [Tue, 21 Apr 2015 21:46:32 +0000 (21:46 +0000)]
[modules] Move list of exported module macros from IdentifierInfo lookup table to separate storage, adjacent to the macro directive history.

This is substantially simpler, provides better space usage accounting in bcanalyzer,
and gives a more compact representation. No functionality change intended.

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

9 years agoDebugInfo: Prepare for removal of DIArray and DITypeArray typedefs
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 20:07:29 +0000 (20:07 +0000)]
DebugInfo: Prepare for removal of DIArray and DITypeArray typedefs

An upcoming LLVM commit will remove the `DIArray` and `DITypeArray`
typedefs that shadow `DebugNodeArray` and `MDTypeRefArray`,
respectively.  Use those types directly.

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

9 years agoDebugInfo: Prepare for deletion of DIDescriptor subclasses
Duncan P. N. Exon Smith [Tue, 21 Apr 2015 18:43:54 +0000 (18:43 +0000)]
DebugInfo: Prepare for deletion of DIDescriptor subclasses

An upcoming LLVM commit will delete all the remaining subclasses of (the
already deleted) `DIDescriptor`.  Stop using them.

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

9 years agoRecommend to use CMake on the Clang Getting Started page.
Alexey Samsonov [Tue, 21 Apr 2015 18:38:31 +0000 (18:38 +0000)]
Recommend to use CMake on the Clang Getting Started page.

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

9 years agoRevert r235398 "[cuda] Added support for CUDA built-in variables."
Artem Belevich [Tue, 21 Apr 2015 18:36:42 +0000 (18:36 +0000)]
Revert r235398 "[cuda] Added support for CUDA built-in variables."

r235398 was causing buildbot break due to missing Makefile changes.

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

9 years ago[cuda] Added support for CUDA built-in variables.
Artem Belevich [Tue, 21 Apr 2015 17:39:06 +0000 (17:39 +0000)]
[cuda] Added support for CUDA built-in variables.

Added cuda_builtin_vars.h which implements built-in CUDA variables
using __declattr(property).

Fields of built-in variables (except for warpSize) are implemented
using __declattr(property) which replaces read/write of a member field
with a call to a getter/setter member function, in this case with
appropriate NVPTX builtin.

Added a test case to check diagnostics on attempt to construct or
improperly access a built-in variable.

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

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

9 years agoImplement target-specific __attribute__((aligned)) value
Ulrich Weigand [Tue, 21 Apr 2015 17:29:35 +0000 (17:29 +0000)]
Implement target-specific __attribute__((aligned)) value

The GCC construct __attribute__((aligned)) is defined to set alignment
to "the default alignment for the target architecture" according to
the GCC documentation:

  The default alignment is sufficient for all scalar types, but may not be
  enough for all vector types on a target that supports vector operations.
  The default alignment is fixed for a particular target ABI.

clang currently hard-coded an alignment of 16 bytes for that construct,
which is correct on some platforms (including X86), but wrong on others
(including SystemZ).  Since this value is ABI-relevant, it is important
to get correct for compatibility purposes.

This patch adds a new TargetInfo member "DefaultAlignForAttributeAligned"
that targets can set to the appropriate default __attribute__((aligned))
value.

Note that I'm deliberately *not* using the existing "SuitableAlign"
value, which is used to set the pre-defined macro __BIGGEST_ALIGNMENT__,
since those two values may not be the same on all platforms.  In fact,
on X86, __attribute__((aligned)) always uses 16-byte alignment, while
__BIGGEST_ALIGNMENT__ may be larger if AVX-2 or AVX-512 are supported.
(This is actually not yet correctly implemented in clang either.)

The patch provides a value for DefaultAlignForAttributeAligned only for
SystemZ, and leaves the default for all other targets at 16, which means
no visible change in behavior on all other targets.  (The value is still
wrong for some other targets, but I'd prefer to leave it to the target
maintainers for those platforms to fix.)

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

9 years agoProvide alignment info on LLVM external symbols
Ulrich Weigand [Tue, 21 Apr 2015 17:27:59 +0000 (17:27 +0000)]
Provide alignment info on LLVM external symbols

Code in CodeGenModule::GetOrCreateLLVMGlobal that sets up GlobalValue
object for LLVM external symbols has this comment:

    // FIXME: This code is overly simple and should be merged with other global
    // handling.

One part does seems to be "overly simple" currently is that this code
never sets any alignment info on the GlobalValue, so that the emitted
IR does not have any align attribute on external globals.  This can
lead to unnecessarily inefficient code generation.

This patch adds a GV->setAlignment call to set alignment info.

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

9 years agoFix __alignof__ of global variables on SystemZ
Ulrich Weigand [Tue, 21 Apr 2015 17:26:18 +0000 (17:26 +0000)]
Fix __alignof__ of global variables on SystemZ

SystemZ prefers to align all global variables to two bytes, which is
implemented by setting the TargetInfo member MinGlobalAlign.

However, for compatibility with existing compilers this should *not*
change the ABI alignment value as retrieved via __alignof__, which
it currently does.

This patch fixes the issue by having ASTContext::getDeclAlign ignore
the MinGlobalAlign setting in the ForAlignof case.

Since SystemZ is the only platform setting MinGlobalAlign, this should
cause no change for any other target.

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

9 years agoDebugInfo: Prepare for deletion of subclasses of DIScope
Duncan P. N. Exon Smith [Mon, 20 Apr 2015 22:09:57 +0000 (22:09 +0000)]
DebugInfo: Prepare for deletion of subclasses of DIScope

Prepare for the deletion in LLVM of the subclasses of (the already
deleted) `DIScope` by using the raw pointers they were wrapping
directly.

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

9 years agoDebugInfo: Prepare for deletion of subclasses of DIType
Duncan P. N. Exon Smith [Mon, 20 Apr 2015 21:17:26 +0000 (21:17 +0000)]
DebugInfo: Prepare for deletion of subclasses of DIType

Subclasses of (the already deleted) `DIType` will be deleted by an
upcoming LLVM commit.  Remove references.

While `DICompositeType` wraps `MDCompositeTypeBase` and `DIDerivedType`
wraps `MDDerivedTypeBase`, most uses of each really meant the more
specific `MDCompositeType` and `MDDerivedType`.  I updated accordingly.

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

9 years agoAdd conversionDecl matcher for node CXXConversionDecl.
Samuel Benzaquen [Mon, 20 Apr 2015 20:58:50 +0000 (20:58 +0000)]
Add conversionDecl matcher for node CXXConversionDecl.

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

9 years agoPut statement expression decls in the enclosing code DeclContext
Reid Kleckner [Mon, 20 Apr 2015 20:00:49 +0000 (20:00 +0000)]
Put statement expression decls in the enclosing code DeclContext

We already check that statement expressions are in a function or block,
but we didn't do anything with that information. Now we use that
DeclContext for the duration of the statement expression. Otherwise,
we'd treat statement expression locals as static data members and go
into the weeds.

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

9 years agoDebugInfo: Prepare for deletion of DIType
Duncan P. N. Exon Smith [Mon, 20 Apr 2015 18:51:48 +0000 (18:51 +0000)]
DebugInfo: Prepare for deletion of DIType

`DIType` is going to be deleted by an upcoming LLVM commit, so replace
uses with `MDType*`.

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

9 years agoDebugInfo: Prepare for deletion of DIScope
Duncan P. N. Exon Smith [Mon, 20 Apr 2015 18:32:15 +0000 (18:32 +0000)]
DebugInfo: Prepare for deletion of DIScope

An upcoming LLVM commit will delete `DIScope`, so update users to
`MDScope*`.

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

9 years agoclang-format: Fix incorrect multi-var declstmt detection.
Daniel Jasper [Mon, 20 Apr 2015 12:54:29 +0000 (12:54 +0000)]
clang-format: Fix incorrect multi-var declstmt detection.

This is now obvious as the pointer alignment behavior was changed.

Before (even with pointer alignment "Left"):
  MACRO Constructor(const int &i) : a(a), b(b) {}

After:
  MACRO Constructor(const int& i) : a(a), b(b) {}

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

9 years agoFix bug in Replacement's toString on Windows (missing flush).
Manuel Klimek [Mon, 20 Apr 2015 06:58:56 +0000 (06:58 +0000)]
Fix bug in Replacement's toString on Windows (missing flush).

Adapt function to LLVM coding style.

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

9 years ago[Sema] Check availability of ObjC super class and protocols of a container
Argyrios Kyrtzidis [Sun, 19 Apr 2015 20:15:55 +0000 (20:15 +0000)]
[Sema] Check availability of ObjC super class and protocols of a container
in the context of the container itself.

Otherwise we will emit 'unavailable' errors when referencing an unavailable super class
even though the subclass is also marked 'unavailable'.

rdar://20598702

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

9 years ago[MS ABI] Correctly associate align attrs before the class-key
David Majnemer [Sun, 19 Apr 2015 07:53:29 +0000 (07:53 +0000)]
[MS ABI] Correctly associate align attrs before the class-key

__declspec(align(...)) is unlike all other attributes in that it is not
applied to a variable if it appears before the class-key.  If the
tag in question isn't part of a variable declaration, it is not ignored.

Instead, the alignment attribute is applied to the tag.

This fixes PR18024.

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

9 years agoTry to work around failure to convert this lambda to a function pointer in some versi...
Richard Smith [Sun, 19 Apr 2015 01:47:53 +0000 (01:47 +0000)]
Try to work around failure to convert this lambda to a function pointer in some versions of GCC.

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

9 years ago[modules] Refactor macro emission. No functionality change.
Richard Smith [Sun, 19 Apr 2015 01:34:23 +0000 (01:34 +0000)]
[modules] Refactor macro emission. No functionality change.

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

9 years agoMake helper function static. NFC.
Benjamin Kramer [Sat, 18 Apr 2015 10:00:10 +0000 (10:00 +0000)]
Make helper function static. NFC.

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

9 years ago[Sema] Don't crash if array bound calculation overflowed constexpr array
David Majnemer [Sat, 18 Apr 2015 04:55:51 +0000 (04:55 +0000)]
[Sema] Don't crash if array bound calculation overflowed constexpr array

We didn't correctly expect a QualifiedTypeLoc when faced with fixing a
variable array type into a constant array type.

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

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

9 years agoRemove dead code, NFC
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:26:49 +0000 (00:26 +0000)]
Remove dead code, NFC

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

9 years agoDebugInfo: Prepare for deletion of DIDescriptor
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:07:30 +0000 (00:07 +0000)]
DebugInfo: Prepare for deletion of DIDescriptor

Prepare for upcoming LLVM change to delete `DIDescriptor`.

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

9 years agoChange AArch64 i128 returns to use [2 x i64] when possible.
Pete Cooper [Fri, 17 Apr 2015 22:16:24 +0000 (22:16 +0000)]
Change AArch64 i128 returns to use [2 x i64] when possible.

Something like { void*, void * } would be passed to a function as a [2 x i64], but returned as an i128.  This patch unifies the 2 behaviours so that we also return it as a [2 x i64].

This is better for the quality of the IR, and the size of the final LLVM binary as we tend to want to insert/extract values from these types and do so with the insert/extract instructions is less IR than shifting, truncating, and or'ing values.

Reviewed by Tim Northover.

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

9 years agoAdd a missing forward def of CheckerManager. NFC.
Pete Cooper [Fri, 17 Apr 2015 17:00:16 +0000 (17:00 +0000)]
Add a missing forward def of CheckerManager.  NFC.

This file doesn't include CheckerManager or forward declare it, so is sensitive to include order.

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

9 years agoRemove the assertion as it was useless and broken.
Sylvestre Ledru [Fri, 17 Apr 2015 13:21:39 +0000 (13:21 +0000)]
Remove the assertion as it was useless and broken.

Enforcing the assert caused the following tests to fail:
Clang :: Analysis__bstring.c
Clang :: Analysis__comparison-implicit-casts.cpp
Clang :: Analysis__malloc-interprocedural.c
Clang :: Analysis__malloc.c
Clang :: Analysis__redefined_system.c
Clang :: Analysis__string.c
Clang :: Analysis__weak-functions.c

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

9 years agoFix a bad assert. Found by coverity. CID 1101110
Sylvestre Ledru [Fri, 17 Apr 2015 13:08:54 +0000 (13:08 +0000)]
Fix a bad assert. Found by coverity. CID 1101110

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

9 years ago[MSVC] Mimic MSVC whitespace collapse for incompatible token pasting
Will Wilson [Fri, 17 Apr 2015 12:43:57 +0000 (12:43 +0000)]
[MSVC] Mimic MSVC whitespace collapse for incompatible token pasting

In public MS headers for XAudio, clang would fail to generate a valid UUID due to the UUID components being combined with the '-' UUID separators. Clang would attempting to recover but would preserve the leading whitespace from the tokens after each failed paste leading to spaces creeping into the UUID and causing an error in the __declspace(uuid()) parsing.

Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51)

Resolves http://llvm.org/pr23071

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

9 years agoFollow-up to r235046: selectany only causes a definition if it's not inherited.
Nico Weber [Fri, 17 Apr 2015 09:50:28 +0000 (09:50 +0000)]
Follow-up to r235046: selectany only causes a definition if it's not inherited.

(For example needed to parse system header inputscope.h, which first has
an extern "C" selectany IID and then later an extern "C" declaration of that
same IID.)

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

9 years agoMove fixit for const init from note to diag, weaken to warning in MS mode.
Nico Weber [Fri, 17 Apr 2015 08:32:38 +0000 (08:32 +0000)]
Move fixit for const init from note to diag, weaken to warning in MS mode.

r235046 turned "extern __declspec(selectany) int a;" from a declaration into
a definition to fix PR23242 (required for compatibility with mc.exe output).
However, this broke parsing Windows headers: A  d3d11 headers contain something
like

  struct SomeStruct {};
  extern const __declspec(selectany) SomeStruct some_struct;

This is now a definition, and const objects either need an explicit default
ctor or an initializer so this errors out with

  d3d11.h(1065,48) :
    error: default initialization of an object of const type
           'const CD3D11_DEFAULT' without a user-provided default constructor

(cl.exe just doesn't implement this rule, independent of selectany.)

To work around this, weaken this error into a warning for selectany decls
in microsoft mode, and recover with zero-initialization.

Doing this is a bit hairy since it adds a fixit on an error emitted
by InitializationSequence â€“ this means it needs to build a correct AST, which
in turn means InitializationSequence::Failed() cannot return true when this
fixit is applied. As a workaround, the patch adds a fixit member to
InitializationSequence, and InitializationSequence::Perform() prints the
diagnostic if the fixit member is set right after its call to Diagnose.
That function is usually called when InitializationSequences are used â€“
InitListChecker::PerformEmptyInit() doesn't call it, but the InitListChecker
case never performs default-initialization, so this is technically OK.

This is the alternative, original fix for PR20208 that got reviewed in the
thread "[patch] Improve diagnostic on default-initializing const variables
(PR20208)".  This change basically reverts r213725, adds the original fix for
PR20208, and makes the error a warning in Microsoft mode.

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

9 years agoRevert file unintentionally changed in r235162.
Daniel Jasper [Fri, 17 Apr 2015 08:01:41 +0000 (08:01 +0000)]
Revert file unintentionally changed in r235162.

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

9 years agoclang-format: Add default fallback style.
Daniel Jasper [Fri, 17 Apr 2015 07:59:19 +0000 (07:59 +0000)]
clang-format: Add default fallback style.

Thanks to Michael Schlottke.

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

9 years ago[MS ABI] Use the right types for filter and finally blocks
David Majnemer [Fri, 17 Apr 2015 06:57:25 +0000 (06:57 +0000)]
[MS ABI] Use the right types for filter and finally blocks

The type for abnormal_termination can't be an i1, it an i8.
Filter functions return 'LONG', not 'int'.

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

9 years agoImprove const-ness
David Blaikie [Fri, 17 Apr 2015 00:19:34 +0000 (00:19 +0000)]
Improve const-ness

This allows callers to pass a char ** (such as the one coming from the
standard decreed main declaration - even though everyone usually puts
const on that themselves).

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

9 years ago[opaque pointer types] Explicit non-pointer type for call expressions
David Blaikie [Thu, 16 Apr 2015 23:25:00 +0000 (23:25 +0000)]
[opaque pointer types] Explicit non-pointer type for call expressions

(migration for recent LLVM change to textual IR for calls)

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

9 years ago[Objective-C Sema]. In my last patch change the
Fariborz Jahanian [Thu, 16 Apr 2015 21:52:34 +0000 (21:52 +0000)]
[Objective-C Sema]. In my last patch change the
attribute name to objc_independent_class.
rdar://20255473

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

9 years ago[Objective-C Sema] patch to introduce IndependentClass
Fariborz Jahanian [Thu, 16 Apr 2015 18:38:44 +0000 (18:38 +0000)]
[Objective-C Sema] patch to introduce IndependentClass
attribute to be placed on Objective-C pointer typedef
to make them strong enough so on their "new" method
family no attempt is made to override these
types. rdar://20255473

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

9 years agoDebugInfo: Update for LLVM API change in DIBuilder (r235111)
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 16:36:45 +0000 (16:36 +0000)]
DebugInfo: Update for LLVM API change in DIBuilder (r235111)

LLVM r235111 changed the `DIBuilder` API to stop using `DIDescriptor`
and its subclasses.  Rolled into this was some tightening up of types:

  - Scopes: `DIDescriptor` => `MDScope*`.
  - Generic debug nodes: `DIDescriptor` => `DebugNode*`.
  - Subroutine types: `DICompositeType` => `MDSubroutineType*`.
  - Composite types: `DICompositeType` => `MDCompositeType*`.

Note that `DIDescriptor` wraps `MDNode`, and `DICompositeType` wraps
`MDCompositeTypeBase`.

It's this new type strictness that requires changes here.

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

9 years ago[AArch64] Add v8.1a architecture
Vladimir Sukharev [Thu, 16 Apr 2015 15:53:09 +0000 (15:53 +0000)]
[AArch64] Add v8.1a architecture

Add support for AArch64 v8.1 architecture. Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: jmolloy

Subscribers: cfe-commits

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

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

9 years ago[OPENMP] Fix for checking of data-sharing attributes for canonical var decls only.
Alexey Bataev [Thu, 16 Apr 2015 13:49:42 +0000 (13:49 +0000)]
[OPENMP] Fix for checking of data-sharing attributes for canonical var decls only.

Currently checks for active data-sharing attributes for variables are performed for found var decls. Instead these checks must be performed for canonical decls of these variables to avoid possible troubles with with the differently qualified re-declarations of the same variable, for example:
namespace A { int x; }
namespace B { using A::x; }
Both A::x and B::x actually reference the same object A::x and this fact must be taken into account during data-sharing attributes analysis.

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

9 years agoclang-format: add an option for fallback style in vimrc
Daniel Jasper [Thu, 16 Apr 2015 08:26:37 +0000 (08:26 +0000)]
clang-format: add an option for fallback style in vimrc

With this patch, clang-format.py will search and use existing .clang-format
file if there is one and fallback to the specific format style if
not. It should cover the projects which don't have .clang-format
files in their source. As the option fallback-style is available in
clang 3.5 or later, it is safe to use.

Patch by "Chilledheart" (http://reviews.llvm.org/D8489).

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

9 years agoclang-format: [JS] handle comments in template strings.
Daniel Jasper [Thu, 16 Apr 2015 08:20:51 +0000 (08:20 +0000)]
clang-format: [JS] handle comments in template strings.

Patch by Martin Probst. Thank you.

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

9 years agoclang-format: Undo r214508. It was essentially always removing the
Daniel Jasper [Thu, 16 Apr 2015 07:02:19 +0000 (07:02 +0000)]
clang-format: Undo r214508. It was essentially always removing the
space where we already had the flag ObjCSpaceBeforeProtocolList to
control it. I don't know what I was thinking.

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

9 years ago[OPENMP] Codegen for 'copyin' clause in 'parallel' directive.
Alexey Bataev [Thu, 16 Apr 2015 05:39:01 +0000 (05:39 +0000)]
[OPENMP] Codegen for 'copyin' clause in 'parallel' directive.

Emits the following code for the clause at the beginning of the outlined function for implicit threads:

if (<not a master thread>) {
  ...
  <thread local copy of var> = <master thread local copy of var>;
  ...
}
<sync point>;
Checking for a non-master thread is performed by comparing of the address of the thread local variable with the address of the master's variable. Master thread always uses original variables, so you always know the address of the variable in the master thread.
Differential Revision: http://reviews.llvm.org/D9026

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

9 years ago[OPENMP] Codegen for 'lastprivate' clause in 'for' directive.
Alexey Bataev [Thu, 16 Apr 2015 04:54:05 +0000 (04:54 +0000)]
[OPENMP] Codegen for 'lastprivate' clause in 'for' directive.

#pragma omp for lastprivate(<var>)
for (i = a; i < b; ++b)
  <BODY>;

This construct is translated into something like:

  <last_iter> = alloca i32
  <lastprivate_var> = alloca <type>
  <last_iter> = 0
  ; No initializer for simple variables or a default constructor is called for objects.
  ; For arrays perform element by element initialization by the call of the default constructor.
  ...
  OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration.
  <BODY>
  ...
  OMP_FOR_END
  if (<last_iter> != 0) {
    <var> = <lastprivate_var> ; Update original variable with the lastprivate value.
  }
  call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race.

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

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

9 years agoDebugInfo: Prepare for DIDescriptor to be gutted in LLVM
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:53:23 +0000 (01:53 +0000)]
DebugInfo: Prepare for DIDescriptor to be gutted in LLVM

All the API is about to be dropped from `DIDescriptor` in LLVM, so stop
using it.

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

9 years agoDebugInfo: Prepare for DIScope to be gutted in LLVM
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:36:36 +0000 (01:36 +0000)]
DebugInfo: Prepare for DIScope to be gutted in LLVM

An upcoming LLVM commit will gut `DIScope`, so just use `MDScope*`
directly.

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

9 years agoDebugInfo: Prepare for DIType to be gutted
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:00:56 +0000 (01:00 +0000)]
DebugInfo: Prepare for DIType to be gutted

`DIType` and its subclasses are about to be gutted in LLVM.  Prepare for
that by treating these like the raw pointers they wrap.

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

9 years agoDebugInfo: Prepare for LLVM change removing DIType::isValid()
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:48:50 +0000 (23:48 +0000)]
DebugInfo: Prepare for LLVM change removing DIType::isValid()

This is being replaced with a null check.

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

9 years agoComment parsing: fix an assertion failure on a verbatim block terminated with "**/"
Dmitri Gribenko [Wed, 15 Apr 2015 23:45:43 +0000 (23:45 +0000)]
Comment parsing: fix an assertion failure on a verbatim block terminated with "**/"

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

9 years agoDebugInfo: Prepare for LLVM gutting DICompileUnit/DIFile
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:19:15 +0000 (23:19 +0000)]
DebugInfo: Prepare for LLVM gutting DICompileUnit/DIFile

An upcoming LLVM commit will gut `DICompileUnit` and `DIFile`, so start
treating them more like pointers.

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

9 years agoDon't crash when a selectany symbol would get common linkage
Nico Weber [Wed, 15 Apr 2015 23:04:24 +0000 (23:04 +0000)]
Don't crash when a selectany symbol would get common linkage

Things can't both be in comdats and have common linkage, so never give things
in comdats common linkage. Common linkage is only used in .c files, and the
only thing that can trigger a comdat in c is selectany from what I can tell.
Fixes PR23243.

Also address an over-the-shoulder review comment from rnk by moving the
hasAttr<SelectAnyAttr>() in Decl.cpp around a bit. It only makes a minor
difference for selectany on global variables, so it goes well with the rest of
this patch.

http://reviews.llvm.org/D9042

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

9 years agoFix for PR20402 in -Wconsumed.
DeLesley Hutchins [Wed, 15 Apr 2015 22:32:44 +0000 (22:32 +0000)]
Fix for PR20402 in -Wconsumed.
https://llvm.org/bugs/show_bug.cgi?id=20402
Patch by Chris Wailes.

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

9 years agoCreate a frontend flag to disable CUDA cross-target call checks
Eli Bendersky [Wed, 15 Apr 2015 22:27:06 +0000 (22:27 +0000)]
Create a frontend flag to disable CUDA cross-target call checks

For CUDA source, Sema checks that the targets of call expressions make sense
(e.g. a host function can't call a device function).

Adding a flag that lets us skip this check. Motivation: for source-to-source
translation tools that have to accept code that's not strictly kosher CUDA but
is still accepted by nvcc. The source-to-source translation tool can then fix
the code and leave calls that are semantically valid for the actual compilation
stage.

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

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

9 years agoclang-format a line containing nothing but a "{". No behavior change.
Nico Weber [Wed, 15 Apr 2015 21:53:00 +0000 (21:53 +0000)]
clang-format a line containing nothing but a "{". No behavior change.

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

9 years agoMake __declspec(selectany) turn variable declartions into definitions.
Nico Weber [Wed, 15 Apr 2015 21:50:06 +0000 (21:50 +0000)]
Make __declspec(selectany) turn variable declartions into definitions.

Fixes PR23242.

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

9 years agoDebugInfo: Pass DebugLocs when creating intrinsics
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 21:18:30 +0000 (21:18 +0000)]
DebugInfo: Pass DebugLocs when creating intrinsics

Update for LLVM API change r235041 that makes `DIBuilder` require a
`DebugLoc` to create a debug info intrinsic.

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

9 years agoFix docs typo in FunctionTemplateSpecializationInfo
Jonathan Roelofs [Wed, 15 Apr 2015 20:47:22 +0000 (20:47 +0000)]
Fix docs typo in FunctionTemplateSpecializationInfo

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

9 years ago[Objective-C Sema]This patch fixes the warning when clang issues
Fariborz Jahanian [Wed, 15 Apr 2015 17:26:21 +0000 (17:26 +0000)]
[Objective-C Sema]This patch fixes the warning when clang issues
"multiple methods named '<selector>' found" warning by noting
the method that is actualy used. It also cleans up and refactors
code in this area and selects a method that matches actual arguments
in case of receiver being a forward class object.
rdar://19265430

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

9 years agoclang-cl: support -fsyntax-only (PR23197)
Hans Wennborg [Wed, 15 Apr 2015 10:02:21 +0000 (10:02 +0000)]
clang-cl: support -fsyntax-only (PR23197)

This might help running Clang tooling (which appends this option)
with clang-cl command-lines.

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

9 years agoChanged test to not brake ARM buildbots, NFC.
Alexey Bataev [Wed, 15 Apr 2015 09:52:50 +0000 (09:52 +0000)]
Changed test to not brake ARM buildbots, NFC.

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

9 years agoRevert "[CodeGen] Fix crash with duplicated mangled name."
Renato Golin [Wed, 15 Apr 2015 08:44:40 +0000 (08:44 +0000)]
Revert "[CodeGen] Fix crash with duplicated mangled name."

This reverts commit r234767, as it was breaking all ARM buildbots for two days and the
assert is not in the code, making it difficult to spot the error, which would keep the
bots red for a few more days. New errors were silently introduced because of this bug,
and we don't want this to escalate.

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

9 years agoclang-format: Determine "in" as a keyword in ObjC for loops more precisely
Daniel Jasper [Wed, 15 Apr 2015 07:26:18 +0000 (07:26 +0000)]
clang-format: Determine "in" as a keyword in ObjC for loops more precisely

Before:
  for (int i = 0; i < in [a]; ++i) ..

After:
  for (int i = 0; i < in[a]; ++i) ..

Also do some related cleanups.

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

9 years ago[OPENMP] Codegen for 'firstprivate' clause in 'for' directive.
Alexey Bataev [Wed, 15 Apr 2015 04:52:20 +0000 (04:52 +0000)]
[OPENMP] Codegen for 'firstprivate' clause in 'for' directive.

Adds proper codegen for 'firstprivate' clause in for directive. Initially codegen for 'firstprivate' clause was implemented for 'parallel' directive only.
Also this patch emits sync point only after initialization of firstprivate variables, not all private variables. This sync point is not required for privates, lastprivates etc., only for initialization of firstprivate variables.
Differential Revision: http://reviews.llvm.org/D8660

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

9 years agoUse concrete type instead of auto in for-loop. No functionality change.
Richard Trieu [Wed, 15 Apr 2015 03:48:48 +0000 (03:48 +0000)]
Use concrete type instead of auto in for-loop.  No functionality change.

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

9 years agouselistorder: Remove dead include
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 03:04:45 +0000 (03:04 +0000)]
uselistorder: Remove dead include

Forgot to remove the include in r234970

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

9 years agouselistorder: -mllvm -preserve-ll-use-list-order => -emit-llvm-uselists
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 02:45:28 +0000 (02:45 +0000)]
uselistorder: -mllvm -preserve-ll-use-list-order => -emit-llvm-uselists

Follow up to r234962, start respecting `-emit-llvm-uselists even for
LLVM assembly.  Note that the driver never passes this flag; this is
just a interface convenience/consistency for those using `-cc1`
directly.  This required LLVM r234969 (and predecessors).

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

9 years agoChange range-based for-loops to be -Wrange-loop-analysis clean.
Richard Trieu [Wed, 15 Apr 2015 01:21:42 +0000 (01:21 +0000)]
Change range-based for-loops to be -Wrange-loop-analysis clean.
No functionality change.

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

9 years agouselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselists
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 01:16:18 +0000 (01:16 +0000)]
uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselists

Stop relying on `cl::opt` to pass along the driver's decision to
preserve use-lists.  Create a new `-cc1` option called
`-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc).
Note that despite its generic name, it *doesn't* do the right thing when
-emit-llvm (LLVM assembly) yet.  I'll hook that up soon.

This doesn't really change the behaviour of the driver.  The default is
still to preserve use-lists for `clang -emit-llvm` and `clang
-save-temps`, and nothing else.  But it stops relying on global state
(and also is a nicer interface for hackers using `clang -cc1`).

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