Commit Graph

57873 Commits

Author SHA1 Message Date
Artem Belevich c3e2fd7bea Revert "PR21000: pass -I options to assembler" as the test was failing on hexagon.
llvm-svn: 235919
2015-04-27 21:11:08 +00:00
Artem Belevich 8fe8ed56ee PR21000: pass -I options to assembler
Pass -I options to assembly so it can find files included with
.include.

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

llvm-svn: 235915
2015-04-27 20:51:44 +00:00
Paul Robinson d101ca21e6 Simplify depfile quoting test.
With -MG we don't actually need to create the files with funky names.
Also use a more sensible check-prefix for the NMAKE case.

llvm-svn: 235908
2015-04-27 19:40:04 +00:00
Artem Belevich fa62ad4087 [cuda] Ignore "TLS unsupported by target" errors for host variables during device compilation.
During device-side CUDA compilation clang currently complains about
all TLS variables, regardless of whether they are __host__ or
__device__.

This patch suppresses "TLS unsupported" errors for host variables
during device compilation and for device variables during host
compilation.

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

llvm-svn: 235907
2015-04-27 19:37:53 +00:00
Artem Belevich 0488d1e4ba [cuda] treat file scope __asm as __host__ and ignore it during device-side compilation.
Currently clang emits file-scope asm during *both* host and device
compilation modes which is usually a wrong thing to do.

There's no way to attach any attribute to an __asm statement, so
there's no way to differentiate between host-side and device-side
file-scope asm.  This patch makes clang to match nvcc behavior and
emit file-scope-asm only during host-side compilation.

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

llvm-svn: 235905
2015-04-27 18:52:00 +00:00
Paul Robinson d7214a7651 Support generating NMake/Jom-style depfiles.
NMake is a Make-like builder that comes with Microsoft Visual Studio.
Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool.
Dependency files for NMake/Jom need to use double-quotes to wrap
filespecs containing special characters, instead of the backslash
escapes that GNU Make wants.

Adds the -MV option, which specifies to use double-quotes as needed
instead of backslash escapes when writing the dependency file.

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

llvm-svn: 235903
2015-04-27 18:14:32 +00:00
Reid Kleckner 4cb2dbde5b [MS ABI] Use 'continue' instead of 'return false' where intended
This was a bug in r218285 that prevented us from seeing subsequent
virtual bases in the class hierarchy, leading to crashes later.

Also add some comments to this function, now that we better understand
what it's trying to do.

Fixes PR21062 and PR21064.

llvm-svn: 235899
2015-04-27 17:19:49 +00:00
Alexey Bataev c925aa3ab8 [OPENMP] Simplified iteration over clauses, NFC.
llvm-svn: 235838
2015-04-27 08:00:32 +00:00
Alexey Bataev 8b8e202a33 [OPENMP] Codegen for 'taskwait' directive.
Emit the following code for 'taskwait' directive within tied task:
call i32 @__kmpc_omp_taskwait(<loc>, i32 <thread_id>);
Differential Revision: http://reviews.llvm.org/D9245

llvm-svn: 235836
2015-04-27 05:22:09 +00:00
Alexey Bataev a89adf22db [OPENMP] Codegen for 'reduction' clause in 'sections' 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.
If sections directive has only single section, then original shared variables are used instead with barrier at the end of the directive.
Differential Revision: http://reviews.llvm.org/D9242

llvm-svn: 235835
2015-04-27 05:04:13 +00:00
Alexey Bataev 9efc03b6f7 [OPENMP] Codegen for 'lastprivate' clause in 'sections' directive.
#pragma omp sections lastprivate(<var>)
<BODY>;
This construct is translated into something like:

<last_iter> = alloca i32
<init for lastprivates>;
<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) {
  <final copy for lastprivate>; Update original variable with the lastprivate value.
}
call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race.
If there is only one section, there is no special code generation, original shared variables are used + barrier is emitted at the end of the directive.
Differential Revision: http://reviews.llvm.org/D9240

