Commit Graph

58716 Commits

Author SHA1 Message Date
Bill Seurer 703e8486ec [PowerPC] Reformat altivec.h with clang-format
This revision just fixes the formatting of altivec.h.

llvm-svn: 239408
2015-06-09 14:39:47 +00:00
Jonathan Roelofs 6eef12f06f Move target-specific Sema test to its own file.
Fixing the build-break introduced in r239406.

llvm-svn: 239407
2015-06-09 14:30:17 +00:00
Jonathan Roelofs 78f9e038e0 Fix printing of GCCAsmExprs with input or output arguments.
Patch by Nick Sumner!

llvm-svn: 239406
2015-06-09 14:13:31 +00:00
Daniel Jasper dee894f6bb clang-format: Support //!-comments, increase test coverage.
llvm-svn: 239404
2015-06-09 13:16:54 +00:00
Benjamin Kramer fea47d418a Remove rm invocations where the file is immediately rewritten later.
This may or may not help making this test less flaky on windows. There's
a race condition in lit somewhere.

llvm-svn: 239402
2015-06-09 12:41:02 +00:00
Benjamin Kramer a242aaa501 Remove unused diagnostics.
-Wreceiver-is-weak is unused but should be ignored, move it to the list
of diagnostic groups.

llvm-svn: 239401
2015-06-09 12:17:19 +00:00
Aaron Ballman 825fb3c9d4 Removing spurious semi colons; NFC.
llvm-svn: 239400
2015-06-09 12:04:17 +00:00
Daniel Jasper c83d76991c clang-format: [JS] Hotfix for runtime issue with deeply nested JS code.
I have not succeeded in writing a proper test case for this yet and we
also need to solve the underlying fundamental problem of trying too
many combinations with nested blocks (basically this somewhat works
around our Dijkstra algorithm). Preventing this linebreak is good
anyways as usually the penalties never make us choose it (that's why I
can't create a test) and it also looks ugly.

Also cleaned up state comparison code that I discovered while hunting
this down.

llvm-svn: 239398
2015-06-09 11:39:22 +00:00
Greg Bedwell 065f70ae80 clang-cl: Ignore the /o option when /P is specified.
This matches the cl.exe behavior (tested with 18.00.31101).  In order to
specify an output file for /P, use the /Fi option instead.

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

llvm-svn: 239393
2015-06-09 10:24:06 +00:00
David Majnemer c7ee97d696 Reenable Misc/interpreter.c as r239388 correctly handles such targets
llvm-svn: 239389
2015-06-09 06:33:13 +00:00
David Majnemer 75fdd6b888 [Driver] Preserve the object file format in ComputeEffectiveClangTriple
The object file format is sometimes overridden for MSVC targets to use
ELF instead of COFF.  Make sure we preserve this choice when setting the
msvc version number in the triple.

llvm-svn: 239388
2015-06-09 06:30:01 +00:00
NAKAMURA Takumi b21e942ac1 Disable clang/test/Misc/interpreter.c, for now, since r239273 mishandled *-msvc-elf.
llvm-svn: 239387
2015-06-09 06:27:21 +00:00
David Majnemer 78324f2bce [MSVC Compatibility] Don't diagnose c-style cast from void-ptr to fn-ptr
The machinery added to permit a static_cast from void-ptr to fn-ptr
unintentionally gets triggered for c-style casts and function-style
casts.  The observable effect was a diagnostic issued inappropriately.

llvm-svn: 239382
2015-06-09 02:41:08 +00:00
Sean Silva 14facf307c range-for'ify Args->filtered_begin(...) loops
We already have Args->filtered(...) which is a drop-in range-for
replacement.

llvm-svn: 239381
2015-06-09 01:57:17 +00:00
Sean Silva ab70cfa3af Simplify this code a bit.
We weren't using the short-circuiting property anyway.

llvm-svn: 239376
2015-06-09 00:47:20 +00:00
Hans Wennborg fce87cae44 Enable DLL attribute propagation on explicit instantiation definitions (PR23770)
This is a follow-up to r225570 which enabled adding DLL attributes when a
class template goes from explicit instantiation declaration to explicit
instantiation definition.

llvm-svn: 239375
2015-06-09 00:39:09 +00:00
Hans Wennborg c0875507be MinGW: don't allow adding DLL attribute if template already has explicit instantiation declaration
This is a follow-up to r238266 which failed to take MinGW into account.

llvm-svn: 239374
2015-06-09 00:39:05 +00:00
Hans Wennborg bb1983cf3a Enable propagation of dll attributes to previously instantiated base class templates in some cases
It is safe to add a dll attribute if the base class template previously only had
an explicit instantiation declaration, or was implicitly instantiated.

I both those cases, the members would not have been codegenned yet. In the case
of explicit instantiation declaration this is natural, and for implicit
instantiations, codegen is deferred (see r225570).

This is work towards fixing PR23770.

llvm-svn: 239373
2015-06-09 00:39:03 +00:00
Hans Wennborg 29b7a93935 Narrow the -Wunsupported-dll-base-class-template warning.
Don't warn about not being able to propagate dll attribute to a base class template
when that base already has a different attribute.

MSVC doesn't actually try to do this; the first attribute that was propagated
takes precedence, so Clang is already doing the right thing and there's no
need to warn.

(This is a step towards fixing PR21718.)

llvm-svn: 239372
2015-06-09 00:38:56 +00:00
Richard Smith 87bb569844 [modules] Fix some visibility issues with default template arguments.
There are still problems here, but this is a better starting point.

The main part of the change is: when doing a lookup that would accept visible
or hidden declarations, prefer to produce the latest visible declaration if
there are any visible declarations, rather than always producing the latest
declaration.

Thus, when we inherit default arguments (and other properties) from a previous
declaration, we inherit them from the previous visible declaration; if the
previous declaration is hidden, we already suppress inheritance of default
arguments.

There are a couple of other changes here that fix latent bugs exposed by this
change.

llvm-svn: 239371
2015-06-09 00:35:49 +00:00
Tyler Nowicki 4e8e900dd1 Eliminate unnecessary namespace to prevent conflicts.
llvm-svn: 239365
2015-06-08 23:27:35 +00:00
Tyler Nowicki 24853c123a Correct Loop Hint Diagnostic Message
When pragma clang loop unroll() is specified without an argument the diagnostic message should inform that user that 'full' and 'disable' are valid arguments (not 'enable').

llvm-svn: 239363
2015-06-08 23:13:43 +00:00
Tyler Nowicki 90203dc855 Moved CPP CodeGen tests into CodeGenCXX.
llvm-svn: 239362
2015-06-08 22:53:36 +00:00
Hubert Tong 13234ae40d Consider unsigned long for non-u/U decimal literals (C90/C++03)
Summary:
This modifies Clang to reflect that under pre-C99 ISO C, decimal
constants may have type `unsigned long` even if they do not contain `u`
or `U` in their suffix (C90 subclause 6.1.3.2 paragraph 5). The same is
done for C++ without C++11 which--because of undefined behaviour--allows
for behaviour compatible with ISO C90 in the case of an unsuffixed
decimal literal and is otherwise identical to C90 in its treatment of
integer literals (C++03 subclause 2.13.1 [lex.icon] paragraph 2).

Messages are added to the `c99-compat` and `c++11-compat` groups to warn
on such literals, since they behave differently under the newer
standards.

Fixes PR 16678.

Test Plan:
A new test file is added to exercise both pre-C99/C++11 and C99/C++11-up
on decimal literals with no suffix or suffixes `l`/`L` for both 32-bit
and 64-bit `long`.

In the file, 2^31 (being `INT_MAX+1`) is tested for the expected type
using `__typeof__` and multiple declarations of the same entity. 2^63
is similarly tested when it is within the range of `unsigned long`.

Preprocessor arithmetic tests are added to ensure consistency given
that Clang (like GCC) uses greater than 32 bits for preprocessor
arithmetic even when `long` and `unsigned long` is 32 bits and a
pre-C99/C++11 mode is in effect.

Tests added:
  test/Sema/PR16678.c

Reviewers: fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 239356
2015-06-08 21:59:59 +00:00
Leny Kholodov 1c5ad681d7 Update test with target flag and amended results
llvm-svn: 239298
2015-06-08 11:39:16 +00:00
Leny Kholodov 8a7b827b3d Fix for temporary variable names in stack reuse tests in revision 239294
llvm-svn: 239296
2015-06-08 11:06:59 +00:00
Leny Kholodov 6aab1117e8 [CodeGen] Reuse stack space from unused function results (with more accurate unused result detection)
This patch fixes issues with unused result detection which were found in patch http://reviews.llvm.org/D9743.

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

llvm-svn: 239294
2015-06-08 10:23:49 +00:00
David Majnemer e11d373512 [Driver] Inject the MSVC compatibility version into the triple
Encoding the version into the triple will allow us to communicate to
LLVM what functions it can expect to depend upon in the implementation.

llvm-svn: 239273
2015-06-08 00:22:46 +00:00
Peter Collingbourne 8a484c3017 clang-cl: Implement /GL in terms of -flto.
No documentation yet; the linker needs more work.

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

llvm-svn: 239213
2015-06-06 02:09:34 +00:00
David Majnemer 8423df927e Move a test from static-assert.cpp to DeclPrinterTest
It's better not to rely on the diagnostics engine to pretty print the
argument to decltype.  Instead, exercise the functionality in
DeclPrinterTest.

llvm-svn: 239197
2015-06-05 22:40:53 +00:00
Eric Christopher 56df435693 Fix typo of function name.
llvm-svn: 239194
2015-06-05 22:03:01 +00:00
Eric Christopher 162c91ccc4 Rename the single non-style conformant function in TargetCodeGenInfo
and update all callers.

llvm-svn: 239193
2015-06-05 22:03:00 +00:00
David Majnemer 81ecbf45d4 Revert accidental commit
This change was unrelated to r239170.

llvm-svn: 239176
2015-06-05 18:24:55 +00:00
David Majnemer cdffc36c11 [AST] There is no message for C++1z-style static_assert
We would crash in the DeclPrinter trying to pretty-print the
static_assert message.  C++1z-style assertions don't have a message so
we would crash.

This fixes PR23756.

llvm-svn: 239170
2015-06-05 18:03:58 +00:00
James Y Knight f9373862ea [SPARC] Fix windows test failure after r239154.
(Hopefully)

llvm-svn: 239156
2015-06-05 14:16:39 +00:00
James Y Knight 09677ad882 [SPARC] Add multiarch include paths.
Adds tests verifying the proper dirs are found in the Debian 8/GCC4.9
layout for sparc (32bit), sparc (32bit) with lib64 multilib, and
sparc64.

The test cases added here also cover r239047, which fixed the linker
paths.

llvm-svn: 239154
2015-06-05 13:44:43 +00:00
Alexander Musman eae29e247e Fix for PR14269: Clang crashes when a bit field is used as inline assembler
input / output with memory constraint.
One generally can't get address of a bit field, so the general solution is to
error on such cases. GCC does the same.

Patch by Andrey Bokhanko

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

llvm-svn: 239153
2015-06-05 13:40:59 +00:00
John Brawn 5a589ad603 [ARM] Use TargetParser to determine FPU subtarget features
The main effect of this is to fix anomalies where certain -mfpu options didn't
disable everything that they should causing strange behaviour when combined
with -mcpu or -march values that themselves enabled fpu subtarget features,
e.g. -mfpu=fpv5-dp-d16 with -march=armv7em previously behaved the same as
-mfpu=fpv5-sp-d16 due to fp-only-sp not being disabled.

Invalid -mfpu options now also give an error, which is consistent with the
handling of the .fpu directive.

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

llvm-svn: 239152
2015-06-05 13:34:11 +00:00
Daniel Jasper 6f2b88a398 clang-format: More eagerly wrap trailing return types.
Before:
  template <typename T>
  auto aaaaaaaaaaaaaaaaaaaaaa(T t) -> decltype(eaaaaaaaaaaaaaaa<T>(t.a)
                                                   .aaaaaaaa());

After:
  template <typename T>
  auto aaaaaaaaaaaaaaaaaaaaaa(T t)
      -> decltype(eaaaaaaaaaaaaaaa<T>(t.a).aaaaaaaa());

Also add a test case for a difficult template parsing case I stumbled accross.
Needs fixing.

llvm-svn: 239149
2015-06-05 13:18:09 +00:00
Yaron Keren 10d6d1689b C++ 11 rangify for loop.
llvm-svn: 239140
2015-06-05 09:40:53 +00:00
Daniel Jasper 3b0f304517 clang-format: [JS] Let fat arrows have 'Assignment' precedence.
This is a more correct representation than using "Equality" introduced
in r238942 which was a quick fix to solve an actual regression.

According to the typescript spec, arrows behave like "low-precedence"
assignments.

Before:
  var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) &&
                    aaaaaaaaaaaaaaaaaaaaa(bbbbbbb));
