Commit Graph

58496 Commits

Author SHA1 Message Date
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