llvm-svn: 235834
2015-04-27 04:34:03 +00:00
Alexey Bataev 7387083d95 [OPENMP] Codegen for 'private' clause in 'sections' directive.
If there are 2 or more sections in a 'section' directive the following code is generated:

<default init for privates>
@__kmpc_for_static_init_4();
<BODY for sections directive>
@__kmpc_for_static_fini()
If there is only one section, the following code is generated:

if (@__kmpc_single()) {
  <default init for privates>
  @__kmpc_end_single();
}
Differential Revision: http://reviews.llvm.org/D9239

llvm-svn: 235833
2015-04-27 04:12:12 +00:00
Alexey Bataev 59c654aa43 [OPENMP] Codegen for 'private' clause in 'single' directive.
Emit the following code for 'single' directive with 'private' clause:

if (@__kmpc_single()) {
  <default init for privates>
  @__kmpc_end_single();
}
Differential Revision: http://reviews.llvm.org/D9238

llvm-svn: 235832
2015-04-27 03:48:52 +00:00
David Majnemer bdc1fedf1c [MS ABI] Rephrase the mangling of array types in parameters
Make the canonicalization of array types more consistent.

llvm-svn: 235831
2015-04-27 03:07:47 +00:00
David Majnemer 9370dc2fda [Sema] Do not permit binding a reference to a compound literal
We could probably make this work if we cared enough.  However, we are
far outside any language rules at this point.

This fixes PR21834.

llvm-svn: 235818
2015-04-26 07:35:03 +00:00
David Majnemer 8702b5215e [Sema] Don't allow unverified bitfields in FieldDecls
VerifyBitField must be called if we are to form a bitfield FieldDecl.
We will not verify the bitfield if the decl is known to be malformed in
other ways; pretend that we don't have a bitfield if this happens.

llvm-svn: 235816
2015-04-26 04:58:18 +00:00
John McCall 9fc700e76d Correctly handle zero-sized but non-empty base classes in IRGen.
Fixes rdar://20621065.

A more elegant fix would preclude this case by defining the
rules such that zero-size classes are always formally empty.
I believe the only extensions which create zero-size classes
right now are flexible arrays and zero-length arrays; it's
not abstractly unreasonable to say that those don't count
as members for the purposes of emptiness, just as zero-width
bitfields don't count.  But that's an ABI-affecting change
and requires further discussion; in the meantime, let's not
assert / miscompile.

llvm-svn: 235815
2015-04-26 04:43:26 +00:00
Davide Italiano 3c613d608d [Sema] Check if a builtin is FunctionPrototype().
Don't assume it's always is. This prevents a crash in Sema while
trying to merge return type for a builtin w/out function prototype.
 
PR:		23086
Differential Revision:	http://reviews.llvm.org/D9235
Reviewed by:	rsmith

llvm-svn: 235806
2015-04-25 20:20:04 +00:00
Justin Bogner e3654ce7ab InstrProf: Fix coverage maps for conditional operators
This fixes a crash when we're emitting coverage and a macro appears
between two binary conditional operators, ie, "foo ?: MACRO ?: bar",
and fixes the interaction of macros and conditional operators in
general.

llvm-svn: 235793
2015-04-24 23:37:57 +00:00
Nico Weber 1f0f165d50 clang-cl: Don't look up absolute paths in %LIB%.
Before this patch, passing a non-existent absolute path to clang-cl would cause
stat'ing of impossible paths. For example, `clang-cl -c d:\adsfasdf.txt` would
cause a stat of
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIBd:\asdfadsf.cc