After:
  var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) &&
                              aaaaaaaaaaaaaaaaaaaaa(bbbbbbb));

llvm-svn: 239137
2015-06-05 08:25:37 +00:00
Hubert Tong 6e04f98bc3 [Concepts] lex keywords: concept and requires
Summary:
This patch enables lexing of `concept` and `requires` as keywords.
Further changes which add messages for future keyword compat are to
follow.

Test Plan:
Testing of C++14 + Concepts TS mode is added to
`test/Lexer/keywords_test.cpp`, which expects that the new keywords are
enabled under said mode.

Reviewers: faisalv, fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 239128
2015-06-05 01:10:24 +00:00
Sean Silva 8230e5ee51 Remove unused defaulted argument `IncludeTextualHeaders`.
llvm-svn: 239123
2015-06-04 23:38:11 +00:00
Hubert Tong 64c2f5a50f Test commit access.
Fixes trailing whitespace in lib/Sema/JumpDiagnostics.cpp.

llvm-svn: 239112
2015-06-04 22:53:21 +00:00
Artyom Skrobov 902ac2d837 Simplify ARMTargetParser::parseArch(ARMTargetParser::getCanonical()), following r239099
Reviewers: rengolin

Reviewed By: rengolin

Subscribers: cfe-commits

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

llvm-svn: 239101
2015-06-04 21:31:41 +00:00
Chandler Carruth c925a905f7 Fix terrible python goof in clang-format.py which broke my vim
integration.

Nothing is more important in life than clang-format integration with
vim. ;]

llvm-svn: 239098
2015-06-04 21:23:07 +00:00
Ahmed Bougacha 01950a02c0 [CodeGen] Add testcase for r239002.
Just realized I forgot to add it when committing.

llvm-svn: 239093
2015-06-04 20:58:49 +00:00
Bill Seurer 8be14f11ce [PowerPC] This revision adds 68 of the missing "Predefined Functions for Vector Programming" from appendix A of the OpenPOWER ABI for Linux Supplement document.
I also added tests for the new functions and updated another test that was looking for specific line numbers in error messages from altivec.h.

https://llvm.org/bugs/show_bug.cgi?id=23679

http://reviews.llvm.org/D10131

llvm-svn: 239066
2015-06-04 18:45:44 +00:00
Yaron Keren 713bfbb2d4 C++11 rangify for loop.
llvm-svn: 239064
2015-06-04 18:33:04 +00:00
Gabor Ballabas 208826cc0f Allow case-insensitive values for -mcpu for ARM
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.

llvm-svn: 239059
2015-06-04 17:56:32 +00:00
James Y Knight c0aeadf92d [SPARC] Fix multiarch path detection for sparc and sparcv9.
llvm-svn: 239047
2015-06-04 15:36:30 +00:00
James Y Knight 4b4d19ede2 [SPARC] Fix types of size_t, intptr_t, and ptrdiff_t on Linux.
They should be 'int' instead of 'long int' everywhere else except
NetBSD too, from what I gather in GCC's spec files. So, optimistically
changing it for everyone else, too.

llvm-svn: 239046
2015-06-04 15:36:29 +00:00
Douglas Katzman f08fadfe2b Remove extraneous qualifiers due to "using namespace". NFC
llvm-svn: 239038
2015-06-04 14:40:44 +00:00
Brad Smith b58159ab1f Use the appropriate PIE level for OpenBSD/sparc.
llvm-svn: 239028
2015-06-04 08:45:23 +00:00
James Y Knight 4c5901eefc Fix fragile source-col-map.c test-case.
The test passing was dependent upon your source tree being checked out
in a directory with a long enough path, to cause the diagnostics to
wrap at the expected locations.

Use stdin instead, so that the error messages consistently use
<stdin> as the filename, and get wrapped consistently.

llvm-svn: 239009
2015-06-04 04:15:33 +00:00
Ahmed Bougacha 94df730f7d [CodeGen][NEON] Emit constants for "immediate" intrinsic arguments.
On ARM/AArch64, we currently always use EmitScalarExpr for the immediate
builtin arguments, instead of directly emitting the constant. When the
overflow sanitizer is enabled, this generates overflow intrinsics
instead of constants, breaking assumptions in various places.

Instead, use the knowledge of "immediates" to directly emit a constant:
- teach the tablegen backend to emit the "immediate" modifiers
- use those modifiers in the NEON CodeGen, on ARM and AArch64.

Fixes PR23517.

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

llvm-svn: 239002
2015-06-04 01:43:41 +00:00
Justin Bogner 90e8e2c586 Driver: Don't crash when generating crash reports for *-header inputs
If we crash while handling headers, the crash report mechanism
currently tries to make a string out of a null pointer when it tries
to make up a file extension.

Map *-header input types to reasonable extensions to avoid this.

llvm-svn: 238994
2015-06-04 00:30:22 +00:00
Devin Coughlin d7112c391c [analyzer]Test commit fixing 80-column violation in comment. NFC.
llvm-svn: 238993
2015-06-04 00:18:10 +00:00
Douglas Katzman fe77e0dcfc Save getArch() in a local var instead of calling it 20 times, etc.
Differential Revision: http://reviews.llvm.org/D10224

llvm-svn: 238992
2015-06-04 00:15:00 +00:00
Douglas Katzman 7ae27b88dd Change big 'if' statement into a switch. NFC
Differential Revision: http://reviews.llvm.org/D10223

llvm-svn: 238955
2015-06-03 19:40:30 +00:00
Colin LeMahieu e4c0d58f62 [Hexagon] Reapply 238773 after fix to LLVM.
llvm-svn: 238948
2015-06-03 17:34:22 +00:00
Daniel Jasper 3c306e895e clang-format: [JS] Let fat arrows have 'Equality' precedence.
This fixes a regression in literal formatting:

Before:
  aaaaaaaaaaaaa = {
    aaaaaaaaaaaaaaaaaaaaaaaaaaaa: (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                                   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =>
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
  };

After:
  var aaaaaaaaaaaaaaaaaaaa = {
    aaaaaaaaaaaaaaaaaaaaaaaaaaaa:
        (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =>
                aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
  };

Also apply no-else-after-return policy.

llvm-svn: 238942
2015-06-03 17:08:40 +00:00
Douglas Katzman 9dc5fbb458 Fix misleading comment. NFC
llvm-svn: 238938
2015-06-03 16:56:50 +00:00
Russell Gallop 14c4dab603 [utils] Improvements to check_cfc.py to work better with some build systems.
Recognise options to output dependency files and don't perform checks.
Report input file name when reporting a check failure so it is more obvious in large build logs.

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

llvm-svn: 238928
2015-06-03 15:09:13 +00:00
Russell Gallop aef6d17c8d [utils] Add exact check to check_cfc.py dash_s_no_change.
Files compiled with -via-file-asm should be byte for byte identical. This
change improves the checking on dash_s_no_change to detect non-code
differences. If there is a difference, the check goes on to compare code and
debug to try and be more informative.

llvm-svn: 238926
2015-06-03 14:33:57 +00:00
Asaf Badouh 5a26b25471 minor test fix
llvm-svn: 238924
2015-06-03 13:42:46 +00:00
Manuel Klimek 94a89231f6 Allow replacements created from token ranges to specify language options.
The default language options will lead to incorrect replacements in C++
code, for example when trying to replace nested name specifiers ending
in "::".

llvm-svn: 238922
2015-06-03 13:10:41 +00:00
Enrico Pertoso faed801f6e Append CXXDefaultInitExpr's wrapped expression to the CFG when visiting a constructor initializer
Summary:
This patch is part of http://llvm-reviews.chandlerc.com/D2181.

In-class initializers are appended to the CFG when CFGBuilder::addInitializer is called.

Reviewers: jordan_rose, rsmith

Reviewed By: jordan_rose

Subscribers: cfe-commits, klimek

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

llvm-svn: 238913
2015-06-03 10:12:40 +00:00
Vladimir Sukharev c85ed8567c Fix typo in cross-compilation docs: "-fpu" -> "-mfpu"
Reviewers: rengolin

Subscribers: cfe-commits

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

llvm-svn: 238912
2015-06-03 10:11:42 +00:00
Daniel Jasper 5962fa80c2 clang-format: Properly reset BreakBeforeParameter when wrapping
operators to the new line.

Before:
  LOG_IF(aaa == //
         bbb)
      << a
      << b;

After:
  LOG_IF(aaa == //
         bbb)
      << a << b;

llvm-svn: 238911
2015-06-03 09:26:03 +00:00
Enrico Pertoso 4432d87578 Fixes a typo in a comment.
llvm-svn: 238910
2015-06-03 09:10:58 +00:00
Daniel Jasper 9970df1f79 clang-format: [JS] More aggressively keep array literals on one line.
Before:
  var aaaaa: List<SomeThing> = [
    new SomeThingAAAAAAAAAAAA(),
    new SomeThingBBBBBBBBB()
  ];

After:
  var aaaaa: List<SomeThing> =
      [new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];

llvm-svn: 238909
2015-06-03 08:57:36 +00:00
Daniel Jasper 81dbb564a1 clang-format: [JS] Fix bug in type colon detection.
Before, this couldn't be formatted at all:
  class X {
    subs = {
      'b': {
        'c': 1,
      },
    };
  }

llvm-svn: 238907
2015-06-03 08:43:18 +00:00
Rafael Espindola dc9293d051 Revert "add the -mrecip driver flag and process its options (2nd try)"
This reverts commit r238851.

It depends on a llvm commit that was reverted.

llvm-svn: 238904
2015-06-03 05:44:28 +00:00
David Majnemer c6eb650120 [Sema] Make the atomic builtins more efficient by reducing volatility
The parameter types and return type do not need to be volatile just
because the pointer type's pointee type is volatile qualified.  This is
an unnecessary pessimization.

llvm-svn: 238892
2015-06-03 00:26:35 +00:00
Douglas Katzman 677324e0b5 Fix typo in tutorial.
llvm-svn: 238885
2015-06-02 22:40:27 +00:00
David Majnemer 85bd120679 [MSVC Compatibility] Permit static_cast from void-ptr to function-ptr
The MSVC 2013 and 2015 implementation of std::atomic is specialized for
pointer types.  The member functions are implemented using a static_cast
from void-ptr to function-ptr which is not allowed in the standard.
Permit this conversion if -fms-compatibility is present.

This fixes PR23733.

llvm-svn: 238877
2015-06-02 22:15:12 +00:00
Douglas Katzman 9c19d35fa7 Correct DriverInternals.rst: ccc-print-options is gone.
Was removed in svn r189802.

llvm-svn: 238876
2015-06-02 22:06:32 +00:00
Daniel Jasper e497beddb5 clang-format: [JS] Always add space after fat arrow.
Before:
  return () =>[];

After:
  return () => [];

llvm-svn: 238875
2015-06-02 22:06:07 +00:00
Daniel Jasper d492b5ec03 clang-format: [JS] Array literal detection fix #4.
llvm-svn: 238873
2015-06-02 21:57:51 +00:00
Andrea Di Biagio e7347c67cd [x86-64 ABI] Fix for PR23082: an assertion failure when passing/returning a wrapper union in a full YMM register.
This patch fixes an assertion failure in method
'X86_64ABIInfo::GetByteVectorType'.

Method 'GetByteVectorType' (in TargetInfo.cpp) is responsible
for mapping a QualType 'Ty' (for an argument or return value) to an LLVM IR
type that, according to the ABI, must be passed in a XMM/YMM vector register.

When selecting the IR vector type, method 'GetByteVectorType' always tries to
choose the "best" IR vector type for the 'Ty' in input. In particular, if Ty
is a wrapper structure, it keeps unwrapping it until it finds a vector type VTy.
That VTy is the "preferred IR type".

However, function 'isSingleElementStructure' (used to unwrap structures) does
not know how to look through union types. So, before this patch, if Ty was in
a nest of wrapper structures with at least two union types, we would have
triggered an assertion failure (added at revision 230971).

With this patch, if method 'GetByteVectorType' fails to find the preferred
vector type, we just return a valid (although potentially 'less friendly')
vector type based on the type size. So, rather than asserting on an 'unexpected'
'Ty' in input, we conservatively return vector type <2 x double> if Ty is 16
bytes, or <4 x double> if Ty is 32 bytes.

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

llvm-svn: 238861
2015-06-02 19:34:40 +00:00
Sanjay Patel 21141d7a9c add missing dependency for CodeGen lib
This looks to be exposed on some bots by r238851.

llvm-svn: 238855
2015-06-02 18:02:13 +00:00
Sanjay Patel d79da01631 add the -mrecip driver flag and process its options (2nd try)
The first try to land this (r238055) was reverted due to bot failures
caused by the LLVM part of the patch. That was hopefully fixed by r238788,
and the LLVM patch was resubmitted at r238842.

This is the front-end counterpart to D8982.

The -mrecip option interface is based on maintaining compatibility with gcc:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289

...while adding more functionality (allowing users to specify the number of refinement steps for each
estimate type).

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

llvm-svn: 238851
2015-06-02 16:55:12 +00:00
Daniel Jasper 1feab0f95e clang-format: Don't try to detect C++ lambdas in other languages.
llvm-svn: 238845
2015-06-02 15:31:37 +00:00
Daniel Jasper 199d0c9e76 clang-format: [JS] Fix incorrect line length calculation.
llvm-svn: 238841
2015-06-02 15:14:21 +00:00
Daniel Jasper 40432cee93 clang-format: [JS] Array literal detection fix #3.
llvm-svn: 238839
2015-06-02 15:04:29 +00:00
Daniel Jasper 4284e3623c clang-format: [JS] Fix another regression when detecting array literals.
llvm-svn: 238835
2015-06-02 14:20:08 +00:00
Daniel Jasper 5ce80de4de clang-format: [JS] Fix regression of detecting array literals.
llvm-svn: 238832
2015-06-02 13:56:43 +00:00
Manuel Klimek 995901756f Make vim also output a helpful message in some error cases.
When clang-format encounters a syntax error, it will not format that
line; we're now using the same mechanism we're already using in emacs to
show a helpful error message to the user.

llvm-svn: 238823
2015-06-02 12:01:50 +00:00
Manuel Klimek 21b4117a12 Remove error message when using the fallback style.
llvm-svn: 238822
2015-06-02 11:52:15 +00:00
David Majnemer 5c2589a50b [Basic] Transition getEnvironmentVersion from getOSVersion for android
'android' occupies the environment component of the triple.  Let's use
getEnvironmentVersion to extract it instead of getOSVersion.

llvm-svn: 238797
2015-06-01 23:38:25 +00:00
Rafael Espindola c0f18a91ac Replace a few std::string& with StringRef. NFC.
Patch by Косов Евгений!

llvm-svn: 238774
2015-06-01 20:00:16 +00:00
Rafael Espindola 015455848e Revert "[Hexagon] Test passes for hexagon target now that the backend correctly generates relocations."
This reverts commit r238754.

It depends on r238748, which was reverted.

llvm-svn: 238773
2015-06-01 19:46:36 +00:00
Jonathan Roelofs 104cbf9c32 Fix PR21945: Crash in constant evaluator.
Patch by Косов Евгений!

llvm-svn: 238758
2015-06-01 16:23:08 +00:00
Colin LeMahieu 743d1a7a69 [Hexagon] Test passes for hexagon target now that the backend correctly generates relocations.
llvm-svn: 238754
2015-06-01 15:47:46 +00:00
Daniel Jasper 1699eca119 clang-format: [JS] Making arrow function wrapping more consistent.
Before:
  someFunction(() =>
               {
                 doSomething();  // break
               })
      .doSomethingElse(  // break
          );

After:
  someFunction(() => {
    doSomething();  // break
  })
      .doSomethingElse(  // break
          );

This is still bad, but at least it is consistent with what we do for other
function literals. Added corresponding tests.

llvm-svn: 238736
2015-06-01 09:56:32 +00:00
David Majnemer f04e3862ca [MS ABI] Be a little more defensive wrt vector types
We probably shouldn't say that all appropriately sized vector types are
intel vector types (i.e. __m128, etc.) as they don't exist for all
architectures.  While this is largely academic, it'd save some debugging
if we supported such a platform.

llvm-svn: 238731
2015-06-01 07:41:37 +00:00
Benjamin Kramer c7551a4843 [Format] Move UnwrappedLines instead of copying.
No functional change intended.

llvm-svn: 238673
2015-05-31 11:18:05 +00:00
Daniel Jasper be520bd1a6 clang-format: NFC. Cleanup after r237895.
Specifically adhere to LLVM Coding Standards (no 'else' after
return/break/continue) and remove yet another implementation of
paren counting. We already have enough of those in the
UnwrappedLineParser.

No functional changes intended.

llvm-svn: 238672
2015-05-31 08:51:54 +00:00
Daniel Jasper cd8d4ff985 clang-format: [JS] Fix line breaks in computed property names.
Before:
  let foo = {
    [someLongKeyHere]: 1,
    someOtherLongKeyHere: 2, [keyLongEnoughToWrap]: 3,
    lastLongKey: 4
  };

After:
  let foo = {
    [someLongKeyHere]: 1,
    someOtherLongKeyHere: 2,
    [keyLongEnoughToWrap]: 3,
    lastLongKey: 4
  };

llvm-svn: 238671
2015-05-31 08:40:37 +00:00
Nuno Lopes 1ba2d78b9a ubsan: Check for null pointers given to certain builtins, such
as memcpy, memset, memmove, and bzero.

Reviewed by: Richard Smith

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

llvm-svn: 238657
2015-05-30 16:11:40 +00:00
David Majnemer 4e51dfc431 [CodeGen] Indirect fields can initialize a union
The first named data member is the field used to default initialize the
union.  An IndirectFieldDecl can introduce the first named data member
of a union.

llvm-svn: 238649
2015-05-30 09:12:07 +00:00
Eric Christopher 7565e0d102 Fix 80-column violations.
llvm-svn: 238630
2015-05-29 23:09:49 +00:00
NAKAMURA Takumi 2d0913cd8d clang/CMakeLists.txt: s/LLVM_INSTALL_PACKAGE_DIR/CLANG_INSTALL_PACKAGE_DIR/ for the standalone configuration.
llvm-svn: 238628
2015-05-29 22:58:05 +00:00
Ahmed Bougacha 5b63908f9f [Sema] Promote compound assignment exprs. with fp16 LHS and int. RHS.
We catch most of the various other __fp16 implicit conversions to
float, but not this one:

  __fp16 a;
  int i;
  ...
  a += i;

For which we used to generate something 'fun' like:

  %conv = sitofp i32 %i to float
  %1 = tail call i16 @llvm.convert.to.fp16.f32(float %conv)
  %add = add i16 %0, %1

Instead, when we have an __fp16 LHS and an integer RHS, we should
use float as the result type.

While there, add a bunch of missing tests for mixed
__fp16/integer expressions.

llvm-svn: 238625
2015-05-29 22:54:57 +00:00
Tim Northover a8c168db7f ARM: fix ACLE predefine for iOS's "-arch armv7s".
We were getting "#define __ARM_ARCH_7 -S__ 1" which is really not a good idea.

llvm-svn: 238614
2015-05-29 21:28:25 +00:00
Benjamin Kramer 3204b152b5 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

llvm-svn: 238601
2015-05-29 19:42:19 +00:00
Chris Bieneman 8eb2fc8c4a [CMake] Bug 19462 - Use the INSTALL(EXPORT ...) to export CMake definitions
Summary: This patch moves all the clang library targets into a ClangTargets export list, and installs it using the CMake install(EXPORT...) command.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 238593
2015-05-29 18:36:20 +00:00
John Brawn a8f8234f91 [ARM] Adjust -march checking
getCanonicalArchName can return an empty string for an architecture
that is well-formed but meaningless. Use parseArch to determine if
it's actually valid or not.

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

llvm-svn: 238553
2015-05-29 13:10:44 +00:00
Alexander Musman 94f14d9b73 Fix assertion on C++ attributes in fillAttributedTypeLoc
this fixes http://llvm.org/PR17424
fillAttributedTypeLoc() function is only called with AttributeLists of either
DeclarationChunk (which is used for each type in a declarator being parsed) or
DeclSpec (which captures information about declaration specifiers).
As C++11 attributes actually appertain to declarators, they are moved straight
to the declarator’s attr list in distributeFunctionTypeAttrFromDeclSpec()
function.
'Put them wherever you like' semantics is not supported for C++11 attributes
(but is allowed for GNU attributes, for example). So when we meet an attribute
while parsing the declaration, we cannot be sure if it appertains to either
DeclarationChunk or DeclSpec.

This investigation correlates with the history of changes of SemaType.cpp:
• Asserts in fillAttributedTypeLoc() were added on 3 Mar 2011 in r126986
(http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-
        20110228/039638.html);
• Distributing C++11 attrs to the declarator was added on 14 Jan 2013
in r172504 (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-
        20130114/071830.html).
Considering all written above I changed asserts in fillAttributedTypeLoc()
to nullptr checks.

This fixes PR17424 and related assertion on
[[gnu::fastcall]] void __stdcall foo();

Author: Alexey Frolov

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

llvm-svn: 238550
2015-05-29 11:24:32 +00:00
Daniel Marjamaki e4770da766 Refactor MacroInfo so macro arguments can be iterated with range-based for loops.
No functional change intended.

Patch by Sebastian Edman!

llvm-svn: 238547
2015-05-29 09:15:24 +00:00
Daniel Marjamaki 5f75f5b315 Run clang-format on MacroInfo.h
llvm-svn: 238546
2015-05-29 08:26:48 +00:00
Daniel Jasper 8c42d445e3 clang-format: [JS] Support ES6 computed property names.
Before:
  var x = {
        [a]: 1,
    b: 2
  };

After:
  var x = {
    [a]: 1,
    b: 2
  };

llvm-svn: 238544
2015-05-29 06:19:49 +00:00
Jingyue Wu 76c757cc35 NFC: tab => spaces
llvm-svn: 238542
2015-05-29 05:43:03 +00:00
Justin Bogner 20eb9d486c wip: Remove some unused functions
llvm-svn: 238538
2015-05-29 02:42:14 +00:00
Richard Smith eec7cb1794 Remove dead code.
llvm-svn: 238526
2015-05-28 23:38:53 +00:00
Justin Bogner cb337035f2 AST: Fix printing GNU old-style field designators
Allows StmtPrinter to print old style field designators in
initializers, fixing an issue where we would print the following
invalid code:

  struct A a = {b: = 3, .c = 4};

Patch by Nick Sumner. Thanks!

llvm-svn: 238517
2015-05-28 22:19:36 +00:00
Diego Novillo 46ab35d680 Improve user documentation on profiling.
This clarifies the relationship between instrumentation and sampling based PGO,
code coverage analysis and the different formats supported by sample
profiling.

llvm-svn: 238504
2015-05-28 21:30:04 +00:00
Chandler Carruth 25c6a22e43 [omp] Loosen the driver test enough so that overriding the defaults
works well for folks.

This isn't terribly clean (sadly) but after chatting with both Eric and
Richard, nothing cleaner really emerged. The clean way of doing this is
a *lot* of work for extremely little benefit here.

llvm-svn: 238500
2015-05-28 21:20:14 +00:00
Chandler Carruth c6625c63e7 [omp] Fix a typo in a comment and a line I forgot to clang-format that
Justin pointed out in post-commit review.

llvm-svn: 238498
2015-05-28 21:10:31 +00:00
Benjamin Kramer ddf1cda2c2 [Format] Skip creating temporary std::strings when filling another string.
No functional change intended.

llvm-svn: 238466
2015-05-28 19:55:49 +00:00
David Majnemer c9741603bc [CodeGen] Update a test-case affected by folding IntToPtr/PtrToInt into Loads
Folding IntToPtr or PtrToInt into Loads, due to r238452,
perturbs the mips-varargs test-case.

Patch by Philip Pfaffe!

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

llvm-svn: 238455
2015-05-28 18:51:36 +00:00
Hans Wennborg bb4f962ad6 Get the dll storage class right for structors of classes exported/imported via explicit instantiation (PR23667)
This is a follow-up to r238266. It turned out structors are codegened through a different path,
and didn't get the storage class set in EmitGlobalFunctionDefinition.

llvm-svn: 238443
2015-05-28 17:44:56 +00:00
Ranjeet Singh b90541519e [ARM] Be less specific about the error message expected.
Differential Revision: http://reviews.llvm.org/D10087

llvm-svn: 238436
2015-05-28 15:55:34 +00:00
Renato Golin 33e1f82e5a [ARMTargetParser] FIXME MachO arch names. NFC
llvm-svn: 238435
2015-05-28 15:49:28 +00:00
Renato Golin 3c007259a4 [ARMTargetParser] FIXME on getLLVMArchSuffixForARM. NFC
llvm-svn: 238430
2015-05-28 15:05:53 +00:00
Renato Golin 391544c431 [ARMTargetParser] Removing string parsing from getCPUDefineSuffix. NFC.
Yet another FIXME from ARMTargetParser.

llvm-svn: 238416
2015-05-28 12:11:11 +00:00
Diego Novillo 63b2ad4f71 Fix PPC failure. Adjust CHECK pattern.
llvm-svn: 238413
2015-05-28 11:25:52 +00:00
Daniel Jasper f841d3a6c1 clang-format: Lower binding strengths created by the [] created by ObjC
method expressions and array literals. They should not bind stronger
than regular parentheses or the braces of braced lists.

Specific test case in JavaScript:
Before:
  var aaaaa: List<
      SomeThing> = [new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];

After:
  var aaaaa: List<SomeThing> = [
    new SomeThingAAAAAAAAAAAA(),
    new SomeThingBBBBBBBBB()
  ];

llvm-svn: 238400
2015-05-28 07:21:50 +00:00
David Majnemer ae1ed0edfe [Basic] Define __declspec for cygwin
Cygwin (and MinGW) targets define __declspec to __attribute__ unless
-fms-extensions is specified.  It turns out that cygwin headers rely on
the existence of this macro.

llvm-svn: 238394
2015-05-28 04:36:18 +00:00
Chandler Carruth 9c6b4f8528 [omp] Re-work Clang's handling of -fopenmp and undo r237769.
This isn't an actual revert of r237769, it just restores the behavior of
the Clang driver prior to it while completely re-implementing how that
behavior works.

This also re-does the work of making the default OpenMP runtime
selectable at CMake (or configure) time to work in the way all of our
other such hooks do (config.h, configure and cmake hooks, etc.).

I've re-implemented how we manage the '-fopenmp' flagset in an important
way. Now, the "default" hook just makes '-fopenmp' equivalent to
'-fopenmp=<default>' rather than a separate special beast. Also, there
is an '-fno-openmp' flag which does the obvious thing. Also, the code is
shared between all the places to select a known OpenMP runtime and act
on it.

Finally, and most significantly, I've taught the driver to inspect the
selected runtime when choosing whether to propagate the '-fopenmp' flag
to the frontend in the CC1 commandline. Without this, it isn't possible
to use Clang with libgomp, even if you were happy with the serial,
boring way in which it worked previously (ignoring all #pragmas but
linking in the library to satisfy direct calls into the runtime).

While I'm here, I've gone ahead and sketched out a path for the future
name of LLVM's OpenMP runtime (libomp) and the legacy support for its
current name (libiomp5) in what seems a more reasonable way.

To re-enable LLVM's OpenMP runtime (which I think should wait until the
normal getting started instructions are a reasonable way for falks to
check out, build, and install Clang with the runtime) all that needs to
change is the default string in the CMakeLists.txt and configure.ac
file. No code changes necessary.

I also added a test for the driver's behavior around OpenMP since it was
*completely missing* previously. Makes it unsurprising that we got it
wrong.

llvm-svn: 238389
2015-05-28 01:52:38 +00:00
Ekaterina Romanova 2e81434552 Added doxygen comments for the intrinsics.
llvm-svn: 238386
2015-05-28 01:25:25 +00:00
Richard Trieu 95a192a3ab Update -Winvalid-noreturn to handle destructors better.
When checking if a function is noreturn, consider a codepath to be noreturn if
the path destroys a class and the class destructor, base class destructors, or
member field destructors are marked noreturn.

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

llvm-svn: 238382
2015-05-28 00:14:02 +00:00
Diego Novillo aa8b1cb8a4 Set function entry counts with -fprofile-instr-use.
This generates function entry counts from instrumentation profiles.

llvm-svn: 238360
2015-05-27 21:58:42 +00:00
John Thompson b7892ffc69 It appears these exports are needed, as wmmintrin.h includes them.
llvm-svn: 238345
2015-05-27 18:26:41 +00:00
Renato Golin f05bf0090b ARMTargetParser FIXME getCPUProfile A/R/M
This is the last of the easy ones.

llvm-svn: 238324
2015-05-27 14:15:12 +00:00
Renato Golin f5c4dec750 ARMTargetParser FIXME: ARMv8 detection for hdiv
Avoiding ugly combination of string parsing in the front-end. We still
need to move away from CPU parsing at all, but that's for a different
commit.

llvm-svn: 238318
2015-05-27 13:33:00 +00:00
Daniel Jasper 3e0dcc27d5 clang-format: [JS] Fix incorrect detection of ternary expressions.
A definintion like this could not be formatted at all:
  constructor({aa}: {
    aa?: string,
    aaaaaaaa?: string,
    aaaaaaaaaaaaaaa?: boolean,
    aaaaaa?: List<string>
  }) {
  }

llvm-svn: 238291
2015-05-27 05:37:40 +00:00
Daniel Jasper 3273930d9a clang-format: Fix false positive in function annotation detection.
llvm-svn: 238285
2015-05-27 04:55:47 +00:00
Hans Wennborg 17f9b4469e clang-cl: Handle dll attributes in explicit class template specialization definitions (PR23667)
Previously, we wouldn't call checkDLLAttribute() after the class template
specialization definition if the class template was already instantiated
by an explicit class template specialization declaration.

llvm-svn: 238266
2015-05-27 00:06:45 +00:00
David Majnemer 34568bc602 [MS ABI, DebugInfo] Omit the size for model-less pointers-to-members
The representation of a pointer-to-member in the MS ABI is governed by
the layout of the relevant class or if a model has been explicitly
specified.  If no model is specified, then an appropriate
"worst-case-scenario" model is implicitly chosen if, and only, if the
pointer-to-member type's representation was needed.

Debug info cannot force a pointer-to-member type to have a
representation so do not try to query the size of such a type unless we
know it is safe to do so.

llvm-svn: 238259
2015-05-26 21:54:24 +00:00
David Majnemer 67fa0b85cd [CodeGen] Handle flexible array members containing pointers to members
Types can be classified as being zero-initializable or
non-zero-initializable.  We used to classify array types by giving them
the classification of their base element type.  However, incomplete
array types are never initialized directly and thus are always
zero-initializable.

llvm-svn: 238256
2015-05-26 21:28:50 +00:00
Petar Jovanovic 1a3f965fe3 [MIPS] Re-land the change r238200 to fix extension of integer types
Re-land the change r238200, but with modifications in the tests that should
prevent new failures in some environments as reported with the original
change on the mailing list.

llvm-svn: 238253
2015-05-26 21:07:19 +00:00
Akira Hatanaka 08d70edec2 Remove the code in clang that is using TargetOptions::NoFramePointerElim.
This is the clang side change following r238244.

llvm-svn: 238245
2015-05-26 20:18:26 +00:00
Aaron Ballman a235996d4c Fixing an RST issue to silence a sphinx warning.
llvm-svn: 238241
2015-05-26 19:56:13 +00:00
Aaron Ballman 674cf26892 __declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension.
Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets.
llvm-svn: 238238
2015-05-26 19:44:52 +00:00
Hans Wennborg 74df0df135 Revert r238200: "[MIPS] fix extension of integer types (function calls)"
mips-unsigned-ext-var.c and mips-unsigned-extend.c fail in some builds.

llvm-svn: 238237
2015-05-26 19:39:54 +00:00
Douglas Katzman 9f5e70e3b7 Change final case of Driver::getToolChain to "if/else/else/else..."
Differential Revision: http://reviews.llvm.org/D9939

llvm-svn: 238225
2015-05-26 18:01:33 +00:00
Ranjeet Singh 5b30b0aaae Test commit.
llvm-svn: 238220
2015-05-26 17:30:35 +00:00
Aaron Ballman d6ea91456a Going out on a limb and guessing that someone viewing the 3.7 release notes may instead want to view 3.6 instead of 3.5.
llvm-svn: 238212
2015-05-26 16:12:07 +00:00
Petar Jovanovic 9aa0f1657f [MIPS] fix extension of integer types (function calls)
On MIPS unsigned int type should not be zero extended but sign-extended.

Patch by Strahinja Petrovic.

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

llvm-svn: 238200
2015-05-26 13:30:54 +00:00
Daniel Jasper 0843434e74 clang-format: Guard the bin-packing in braced lists on BinPackArguments
instead of BinPackParameters. Braced lists are used as constructor
calls in many places and so the bin-packing should follow what is done
for other calls and not what is done for function declarations.

llvm-svn: 238184
2015-05-26 07:26:26 +00:00
Daniel Jasper 0805199185 clang-format: [JS] Support ES6 spread operator.
Specifically, don't add a space before it.

Before:
  someFunction(... a);
  var x = [1, 2, ... a];

After:
  someFunction(...a);
  var x = [1, 2, ...a];

llvm-svn: 238183
2015-05-26 07:18:56 +00:00
Daniel Jasper 1a02822704 clang-format: Fix child-formatting in macros.
This fixes a case where the column limit was incorrectly calculated
leading to a macro like this:

  #define A                                       \
    [] {                                          \
      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(        \
          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); \
    }

exceeding the column limit.

llvm-svn: 238182
2015-05-26 07:03:42 +00:00
David Majnemer 7a3ce0c537 [MS ABI] Implement restrict qualified references
MSVC 2015 supports '__restrict' qualified reference types.

llvm-svn: 238166
2015-05-26 01:30:45 +00:00
Kit Barton 5944ee2179 This patch adds support for the vector quadword add/sub instructions introduced
in POWER8.

These are the Clang-related changes for http://reviews.llvm.org/D9081

vadduqm
vaddeuqm
vaddcuq
vaddecuq
vsubuqm
vsubeuqm
vsubcuq
vsubecuq
All builtins are added in altivec.h, and guarded with the POWER8_VECTOR and
powerpc64 macros.



http://reviews.llvm.org/D9903

llvm-svn: 238145
2015-05-25 15:52:45 +00:00
Alexander Musman 6b080fcda5 Bug fix for PR23577 (https://llvm.org/bugs/show_bug.cgi?id=23577#c0).
"1-4" specifiers are returned as numeric constants, not identifiers,
and should be treated as such. Currently pragma handler incorrectly
assumes that they are returned as identifiers.

Patch by Andrey Bokhanko.

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

llvm-svn: 238129
2015-05-25 11:21:20 +00:00
David Majnemer dcecd93196 [Driver] Unbreak hexagon build bots
AddHexagonTargetArgs didn't respect the driver flags by unconditionally
pushing -fno-signed-char.  Instead, add Hexagon handling to
isSignedCharDefault.

llvm-svn: 238106
2015-05-23 19:23:55 +00:00
David Majnemer c3658d2f24 [Driver] Handle -fno-signed-char and -fno-unsigned-char
GCC maps -fno-unsigned-char to -fsigned-char and -fno-signed-char to
-funsigned-char.

llvm-svn: 238105
2015-05-23 18:48:37 +00:00
David Majnemer 7800f1f5aa [Sema] Don't use dyn_cast to detect an AtomicType
An AtomicType might be hidden behind arbitrary levels of typedefs.
getAs<> will reliably walk through the sugar to get the underlying
AtomicType.

This fixes PR23638.

llvm-svn: 238083
2015-05-23 01:32:17 +00:00
Rafael Espindola 992c6fa5db This reverts commit r238064 and r238055.
They depend on a reverted llvm commit.

llvm-svn: 238076
2015-05-23 00:30:33 +00:00
Sanjay Patel 9d084a7ebb add missing include for TargetRecip
llvm-svn: 238064
2015-05-22 22:59:27 +00:00
Justin Bogner cb0829943b CodeGen: Avoid a reserved name and fix the naming style of some arguments. NFC
It's undefined to use reserved names like _Diags. Fix up the other
parameter names to consistently use a modern style while I'm here.

llvm-svn: 238058
2015-05-22 22:16:55 +00:00
Sanjay Patel f5019e60c7 add the -mrecip driver flag and process its options
This is the front-end counterpart to D8982 (LLVM r238051).

The -mrecip option interface is based on maintaining compatibility with gcc:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289

...while adding more functionality (allowing users to specify the number of refinement steps for each
estimate type).

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

llvm-svn: 238055
2015-05-22 21:42:10 +00:00
Rafael Espindola b8a1293e0b Make unique section names the default again.
Using non unique names found a bug in the ICF inplementation in gold:

https://sourceware.org/bugzilla/show_bug.cgi?id=18440

This reverts commit r234143.

llvm-svn: 238048
2015-05-22 20:44:03 +00:00
Renato Golin f6c154d532 Use profile and version parsers from ARMTargetParser
Now that ARMTargetParser can parse profile and version numbers,
use them instead of the local implementation.

llvm-svn: 238037
2015-05-22 18:18:25 +00:00
Diego Novillo e0d289efbd Add clarifying note that sampling-based profiles cannot be used for code coverage.
llvm-svn: 238031
2015-05-22 16:05:07 +00:00
Aaron Ballman 8afcd0a71a Updating the documentation to include an operator! for negative capability support.
llvm-svn: 238020
2015-05-22 13:36:48 +00:00
Szabolcs Sipos b37b0ed239 Adding new AST matcher: isConstexpr
It matches constexpr variable and function declarations.

llvm-svn: 238016
2015-05-22 11:35:50 +00:00
Alexey Bataev 3ae88e2124 [OPENMP] Prepare codegen for privates in tasks for non-capturing of privates in CapturedStmt.
Reworked codegen for privates in tasks:

call @kmpc_omp_task_alloc();
...
call @kmpc_omp_task(task_proxy);

void map_privates(.privates_rec. *privs, type1 ** priv1_ref, ..., typen **privn_ref) {
  *priv1_ref = &privs->private1;
  ...
  *privn_ref = &privs->privaten;
  ret void
}

i32 task_entry(i32 ThreadId, i32 PartId, void* privs, void (void*, ...) map_privates, shareds* captures) {
  type1 **priv1;
  ...
  typen **privn;
  call map_privates(privs, priv1, ..., privn);
  <Task body with priv1, .., privn instead of the captured variables>.
  ret i32
}

i32 task_proxy(i32 ThreadId, kmp_task_t_with_privates *tt) {
  call task_entry(ThreadId, tt->task_data.PartId, &tt->privates, map_privates, tt->task_data.shareds);
}

llvm-svn: 238010
2015-05-22 08:56:35 +00:00
Justin Bogner e8d762e148 Modernize some doc comments. NFC
llvm-svn: 238006
2015-05-22 06:48:13 +00:00
David Majnemer 8d44ac4785 [ItaniumMangle] Fix a typo.
llvm-svn: 238002
2015-05-22 05:54:24 +00:00
David Majnemer ab6607ab09 [Sema] Don't crash on out-of-line virtual constexpr functions
The method wasn't an overrider but didn't have 'virtual' textually
written because our CXXMethodDecl was an out-of-line definition.  Make
sure we use the canonical decl instead.

This fixes PR23629.

llvm-svn: 237999
2015-05-22 05:49:41 +00:00
Faisal Vali 2933621203 Apply existing checks to C++1Z (has_feature_cxx0x); NFC
This applies the existing checks in has_feature_cxx0x to -std=c++1z.
In addition, references to C++1y are updated to refer to C++14

No functional change. Testing of __has_feature for C++1z features
is not added in this change.

Patch by Hubert Tong! 

llvm-svn: 237992
2015-05-22 02:57:28 +00:00
Ahmed Bougacha b55d416ef1 [OpenMP] Test AVX default SIMD alignment. NFC.
llvm-svn: 237991
2015-05-22 02:51:49 +00:00
Ahmed Bougacha 1fca2edc48 [CodeGen] Use TargetInfo::getABI() throughout X86*TargetCodeGenInfo.
We already have the ABI, we don't need a "HasAVX" flag.
This will also makes it easier to add an AVX512 ABI.

No functional change intended.

llvm-svn: 237989
2015-05-22 02:25:58 +00:00
Richard Smith a7bd4582e7 Fix assertion when assigning to object in OpenCL constant address space.
Patch by John Garvin!

llvm-svn: 237983
2015-05-22 01:14:39 +00:00
Faisal Vali 24d59d14ba "This adds -fconcepts-ts as a cc1 option for enabling the
in-progress implementation of the Concepts TS. The recommended feature
test macro __cpp_experimental_concepts is set to 1 (as opposed to
201501) to indicate that the feature is enabled, but the
implementation is incomplete.

The link to the Concepts TS in cxx_status is updated to refer to the
PDTS (N4377). Additional changes related to __has_feature and
__has_extension are to follow in a later change.

Relevant tests include:

test/Lexer/cxx-features.cpp

The test file is updated with testing of the C++14 + Concepts TS mode.
The expected behaviour is the same as that of the C++14 modes except
for the case of __cpp_experimental_concepts."

- Hubert Tong.

Being committed for Hubert (as per his understanding with Richard Smith) as we start work on the concepts-ts following our preliminary strategy session earlier today. 

The patch is tiny and seems quite standard.

Thanks Hubert!

llvm-svn: 237982
2015-05-22 01:11:10 +00:00
Adrian Prantl be81cf570e Debug info: Adapt to new DIBuilder interface.
llvm-svn: 237948
2015-05-21 20:37:26 +00:00
Douglas Gregor 3c523c4a37 Itanium mangler: don't trip an assertion when unresolved members have implicit bases.
When we find a member of the current instantation, the base of the
unresolved member expression is implicit; use nullptr for such
bases. This is not a change in behavior: the AST already contains null
in such cases, so non-asserts builds do the right thing already. Fixes
rdar://problem/21020559.

llvm-svn: 237929
2015-05-21 18:28:18 +00:00
Manuel Klimek 79e06081a3 clang-format: [JS] Better support for fat arrows.
Assigns a token type (TT_JsFatArrow) to => tokens, and uses that to
more easily recognize and format fat arrow functions.
Improves function parsing to better recognize formal parameter
lists and return type declarations.
Recognizes arrow functions and parse function bodies as child blocks.

Patch by Martin Probst.

llvm-svn: 237895
2015-05-21 12:23:34 +00:00
John Brawn 94fd963315 [ARM] Restructure cpu handling in the driver to mostly use the triple
Using the target cpu to determine some behaviour is sprinkled in
several places in the driver, but in almost all the information that
is needed can be found in the triple. Restructure things so that the
triple is used, and the cpu is only used if the exact cpu name is
needed.

Also add a check that the -mcpu argument is valid, and correct the
-march argument checking so that it handles -march=native correctly. I
would have liked to move these checks into the computation of the
triple, but the triple is calculated several times in several places
and that would lead to multiple error messages for the same thing.

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

llvm-svn: 237894
2015-05-21 12:19:49 +00:00
Alexey Bataev 5129d3a4f5 [OPENMP] Fixed codegen for parameters privatization.
For parameters we shall take a derived type of parameters, not the original one.

llvm-svn: 237882
2015-05-21 09:47:46 +00:00
Alexey Bataev 7a228ff439 [OPENMP] Fixed codegen for lastprivate LCV in worksharing constructs.
If loop control variable in a worksharing construct is marked as lastprivate, we should copy last calculated value of private counter back to original variable.

llvm-svn: 237879
2015-05-21 07:59:51 +00:00
Richard Smith e520293c8b Avoid using a C++11 library feature not present in libstdc++4.7.
llvm-svn: 237872
2015-05-21 01:26:53 +00:00
Richard Smith 04765ae01e [modules] If we re-enter a submodule from within itself (when submodule
visibility is enabled) or leave and re-enter it, restore the macro and module
visibility state from last time we were in that submodule.

This allows mutually-#including header files to stand a chance at being
modularized with local visibility enabled.

llvm-svn: 237871
2015-05-21 01:20:10 +00:00
Alexey Samsonov de0aff3e91 [Driver] Improve unused-argument diagnostic for extra sanitizer features.
Don't print unused-argument warning for sanitizer-specific feature flag
if this sanitizer was eanbled, and later disabled in the command line.
For example, now:
  clang -fsanitize=address -fsanitize-coverage=bb -fno-sanitize=address a.cc
doesn't print warning, but
  clang -fsanitize-coverage=bb
does. Same holds for -fsanitize-address-field-padding= and
-fsanitize-memory-track-origins= flags.

Fixes PR23604.

llvm-svn: 237870
2015-05-21 01:07:52 +00:00
Reid Kleckner 012665e16b Rename a helper template function to 'bytes' to avoid a C++17 STL conflict
MSVC 2015 includes the std::data() template function added to C++17. ADL
causes both cl.exe and clang-cl to prefer std::data over our static
helper here, and we get errors about converting int64_t* to StringRef.
Renaming it to bytes avoids the ambiguity.

llvm-svn: 237863
2015-05-21 00:13:09 +00:00
Reid Kleckner b4a26ed58e Work around overloading bug in MSVC 2015
MSVC 2015 appears to be unable to find the correct operator== here. I
haven't yet filed a bug with Microsoft as I've been unable to create a
reduced test case.

llvm-svn: 237862
2015-05-21 00:12:53 +00:00
Richard Trieu cbab79a4f8 Check for bool-like conversion in conditional expressions.
Add a check for bool-like conversions for the condition expression of
conditional operators.  This is similiar to the checking of condition
expressions of if statements, for-loops, while-loops, and do-while loops.
Specificially, this is to fix the problem of assert("message") not triggering
-Wstring-conversion when the assert macro uses a conditional operator.

llvm-svn: 237856
2015-05-20 23:29:18 +00:00
Richard Smith 31d1de2229 [OpenMP] Make default OpenMP library (the one selected with just -fopenmp)
configurable in the CMake build. There shouldn't be any change in default
behavior.

Derived from a patch by Daniel Jasper!

llvm-svn: 237850
2015-05-20 22:48:44 +00:00
Reid Kleckner 892bb0cace Evaluate union cast subexpressions when the cast value is unused
Fixes PR23597.

llvm-svn: 237839
2015-05-20 21:59:25 +00:00
Aaron Ballman 068aa51dae Refactored some common functionality into MaybeParseMicrosoftDeclSpecs; NFC.
llvm-svn: 237835
2015-05-20 20:58:33 +00:00
Ahmed Bougacha 71185aca7e [CodeGen] Check x86_64-arguments.c tests on AVX as well. NFC.
We used to only check the differing tests on AVX, but we might
as well check all of them.

llvm-svn: 237818
2015-05-20 18:39:16 +00:00
Richard Smith fd8b64eea0 [modules] Support merging a parsed default argument with an imported hidden one for non-type and template template parameters too.
llvm-svn: 237815
2015-05-20 18:24:21 +00:00
Richard Smith c7d48d1a16 [modules] Support merging a parsed default function/template argument with an imported but hidden one.
llvm-svn: 237814
2015-05-20 17:50:35 +00:00
Pete Cooper 2f1637ad85 Use Intrinsic::ID instead of unsigned. NFC.
This is after LLVM r237810 which made Function::getIntrinsicID() return an Intrinsic::ID.

llvm-svn: 237811
2015-05-20 17:17:45 +00:00
Justin Bogner 98ceec5725 InstrProf: Change this triple back to %itanium_abi_triple
In my rush to fix the linux bots in r237805, I accidentally committed
a change to the triple. Revert that part.

llvm-svn: 237806
2015-05-20 16:25:35 +00:00
Justin Bogner c49e5aadb9 InstrProf: Remove darwin-specific section names from this test
llvm-svn: 237805
2015-05-20 16:21:26 +00:00
Justin Bogner fb29822bf4 InstrProf: Increment the profile counter for all types of destructor
-fprofile-instr-generate does not emit counter increment intrinsics
for Dtor_Deleting and Dtor_Complete destructors with assigned
counters. This causes unnecessary [-Wprofile-instr-out-of-date]
warnings during profile-use runs even if the source has never been
modified since profile collection.

Patch by Betul Buyukkurt. Thanks!

llvm-svn: 237804
2015-05-20 16:16:23 +00:00
Justin Bogner 1cd11f159e CodeGen: Remove some trailing whitespace. NFC
llvm-svn: 237802
2015-05-20 15:53:59 +00:00
Alexey Bataev d7589ffe1d [OPENMP] Fix codegen for ordered loop directives.
loops with ordered clause must be generated the same way as dynamic loops, but with static scheduleing.

llvm-svn: 237788
2015-05-20 13:12:48 +00:00
Alexey Bataev 15413ea02b [MSVC] Handle out-of-line definition of static data member correctly (fix for http://llvm.org/PR21164), by Alexey Frolov
There are 3 cases of defining static const member:

initialized inside the class, not defined outside the class.
initialized inside the class, defined outside the class.
not initialized inside the class, defined outside the class.
Revision r213304 was supposed to fix the linkage problem of case (1), but mistakenly it made case (2) behave the same.
As a result, out-of-line definition of static data member is not handled correctly.
Proposed patch distinguishes between cases (1) and (2) and allows to properly emit static const members under –fms-compatibility option.

This fixes http://llvm.org/PR21164.
Differential Revision: http://reviews.llvm.org/D9850

llvm-svn: 237787
2015-05-20 11:57:02 +00:00
Manuel Klimek 9eff8b1426 Allow skipping imports in the module visitor.
Skip imports when we know that we do not need to visit any imports
because we've already deserialized the redecls from a module.

llvm-svn: 237782
2015-05-20 10:29:23 +00:00
Michael Kuperstein 7619004211 [X86] Add _mm256_set_m128 and its 5 variants.
Differential Revision: http://reviews.llvm.org/D9855

llvm-svn: 237778
2015-05-20 07:46:52 +00:00
Yaron Keren 627ba89bb1 Fix CGRecordLayouts description to say it maps clang types not llvm types
and de-duplicate data fields names from comments according to the coding
standard.

llvm-svn: 237776
2015-05-20 07:15:28 +00:00
David Majnemer e95f3bd0fd [clang-cl] Map /GA to -ftls-model=local-exec
The /GA switch informs the compiler that it may assume that all TLS
access refers to the executable's index: 0.

llvm-svn: 237771
2015-05-20 04:39:56 +00:00
Alexey Bataev db39021cee [OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified).
Differential Revision: http://reviews.llvm.org/D9736

llvm-svn: 237769
2015-05-20 04:24:19 +00:00
Alexey Bataev 16dc7b68c4 Fix for aggregate copying of variable length arrays.
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes:

<total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested).
If simple copying is requested, size is calculated like:

<total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType).
memcpy() is used with this calculated size of the VLA.
Differential Revision: http://reviews.llvm.org/D9851

llvm-svn: 237768
2015-05-20 03:46:04 +00:00
David Blaikie bf178d3eb7 [opaque pointer type] Pass the explicit call type when creating calls from LazyRuntimeFunctions
The implicit conversion was causing issues for a helper being added that
would take an llvm::Function rather than an llvm::Value to make the
CallInst. Since we'll eventually need to specify the type of the call
explicitly anyway, fix these up to avoid the future ambiguity.

llvm-svn: 237729
2015-05-19 21:31:34 +00:00
Richard Smith 54ef4c3bb3 Revert r237609 for now.
glibc's headers use __need_* macros to selectively export parts of themselves
to each other. This requires us to enter those files repeatedly when building
a glibc module.

This can be unreverted once we have a better mechanism to deal with that
non-modular aspect of glibc (possibly some way to mark a header as "textual if
this macro is defined").

llvm-svn: 237718
2015-05-19 19:58:11 +00:00
Jonathan Roelofs 99bdd98a2b Fix 'CFG graph' typo. NFC
Patch by Jon Eyolfson!

llvm-svn: 237713
2015-05-19 18:51:56 +00:00
Anders Waldenborg b09075a240 clang-format: Add space in function pointers with SpaceBeforeParens=Always
"void (*my_function)(void)" should become "void (*my_function) (void)" when
SpaceBeforeParens is set to 'Always'

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

llvm-svn: 237704
2015-05-19 16:54:26 +00:00
Michael Kuperstein 877f3cbe84 [X86] Add _mm_broadcastsd_pd intrinsic
_mm_broadcastsd_pd is basically an alias for _mm_movedup_pd, however the alias is only available from AVX2 forward.

llvm-svn: 237698
2015-05-19 14:49:14 +00:00
Michael Kuperstein 6168183e04 [X86] Added _mm256_bslli_epi128 and _mm256_bsrli_epi128.
These two intrinsics are alternative names for _mm256_slli_si256 and _mm256_srli_si256, respectively.

llvm-svn: 237693
2015-05-19 13:05:46 +00:00
Alexey Bataev 1d9c15cf18 [OPENMP] Fixed codegen for copying/initialization of array variables/parameters.
This modification generates proper copyin/initialization sequences for array variables/parameters. Before they were considered as pointers, not arrays.

llvm-svn: 237691
2015-05-19 12:31:28 +00:00
Daniel Jasper 9310166a63 clang-format: Improve *-detection.
Before:
  S << a *(10);

After:
  S << a * (10);

This fixes llvm.org/PR16500.

llvm-svn: 237690
2015-05-19 12:29:27 +00:00
Daniel Jasper d6e09e85f9 clang-format: Improve for-loop formatting.
Before:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator I =
           Container.begin(),
                                                          E = Container.end();
       I != E; ++I)

After:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator
           I = Container.begin(),
           E = Container.end();
       I != E; ++I)