llvm-svn: 235787
2015-04-24 22:16:53 +00:00
David Blaikie cb6b6f7e20 [opaque pointer type] Update test cases now that the type for an invoke is just a function type, not a pointer-to-function type
llvm-svn: 235756
2015-04-24 19:33:25 +00:00
Lang Hames 51ad8f1e4d Revert r235749 - Accidentally commited cruft from the wrong path.
llvm-svn: 235750
2015-04-24 19:08:30 +00:00
Lang Hames ef789b6a90 [CodeGen] Make AsmPrinter's OutStreamer member a unique_ptr.
AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a
reference for this is crufty.

llvm-svn: 235749
2015-04-24 19:04:55 +00:00
Daniel Jasper 775954be1e clang-format: Don't wrap after short first segments of builder calls.
Before:
  a()
      .aaaaa()
      .aaaaa()
      .aaaaa();

After:
  a().aaaaa()
      .aaaaa()
      .aaaaa();

llvm-svn: 235707
2015-04-24 10:08:09 +00:00
Daniel Jasper de0d1f3c26 clang-format: More selectively detect QT's "signals".
llvm-svn: 235702
2015-04-24 07:50:34 +00:00
Craig Topper bccb773ebc [TableGen] Clang changes for r235697 to stop leaking Expanders and Operators in SetTheory.
llvm-svn: 235698
2015-04-24 06:53:50 +00:00
Alexey Bataev 5521d78532 [OPENMP] Codegen for 'firstprivate' clause in 'single' directive.
Emit the following code for 'single' directive with 'firtstprivate' clause:

if (@__kmpc_single()) {
  <init for firstprivates>
  @__kmpc_end_single();
}
@__kmpc_cancel_barrier(); // To avoid data race in firstprivate init
Differential Revision: http://reviews.llvm.org/D9223

llvm-svn: 235694
2015-04-24 04:21:15 +00:00
David Majnemer b9ac794f57 Remove unused variable to silence GCC warning
llvm-svn: 235693
2015-04-24 04:14:25 +00:00
Alexey Bataev 8b72566eec [OPENMP] Do not emit implicit barrier for single directive with 'copyprivate' clause(s).
Runtime function for 'copyprivate' directive generates implicit barriers, so no need to emit it.
Differential Revision: http://reviews.llvm.org/D9215

llvm-svn: 235692
2015-04-24 04:00:39 +00:00
Alexey Bataev 2cb9b95adf [OPENMP] Codegen for 'firstprivate' clause in 'sections' directive.
If there are 2 or more sections in a 'section' directive the following code is generated:

<init for firstprivates>
@__kmpc_cancel_barrier();// To avoid data race in firstprivate init
@__kmpc_for_static_init_4();
<BODY for sections directive>
@__kmpc_for_static_fini()
If there is only one section, the following code is generated:

if (@__kmpc_single()) {
  <init for firstprivates>
  @__kmpc_end_single();
}
@__kmpc_cancel_barrier(); // To avoid data race in firstprivate init
Differential Revision: http://reviews.llvm.org/D9214

llvm-svn: 235691
2015-04-24 03:37:03 +00:00
David Majnemer 5fd33e0d1a Replace getPointeeType()->isFunctionType with isMemberDataPointerType
llvm-svn: 235682
2015-04-24 01:25:08 +00:00
David Majnemer e154456d4a [MS ABI] Fix the preferred alignment of member pointers
Member pointers in the MS ABI have different alignment depending on
whether they were created on the stack or live in a record.

llvm-svn: 235681
2015-04-24 01:25:05 +00:00
David Majnemer 37ea57862f Cleanup some MS-ABI specific code
No functional change intended.

llvm-svn: 235680
2015-04-24 01:24:59 +00:00
Richard Smith 6b77f549cb [modules] Partial revert of r235669: don't create ModuleMacros for imported local macros.
The surrounding infrastructure isn't quite ready for this yet.