This fixes llvm.org/PR23544.

llvm-svn: 237688
2015-05-19 11:51:39 +00:00
Daniel Jasper fa3f8fbed8 clang-format: Support #include_next
Before:
  #include_next < test.h >

After:
  #include_next <test.h>

This fixes llvm.org/PR23500

llvm-svn: 237686
2015-05-19 11:22:29 +00:00
Daniel Jasper f5e5ee6d69 clang-format: Correctly detect casts to qualified types.
Before:
  ns::E f() { return (ns::E) - 1; }

After:
  ns::E f() { return (ns::E)-1; }

This fixes llvm.org/PR23503.

llvm-svn: 237684
2015-05-19 11:18:39 +00:00
Daniel Jasper ed41f774fc clang-format: Fix regression caused by r237244.
Before:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.
          aaaaaaaa];

After:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa
          .aaaaaaaa];

This merely papers over the fact that we aren't parsing ObjC method calls
correctly. Also, the indentation is weird.

llvm-svn: 237681
2015-05-19 11:06:33 +00:00
Alexey Bataev ccb59ec9b5 [OPENMP] Prohibit VLAs in 'private/firstprivate' clauses of 'task' directive.
Currently runtime does not allow to support variably modified types for 'private' and 'firstprivate' clauses in 'task' directives.

llvm-svn: 237674
2015-05-19 08:44:56 +00:00
Alexey Bataev 7a3e5853df [OPENMP] Prohibit variably modified types in 'copyprivate' clause.
Runtime does not allow to work with VLAs in copyprivate clause.

llvm-svn: 237672
2015-05-19 08:19:24 +00:00
Alexey Bataev f120c0d6f2 [OPENMP] Fixed analysis of function arguments and their data sharing attributes.
Added proper analysis for types of function arguments.

llvm-svn: 237670
2015-05-19 07:46:42 +00:00
NAKAMURA Takumi 4bd67d8f46 SemaExprCXX.cpp: Try to fix \param in r237608. [-Wdocumentation]
llvm-svn: 237668
2015-05-19 06:47:23 +00:00
Richard Smith 86dec39c0a PR20073: promote "dereference of 'void*'" from Extension to ExtWarn.
llvm-svn: 237652
2015-05-19 01:41:12 +00:00
David Majnemer fa7bc78e0a [AST] Put VarDeclBitfields on a diet
VarDeclBitfields contained bits which are never present in parameters.
Split these out so that ParmVarDeclBitfields wouldn't grow past 32-bits
if another field was added.

llvm-svn: 237648
2015-05-19 00:57:16 +00:00
Richard Smith 82e57fb1e8 [modules] Support for merging a parsed definition of a static data member of a class template into an imported but hidden definition.
llvm-svn: 237647
2015-05-19 00:49:29 +00:00
David Blaikie 7d9e79249d Fix indentation
llvm-svn: 237631
2015-05-18 22:51:39 +00:00
Reid Kleckner ac385068f9 Revert changes to DefaultABIInfo accidentally introduced in r208733
Also add trivial handling of transparent unions.

PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This
should worry you, because DefaultABIInfo is not implementing the rules
of any particular ABI.

Fixes PR23097, patch by Andy Gibbs.

llvm-svn: 237630
2015-05-18 22:46:30 +00:00
David Blaikie 43f9bb7371 API update for streamlining of IRBuilder::CreateCall to just use ArrayRef/initializer_list+braced init
llvm-svn: 237625
2015-05-18 22:14:03 +00:00
Ismail Pazarbasi 8904d6bb17 Added missing 'override' to `ReadMismatchingDeleteExpressions`
llvm-svn: 237613
2015-05-18 20:46:12 +00:00
Richard Smith c7e6ff02d5 [modules] Support for merging a parsed class template specialization definition into an imported but hidden definition.
llvm-svn: 237612
2015-05-18 20:36:47 +00:00
Richard Trieu db36469554 Create new diagnostic group -Wmove
-Wmove includes the three existing warnings for std::move calls, self move,
reduntant move, and pessimizing move.  -Wmove is included in -Wmost, so that
it can be discoverable to people using that or -Wall.

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

llvm-svn: 237610
2015-05-18 20:25:44 +00:00
Richard Smith 2d4a11fba6 [modules] When a file is listed as a non-textual header in a module map, don't
enter it more than once, even if it doesn't have #include guards -- we already
know that it is intended to have the same effect every time it's included, and
it's already had that effect. This particularly helps with local submodule
visibility builds, where the include guard macro may not be visible in the
includer, but will become visible the moment we enter the included file.