llvm-svn: 235677
2015-04-24 00:41:09 +00:00
Richard Smith 50474bf5d2 [modules] Refactor creation of ModuleMacros and create them when importing from local submodules.
llvm-svn: 235669
2015-04-23 23:29:05 +00:00
Justin Bogner 66242d6c5e InstrProf: Stop using RegionCounter outside of CodeGenPGO (NFC)
The RegionCounter type does a lot of legwork, but most of it is only
meaningful within the implementation of CodeGenPGO. The uses elsewhere
in CodeGen generally just want to increment or read counters, so do
that directly.

llvm-svn: 235664
2015-04-23 23:06:47 +00:00
Richard Smith 2a553089c3 [modules] Properly attribute macros to modules if they're in a file textually included into a file in the module.
llvm-svn: 235661
2015-04-23 22:58:06 +00:00
Sergey Matveev 33e322455f Fix clang docs build.
llvm-svn: 235650
2015-04-23 21:29:37 +00:00
Richard Smith de71142dce [modules] Remove the now-redundant import of all pending macros at the end of building a module.
Since we now track module macros separately from their visibility state, this
is no longer necessary.

llvm-svn: 235648
2015-04-23 21:20:19 +00:00
Richard Smith 713369b057 [modules] Store a ModuleMacro* on an imported macro directive rather than duplicating the info within it.
llvm-svn: 235644
2015-04-23 20:40:50 +00:00
Sergey Matveev 07e2d283a3 Add clang/docs/SanitizerCoverage.rst
Moved from https://code.google.com/p/address-sanitizer/wiki/AsanCoverage

llvm-svn: 235643
2015-04-23 20:40:04 +00:00
Richard Smith b8b2ed6529 [modules] Determine the set of macros exported by a submodule at the end of that submodule.
Previously we'd defer this determination until writing the AST, which doesn't
allow us to use this information when building other submodules of the same
module. This change also allows us to use a uniform mechanism for writing
module macro records, independent of whether they are local or imported.

llvm-svn: 235614
2015-04-23 18:18:26 +00:00
Reid Kleckner 1ef49218b3 Don't emit lifetime markers when msan is enabled
In r235553, Clang started emitting lifetime markers more often. This
caused false negative in MSan, because MSan only poisons all allocas
once at function entry. Eventually, MSan should poison allocas at
lifetime start and probably also lifetime end, but until then, let's not
emit markers that aren't going to be useful.

llvm-svn: 235613
2015-04-23 18:07:13 +00:00
Aaron Ballman b673c65cb2 Extend format specifier checking to include field function pointers in addition to variable function pointers. Addresses PR21082.
llvm-svn: 235606
2015-04-23 16:14:19 +00:00
Aaron Ballman 1710cc994e Diagnose variadic main() as an extension; addresses PR17905.
llvm-svn: 235605
2015-04-23 16:12:42 +00:00
Daniel Jasper 0faa9136fa clang-format: Properly detect variable declarations with ObjC.
Before:
  LoooooooooooooooooooooooooooooooooooooooongType
  LoooooooooooooooooooooooooooooooooooooongVariable([A a]);

After:
  LoooooooooooooooooooooooooooooooooooooooongType
      LoooooooooooooooooooooooooooooooooooooongVariable([A a]);

llvm-svn: 235599
2015-04-23 13:58:40 +00:00
Daniel Jasper caf84fe21e clang-format: Allow splitting "= default" and "= delete".
Otherwise, this can violate the column limit.

llvm-svn: 235592
2015-04-23 12:59:09 +00:00
Daniel Jasper 532a031422 clang-format: Don't add unwanted space when creating new arrays.
Before:
  char** newargv = new char* [argc];

After:
  char** newargv = new char*[argc];

llvm-svn: 235583
2015-04-23 10:23:53 +00:00
Daniel Jasper 1b998815a0 clang-format: [Proto] Don't linewrap top-level options.
They are very similar to import statements.

llvm-svn: 235582
2015-04-23 09:54:10 +00:00
Daniel Jasper 289afc071e clang-format: Support nested block formatting with ColumnLimit=0.
llvm-svn: 235580
2015-04-23 09:23:17 +00:00