llvm-svn: 237609
2015-05-18 20:02:41 +00:00
Ismail Pazarbasi e5768d1717 Detect uses of mismatching forms of 'new' and 'delete'
Emit warning when operand to `delete` is allocated with `new[]` or
operand to `delete[]` is allocated with `new`.

rev 2 update:
`getNewExprFromInitListOrExpr` should return `dyn_cast_or_null`
instead of `dyn_cast`, since `E` might be null.

Reviewers: rtrieu, jordan_rose, rsmith

Subscribers: majnemer, cfe-commits

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

llvm-svn: 237608
2015-05-18 19:59:11 +00:00
Richard Trieu 1d4911bc99 Have -Wredundant-move ignore reference types.
Don't give a warning when the type being moved is a reference type.  Also
uncomment two lines in the test case.

llvm-svn: 237607
2015-05-18 19:54:08 +00:00
Daniel Jasper 3c883d1dcc clang-format: Fix another regression caused by r237565.
Before:
  class C : test {
    class D : test{void f(){int i{2};
  }
  }
  ;
  }
  ;

After:
  class C : test {
    class D : test {
      void f() { int i{2}; }
    };
  };

llvm-svn: 237569
2015-05-18 14:49:19 +00:00
Daniel Jasper cec9ffd2a2 clang-format: Fix regression introduced by r237565.
Before:
  class C : public D {
    SomeClass SC { 2 };
  };

After:
  class C : public D {
    SomeClass SC{2};
  };

llvm-svn: 237568
2015-05-18 14:12:24 +00:00
Daniel Jasper 47bbda0939 clang-format: Improve detection of macros annotating functions.
Before:
  ASSERT("aaaaaaaaaaaaaaa")
      << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

After:
  ASSERT("aaaaaaaaaaaaaaa") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                            << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

Also cleanup implementation a bit and only mark closing parenthesis of
these annotations.

llvm-svn: 237567
2015-05-18 13:47:23 +00:00
Daniel Jasper adba2aadf2 clang-format: Allow braced initializers in template arguments of class
specializations.

Before:
  template <class T>
      struct S < std::is_arithmetic<T> {
  } > {};

After:
  template <class T> struct S<std::is_arithmetic<T>{}> {};

llvm-svn: 237565
2015-05-18 12:52:00 +00:00
Daniel Jasper f090f031bc clang-format: Support function annotations in macros.
Before:
  DEPRECATED("Use NewClass::NewFunction instead.") string
      OldFunction(const string &parameter) {}

After:
  DEPRECATED("Use NewClass::NewFunction instead.")
  string OldFunction(const string &parameter) {}

llvm-svn: 237562
2015-05-18 09:47:22 +00:00
Alexey Bataev 8fc69dcf42 [OPENMP] Fix for '#pragma omp task' codegen.
Internal task structure must be generated like
typedef struct kmp_task {
  void *              shareds;
  kmp_routine_entry_t routine;
  kmp_int32           part_id;
  kmp_routine_entry_t destructors;
} kmp_task_t;

struct kmp_task_t_with_privates {
  kmp_task_t task_data;
  .kmp_private. privates;
};
to avoid possible additional alignment bytes in first fields (shareds, routine, part_id and destructors). Runtime library is not aware of such kind additional alignment bytes.

llvm-svn: 237561
2015-05-18 07:54:53 +00:00
Richard Smith bca31b731b [modules] Move implicit creation of ImportDecls for #includes transformed into module imports from the frontend into Sema where it belongs.
llvm-svn: 237555
2015-05-18 05:35:52 +00:00
David Majnemer 8db9176d68 [clang-cl] Enable C++14 when targeting 2015 compatibility
llvm-svn: 237553
2015-05-18 04:49:30 +00:00
Richard Smith 63b6fcef96 [modules] Refactor and simplify #include handling.
Fix a tiny bug where we'd try to load a module file for the module we're in
the middle of building.

llvm-svn: 237552
2015-05-18 04:45:41 +00:00
NAKAMURA Takumi 74a0022fde clang/test/CodeGenOpenCL/opencl_types.cl: Tweak expressions according to r237548.
With MS mangler, the signature is:

  x86: define void @"\01?bad1@@$$J0YAXPAPAUocl_image1d@@PAPAUocl_image2d@@1@Z"  (%opencl.image1d_t** %b, %opencl.image2d_t** %c, %opencl.image2d_t** %d) nounwind
  x64: define void @"\01?bad1@@$$J0YAXPEAPAUocl_image1d@@PEAPAUocl_image2d@@1@Z"(%opencl.image1d_t** %b, %opencl.image2d_t** %c, %opencl.image2d_t** %d) nounwind

llvm-svn: 237551
2015-05-18 03:58:27 +00:00
Richard Smith a0aafa3853 [modules] If we see a #include that maps to a module, but use of precompiled modules is disabled, track submodule visibility anyway if -fmodules-local-submodule-visibility is enabled. This, in effect, gives modules semantics but without precompilation.
llvm-svn: 237550
2015-05-18 03:52:30 +00:00
Nico Weber effdb198c2 Wrap to 80 columns. No behavior change.
llvm-svn: 237549
2015-05-18 02:41:17 +00:00
David Majnemer 5a7cfea6b4 [MS ABI] Give __attribute__((overloadable)) functions pretty names
It turns out that there is a mangling for 'extern "C"', it's only used
by MSVC in /clr mode.  Co-opt this mangling so that extern "C" functions
marked overloadable get demangled nicely.

llvm-svn: 237548
2015-05-18 00:05:29 +00:00
David Majnemer ab4b4a1968 [MS ABI] Function encodings are always encoded in template arguments
llvm-svn: 237547
2015-05-18 00:05:25 +00:00
Nico Weber 5fb3a4277a Fix confusing indent. No behavior change.
llvm-svn: 237546
2015-05-18 00:00:29 +00:00
Daniel Jasper 0928553eec clang-format: Properly align ObjC string literals.
Before:
  NSString s = @"a"
               "b"
               "c";
  NSString s = @"a"
               @"b"
                @"c";

After:
  NSString s = @"a"
                "b"
                "c";
  NSString s = @"a"
               @"b"
               @"c";

This fixes llvm.org/PR23536.

llvm-svn: 237538
2015-05-17 08:13:23 +00:00
Daniel Jasper 2fd16632bc clang-format: Improve line wrapping around << operators.
Generally, clang-format tries to keep label-value pairs on a single
line for stream operators. However, we should not do that if there is
just a single such pair, as that doesn't help much.

Before:
  llvm::errs() << "aaaaaaaaaaaa: " << aaaaaaa(aaaaaaaaa,
                                              aaaaaaaaa);

After:
  llvm::errs() << "aaaaaaaaaaaa: "
               << aaaaaaa(aaaaaaaaa, aaaaaaaaa);

Also remove old test case that was testing actual behavior any more.

llvm-svn: 237535
2015-05-17 07:27:09 +00:00
Davide Italiano 24e89664cd [Sema] Improve llvm_unreachable() message.
llvm-svn: 237532
2015-05-17 02:27:10 +00:00
Nico Weber 28e0f243cf Don't leak TemplateIds when a plugin parses late-parsed templates at TU end.
In -fdelayed-template-parsing mode, templates that aren't used are not parsed
at all.  For some diagnostic plugins, this is a problem since they want to
analyse the contents of the template function body.  What has been suggested
on cfe-dev [1] is to explicitly parse interesting templates in
HandleTranslationUnit(); IWYU does this for example [2].

This is workable, but since the delayed parsing doesn't run below a call to
ParseTopLevelDecl(), no DestroyTemplateIdAnnotationsRAIIObj object is on the
stack to clean up TemplateIds that are created during parsing.  To fix this,
let ~Parser() clean them up in delayed template parsing mode instead of
leaking (or asserting in +Assert builds).

(r219810, relanded in r220400, fixed the same problem in incremental processing
mode; the review thread of r219810 has a good discussion of the problem.)

To test this, give the PrintFunctionNames plugin a flag to force parsing
of a template and add a test that uses it in -fdelayed-template-parsing mode.
Without the Parser.cpp change, that test asserts.

1: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-August/038415.html
2: https://code.google.com/p/include-what-you-use/source/detail?r=566 
llvm-svn: 237531
2015-05-17 01:07:16 +00:00
Nico Weber d73258a029 Wrap a few comments to 80 columns.
llvm-svn: 237529
2015-05-16 23:49:53 +00:00
Benjamin Kramer b4569fb51f [Sema] Fold array into for-range loop. No functional change intended.
llvm-svn: 237525
2015-05-16 16:16:31 +00:00
Richard Smith 2b63d15f49 [modules] Retain the name as written for umbrella headers and directories, rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require.
llvm-svn: 237508
2015-05-16 02:28:53 +00:00
Richard Trieu d3967635bc Fix typo from r237482. "to reference of type" --> "to reference to type"
llvm-svn: 237507
2015-05-16 01:39:39 +00:00
Richard Trieu f956a49e6d When emitting a dropped qualifier error, show which qualifiers are dropped.
llvm-svn: 237505
2015-05-16 01:27:03 +00:00
Bill Schmidt 41e14c4dfa [PPC64] Add vector pack/unpack support from ISA 2.07
This patch adds support for the following new instructions in the
Power ISA 2.07:

  vpksdss
  vpksdus
  vpkudus
  vpkudum
  vupkhsw
  vupklsw

These instructions are available through the vec_packs, vec_packsu,
vec_unpackh, and vec_unpackl built-in interfaces.  These are
lane-sensitive instructions, so the built-ins have different
implementations for big- and little-endian, and the instructions must
be marked as killing the vector swap optimization for now.

The first three instructions perform saturating pack operations.  The
fourth performs a modulo pack operation, which means it can be
represented with a vector shuffle, and conversely the appropriate
vector shuffles may cause this instruction to be generated.  The other
instructions are only generated via built-in support for now.

I noticed during patch preparation that the macro __VSX__ was not
previously predefined when the power8-vector or direct-move features
are requested.  This is an error, and I've corrected that here as
well.

Appropriate tests have been added.

There is a companion patch to llvm for the rest of this support.

llvm-svn: 237500
2015-05-16 01:02:25 +00:00
NAKAMURA Takumi e712f0a183 clang/test/SemaCXX/attr-no-sanitize.cpp: Don't mix stdout and stderr for FileCheck.
MSVCRT's stdio doesn't do line buffering.

llvm-svn: 237492
2015-05-16 00:09:39 +00:00
Richard Trieu 0ff51f39de Reverse the order of types in the reference dropping qualifiers error.
The error has the form ... 'int' ... 'const int' ... dropped qualifiers.  At
first glance, it appears that the const qualifier is added.  Reverse the types
so that the second type is less qualified than the first.

llvm-svn: 237482
2015-05-15 22:07:49 +00:00
Peter Collingbourne 9441094249 Use llvm::StringSwitch<std::string> to take advantage of implicit asserting conversion to std::string.
llvm-svn: 237475
2015-05-15 20:11:18 +00:00
Richard Smith 4241314164 [modules] Add local submodule visibility support for declarations.
With this change, enabling -fmodules-local-submodule-visibility results in name
visibility rules being applied to submodules of the current module in addition
to imported modules (that is, names no longer "leak" between submodules of the
same top-level module). This also makes it much safer to textually include a
non-modular library into a module: each submodule that textually includes that
library will get its own "copy" of that library, and so the library becomes
visible no matter which including submodule you import.

llvm-svn: 237473
2015-05-15 20:05:43 +00:00
Peter Collingbourne 915df9968b Implement no_sanitize attribute.
Differential Revision: http://reviews.llvm.org/D9631

llvm-svn: 237463
2015-05-15 18:33:32 +00:00
NAKAMURA Takumi d16af5dfda CGAtomic.cpp: Fix bogus \brief(s). Did you mean "\param"? [-Wdocumentation]
llvm-svn: 237447
2015-05-15 13:47:52 +00:00
Serge Pavlov e7ad831241 Limit set of types instantiated in FindInstantiatedDecl.
Starting from r236426 FindInstantiatedDecl may instantiate types that
are referenced before definition. This change limit the set of types
that can be instantiated by this function.

llvm-svn: 237434
2015-05-15 10:10:28 +00:00
Daniel Jasper 3ca283ada3 clang-format: Slightly change format decisions around macro annotations.
Before:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      GUARDED_BY(aaaaaaaaaaaa) = aaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa) =
      aaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 237430
2015-05-15 09:58:11 +00:00
Daniel Jasper 731dde91db clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes more
confusion than it's worth.

llvm-svn: 237427
2015-05-15 09:41:59 +00:00
Daniel Jasper cdb58b2e45 clang-format: Add missing space before ObjC selector.
Before:
  [self aaaaa:(1 + 2)bbbbb:3];

After:
  [self aaaaa:(1 + 2) bbbbb:3];

llvm-svn: 237424
2015-05-15 09:05:31 +00:00
Alexey Bataev f0ab553fea [OPENMP] Fixed bug in atomic update/capture/write constructs.
Fixed a bug with codegen for destination atomic l-value with padding and junk in this padding bytes.

llvm-svn: 237422
2015-05-15 08:36:34 +00:00
NAKAMURA Takumi 1a6756bba0 Revert r237385, "[CodeGen] Reuse stack space from unused function results"
It broke clang stage2, at least tblgen.

llvm-svn: 237418
2015-05-15 03:49:05 +00:00
Richard Smith 4caa449ade Refactor: when exposing a definition in some module, provide listeners with the
module rather than requiring them to work it out themselves.

llvm-svn: 237416
2015-05-15 02:34:32 +00:00
Pirama Arumuga Nainar e9bcddd5cb Add flag to enable native half type
Summary:
r235215 enables support in LLVM for legalizing f16 type in the IR.  AArch64
already had support for this.  r235215 and some backend patches brought support
for ARM, X86, X86-64, Mips and Mips64.

This change exposes the LangOption 'NativeHalfType' in the command line, so the
backend legalization can be used if desired.  NativeHalfType is enabled for
OpenCL (current behavior) or if '-fnative-half-type' is set.

Reviewers: olista01, steven_wu, ab

Subscribers: cfe-commits, srhines, aemerson

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

llvm-svn: 237406
2015-05-14 23:44:18 +00:00
David Blaikie f0f00dc33b Fix Clang -Wsequence-point
llvm-svn: 237401
2015-05-14 22:47:19 +00:00
Justin Bogner 682bfbf35f InstrProf: Only disable coverage in built-in macros, not all system macros
The issue I was trying to solve in r236547 was about built-in macros,
but I disabled coverage in all system macros. This is actually a bit
of overkill, and makes the display of coverage around system macros
degrade unnecessarily. Instead, limit this to builtins specifically.

llvm-svn: 237397
2015-05-14 22:14:10 +00:00
Ted Kremenek c004b4d3a1 Tweak availability checking to look through typedef declarations.
llvm-svn: 237396
2015-05-14 22:07:25 +00:00
Diego Novillo c324b92c35 Revert "Detect uses of mismatching forms of 'new' and 'delete'"
This reverts commit 742dc9b6c9686ab52860b7da39c3a126d8a97fbc.

This is generating multiple segfaults in our internal builds.
Test case coming up shortly.

llvm-svn: 237391
2015-05-14 20:57:48 +00:00
Nemanja Ivanovic e97e111af4 Testing for the fix for bug 23429.
Follow-up to commit for revision 236848.
Just a test case for the macro definition under the right CPU/Arch.
One combination was actually missed in the initial fix:
  - powerpc64-unknown-unknown -mcpu=pwr8 (rather than -mcpu=power8).

llvm-svn: 237386
2015-05-14 20:02:24 +00:00
Sergey Dmitrouk 3e96fc08da [CodeGen] Reuse stack space from unused function results
Summary:
Space on stack allocated for unused structures returned by functions was unused
even when it's lifetime didn't intersect with lifetime of any other objects that
could use the same space.

The test added also checks for named and auto objects.  It seems to make sense
to have this all in one place.

Reviewers: aadg, rsmith, rjmccall, rnk

Reviewed By: rnk

Subscribers: asl, cfe-commits

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

llvm-svn: 237385
2015-05-14 19:58:03 +00:00
Richard Smith a462b4c9ac DR295: cv-qualifiers on function types are ignored in C++.
llvm-svn: 237383
2015-05-14 19:10:42 +00:00
Richard Smith 2d5814c2d4 Update cxx_dr_status to latest issues list.
llvm-svn: 237382
2015-05-14 19:07:47 +00:00
Ikhlas Ajbar 03404c14fe Remove unused function HasPICArg().
llvm-svn: 237374
2015-05-14 17:42:20 +00:00
Vladimir Sukharev 85a19e92d7 [ARM] Fix of architecture naming typo
Inspired by James Greenhalgh's catch

Subscribers: cfe-commits

Relates to: http://reviews.llvm.org/rL237349

llvm-svn: 237370
2015-05-14 16:39:01 +00:00
Ismail Pazarbasi 538ef53c13 Detect uses of mismatching forms of 'new' and 'delete'
Emit warning when operand to `delete` is allocated with `new[]` or
operand to `delete[]` is allocated with `new`.

Reviewers: rtrieu, jordan_rose, rsmith

Subscribers: majnemer, cfe-commits

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

llvm-svn: 237368
2015-05-14 16:14:57 +00:00
Ikhlas Ajbar 522e6196f7 Factor out SmallDataThreshold
This patch factors out SmallDataThreshold code.

llvm-svn: 237364
2015-05-14 13:52:08 +00:00
Vladimir Sukharev c6dab75bd4 [ARM] Add v8.1a architecture
Add support for ARMv8.1a 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, rengolin

Subscribers: cfe-commits

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

llvm-svn: 237349
2015-05-14 08:25:18 +00:00
Kevin Qin 78b8653a84 [AArch64 ACLE] Allow to define poly64_t as 'unsigned long long' on LLP64 system.
This fixes PR23414 as well.

llvm-svn: 237348
2015-05-14 08:18:05 +00:00
NAKAMURA Takumi 55deb26613 clang/test/Frontend/dependency-gen-escaping.c: Appease win32 hosts. Investigating.
FIXME: Do we really emit single \ or escaped \\ along the context with -fms-compatibility -MG?
llvm-svn: 237347
2015-05-14 07:37:35 +00:00
Yaron Keren 129dfbff4a Revert r237339 as sanitizer-ppc64-linux1 does not like it.
Complains:

/home/buildbots/sanitizerslave1/sanitizer-ppc64-1/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:829:30: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
                     I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm not sure now how this should be fixed. %lld is non-standard
and not accepted by mingw on Windows while PRId64 is bad for this bot.

Is long long longer than 64 bits here? if not, why is PRId64
incompatible with it? something seems wrong.

Probably all the datatypes should be replaced to unsigned or uint64_t
depending upin requirements instead of the non standard long long.

llvm-svn: 237346
2015-05-14 06:53:31 +00:00
David Majnemer 02ddd7f529 [MS ABI] Add support for /Zc:sizedDealloc
llvm-svn: 237344
2015-05-14 05:55:00 +00:00
Yaron Keren e7aad46665 Replace non-standard %lld printf usage with PRId64.
See also r180024.

llvm-svn: 237339
2015-05-14 05:40:50 +00:00
David Majnemer a84a082384 Fix buildbots
llvm-svn: 237338
2015-05-14 05:24:59 +00:00
David Majnemer 1b5baffd73 [MS ABI] __declspec(thread) behaves like thread_local in MSVC 2015
MSVC 2015 changed __declspec(thread) to make it behave like C++11's
thread_local keyword instead of acting similarly to __thread.

llvm-svn: 237337
2015-05-14 05:19:23 +00:00
David Majnemer dd0bed1b2d [AST] hasAttr followed by getAttr isn't efficient
Just use getAttr because we are interested in the attribute's contents.

llvm-svn: 237336
2015-05-14 05:19:20 +00:00
David Majnemer 87b853c5f0 [clang-cl] Add /Qvec and /Qvec- to control vectorization
llvm-svn: 237335
2015-05-14 05:19:17 +00:00
NAKAMURA Takumi 01477e5d6a clang/test/Frontend/dependency-gen-escaping.c: Tweak r237296, to let '/' and '\\' distinguishd, to unbreak "--host=linux --target=msvc".
llvm-svn: 237333
2015-05-14 04:25:54 +00:00
Richard Smith 31d5184dc5 Generalize future keyword compat diagnostics.
This, in preparation for the introduction of more new keywords in the
implementation of the C++ language, generalizes the support for future keyword
compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the
applicability of the relevant property in IdentifierTable with appropriate
renaming.

Patch by Hubert Tong!

llvm-svn: 237332
2015-05-14 04:00:59 +00:00