Commit Graph

45289 Commits

Author SHA1 Message Date
Justin Lebar 281ce2af17 [CUDA] Allow extern __shared__ on empty-length arrays.
"extern __shared__ int x[]" is OK.

llvm-svn: 283068
2016-10-02 15:24:50 +00:00
Gor Nishanov 4ffb434ca8 [coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts
Summary:
Also makes -fcoroutines_ts to be both a Driver and CC1 flag.

Patch mostly by EricWF.

Reviewers: rnk, cfe-commits, rsmith, EricWF

Subscribers: mehdi_amini

Differential Revision: https://reviews.llvm.org/D25130

llvm-svn: 283064
2016-10-02 03:31:58 +00:00
Aditya Kumar e84372b039 Alias must point to a definition
Reapplying the patch after modifying the test case.

Inlining the destructor caused the compiler to generate bad IR which failed the Verifier in the backend.
https://llvm.org/bugs/show_bug.cgi?id=30341

This patch disables alias to available_externally definitions.

Reviewers: eugenis, rsmith

Differential Revision: https://reviews.llvm.org/D24682

llvm-svn: 283063
2016-10-02 03:06:36 +00:00
Hal Finkel 415c2a38f2 [PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-float
Enable soft-float support on PPC64, as the backend now supports it. Also, the
backend now uses -hard-float instead of +soft-float, so set the target features
accordingly.

Fixes PR26970.

llvm-svn: 283061
2016-10-02 02:10:45 +00:00
Craig Topper 7609f1c269 [AVX-512] Check rounding mode for builtins that take one. Rounding mode should be either _MM_FROUND_CUR_DIRECTION or a 2-bit rounding mode ORed with _MM_FROUND_NO_EXC.
llvm-svn: 283054
2016-10-01 21:03:50 +00:00
Mehdi Amini 99d1b29503 Use StringRef for MemoryBuffer identifier API (NFC)
llvm-svn: 283043
2016-10-01 16:38:28 +00:00
Mehdi Amini 7410717a62 Use StringRef in Registry API (NFC)
llvm-svn: 283039
2016-10-01 15:44:54 +00:00
Mehdi Amini 117296c0a0 Use StringRef in Pass/PassManager APIs (NFC)
llvm-svn: 283004
2016-10-01 02:56:57 +00:00
Mehdi Amini b7fb124512 Use StringRef in Triple API (NFC)
llvm-svn: 282996
2016-10-01 01:16:22 +00:00
Justin Lebar 9d4ed262ef [CUDA] Harmonize asserts in SemaCUDA, NFC.
llvm-svn: 282987
2016-09-30 23:57:38 +00:00
Justin Lebar e71b2fa4c9 [CUDA] Disallow __constant__ local variables.
Reviewers: tra, rnk

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25129

llvm-svn: 282986
2016-09-30 23:57:34 +00:00
Justin Lebar 1041101953 [CUDA] Disallow 'extern __shared__' variables.
Also add a test that we disallow

  __constant__ __shared__ int x;

because it's possible to break this without breaking

  __shared__ __constant__ int x;

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25125

llvm-svn: 282985
2016-09-30 23:57:30 +00:00
Richard Smith 360cb2570e Fix bogus "inline namespace cannot be reopened as non-inline" diagnostic to
just warn that the second declaration is missing the 'inline' keyword. This is
valid, and we shouldn't be suggesting otherwise.

llvm-svn: 282981
2016-09-30 23:16:08 +00:00
Saleem Abdulrasool 8dbaf5cb4d CodeGen: inherit DLLExport attribute in Windows Itanium
When emitting the fundamental type information constants, inherit the
DLLExportAttr from `__fundamental_type_info`.  We would previously not
honor the `__declspec(dllexport)` on the type information.

llvm-svn: 282980
2016-09-30 23:11:05 +00:00
Richard Smith 591390284f P0035R4: add predefined __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro. By default, we
assume that ::operator new provides no more alignment than is necessary for any
primitive type, except when we're on a GNU OS, where glibc's malloc guarantees
to provide 64-bit alignment on 32-bit systems and 128-bit alignment on 64-bit
systems. This can be controlled by the command-line -fnew-alignment flag.

llvm-svn: 282974
2016-09-30 22:41:36 +00:00
Eric Fiselier 7d5773e610 [coroutines] Diagnose when 'main' is declared as a coroutine.
Summary: The title says it all.

Reviewers: rsmith, GorNishanov

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D25078

llvm-svn: 282973
2016-09-30 22:38:31 +00:00
Bruno Cardoso Lopes c08cd4e20b [Sema] Support lax conversions for compound assignments
Support lax convertions on compound assignment expressions like:

  typedef __attribute__((vector_size(8))) double float64x1_t;
  typedef __attribute__((vector_size(16))) double float64x2_t;
  float64x1_t vget_low_f64(float64x2_t __p0);

  double c = 3.0;
  float64x2_t v = {0.0, 1.0};
  c += vget_low_f64(v);

This restores one more valid behavior pre r266366, and is a incremental
follow up from work committed in r274646.

While here, make the check more strict, add FIXMEs, clean up variable
names to match what they can actually be and update testcases to reflect
that. We now reject:

  typedef float float2 __attribute__ ((vector_size (8)));
  double d;
  f2 += d;

which doesn't fit as a direct bitcast anyway.

Differential Revision: https://reviews.llvm.org/D24472

rdar://problem/28033929

llvm-svn: 282968
2016-09-30 22:19:38 +00:00
Alexander Shaposhnikov 6237a21d8c Add missing std::move in Replacements::add
This diff adds std::move to avoid copying of 
the Replacement NewR in the method Replacements::add.

Test plan: make -j8 check-all

Differential revision: https://reviews.llvm.org/D25049

llvm-svn: 282949
2016-09-30 21:05:45 +00:00
Justin Lebar 7a406e78b3 [CUDA] Remove incorrect comment in CUDASetLambdaAttrs.
I'd said that nvcc doesn't allow you to add __host__ or __device__
attributes on lambdas in all circumstances, but I believe this was user
error on my part.  I can't reproduce these warnings/errors if I pass
--expt-extended-lambda to nvcc.

llvm-svn: 282912
2016-09-30 19:55:59 +00:00
Justin Lebar e46ea72d97 [CUDA] Emit a warning if a CUDA host/device/global attribute is placed after '(...)'.
Summary:
This is probably the sane place for the attribute to go, but nvcc
specifically rejects it.  Other GNU-style attributes are allowed in this
position (although judging from the warning it emits for
host/device/global, those attributes are applied to the lambda's
anonymous struct, not to the function itself).

It would be nice to have a FixIt message here, but doing so, or even
just getting the correct range for the attribute, including its '((' and
'))'s, is apparently Hard.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25115

llvm-svn: 282911
2016-09-30 19:55:55 +00:00
Justin Lebar 0139a5dcac [CUDA] Fix up MaybeParseGNUAttributes call used for out-of-place attributes on CUDA lambdas.
Summary: There's an overload that we can use to make this a bit cleaner.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25114

llvm-svn: 282910
2016-09-30 19:55:48 +00:00
Martin Storsjo ed95a08ea4 [MS] Implement __iso_volatile loads/stores as builtins
These are supposed to produce the same as normal volatile
pointer loads/stores. When -volatile:ms is specified,
normal volatile pointers are forced to have atomic semantics
(as is the default on x86 in MSVC mode). In that case,
these builtins should still produce non-atomic volatile
loads/stores without acquire/release semantics, which
the new test verifies.

These are only available on ARM (and on AArch64,
although clang doesn't support AArch64/Windows yet).

This implements what is missing for PR30394, making it possible
to compile C++ for ARM in MSVC mode with MSVC headers.

Differential Revision: https://reviews.llvm.org/D24986

llvm-svn: 282900
2016-09-30 19:13:46 +00:00
Justin Lebar 7ca116cacf [CUDA] Make lambdas inherit __host__ and __device__ attributes from the scope in which they're created.
Summary: NVCC compat.  Fixes bug 30567.

Reviewers: tra

Subscribers: cfe-commits, rnk

Differential Revision: https://reviews.llvm.org/D25105

llvm-svn: 282880
2016-09-30 17:14:53 +00:00
Justin Lebar 0fad0ba6a9 [CUDA] Handle attributes on CUDA lambdas appearing between [...] and (...).
Summary: This is ugh, but it makes us compatible with NVCC.  Fixes bug 26341.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25103

llvm-svn: 282879
2016-09-30 17:14:48 +00:00
Samuel Antao 64e965e4ee [CUDA][OpenMP] Add a generic offload action builder
Summary:
This patch proposes a new class to generate and record action dependences related with offloading. The builder provides three main functionalities:
- Add device dependences to host actions.
- Add host dependence to device actions.
- Register device top-level actions.

The constructor of the builder detect the programming models that should be supported, and generates a specialized builder for each. If a new programming model is to be added in the future, only a new specialized builder has to be implemented. 

When the specialized builder is generated, it produces programming-model-specific diagnostics.

A CUDA specialized builder is proposed in the patch that mostly consists of the partition of the current  `buildCudaAction` by the three different functionalities.

Reviewers: tra, echristo, ABataev, jlebar, hfinkel

Subscribers: Hahnfeld, whchung, guansong, jlebar, mehdi_amini, andreybokhanko, tcramer, mkuron, cfe-commits, arpith-jacob, carlo.bertolli, caomhin

Differential Revision: https://reviews.llvm.org/D18172

llvm-svn: 282865
2016-09-30 15:34:19 +00:00
Simon Pilgrim 75c2688a96 Strip trailing whitespace (NFCI)
llvm-svn: 282858
2016-09-30 14:25:09 +00:00
Simon Pilgrim d69fc8ea02 Fix int <= bool comparison warning on MSVC
llvm-svn: 282857
2016-09-30 14:18:06 +00:00
Victor Leschuk b3e7d68d5c Cosmetic fix: deleted unnecessary line break in comment.
llvm-svn: 282846
2016-09-30 06:39:48 +00:00
Justin Lebar 9091055efa Move UTF functions into namespace llvm.
Summary:
This lets people link against LLVM and their own version of the UTF
library.

I determined this only affects llvm, clang, lld, and lldb by running

$ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq
  clang
  lld
  lldb
  llvm

Tested with

  ninja lldb
  ninja check-clang check-llvm check-lld

(ninja check-lldb doesn't complete for me with or without this patch.)

Reviewers: rnk

Subscribers: klimek, beanz, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D24996

llvm-svn: 282822
2016-09-30 00:38:45 +00:00
Richard Smith 96269c59ea P0035R4: add std::align_val_t overloads of operator new/delete in C++17 mode.
llvm-svn: 282800
2016-09-29 22:49:46 +00:00
Eric Fiselier a546528d7b [Coroutines] Fix assertion about uncorrected typos in co_await/co_yield/co_return expressions
llvm-svn: 282792
2016-09-29 21:47:39 +00:00
Richard Smith a560ccf2af Switch to a different workaround for unimplementability of P0145R3 in MS ABIs.
Instead of ignoring the evaluation order rule, ignore the "destroy parameters
in reverse construction order" rule for the small number of problematic cases.
This only causes incorrect behavior in the rare case where both parameters to
an overloaded operator <<, >>, ->*, &&, ||, or comma are of class type with
non-trivial destructor, and the program is depending on those parameters being
destroyed in reverse construction order.

We could do a little better here by reversing the order of parameter
destruction for those functions (and reversing the argument evaluation order
for all direct calls, not just those with operator syntax), but that is not a
complete solution to the problem, as the same situation can be reached by an
indirect function call.

Approach reviewed off-line by rnk.

llvm-svn: 282777
2016-09-29 21:30:12 +00:00
Douglas Katzman 97833cf5ee [Myriad] Silently ignore -fno-split-dwarf-inlining
llvm-svn: 282757
2016-09-29 19:59:12 +00:00
Aditya Kumar 09a8c7d489 Revert "[PR30341] Alias must point to a definition"
This reverts commit r282679.

Ninja check fails, reverting to debug the issue.

llvm-svn: 282710
2016-09-29 11:37:23 +00:00
Aditya Kumar 13a18fecdd [PR30341] Alias must point to a definition
Inlining the destructor caused the compiler to generate bad IR which failed the Verifier in the backend.
https://llvm.org/bugs/show_bug.cgi?id=30341

This patch disables alias to available_externally definitions.

Reviewers: eugenis, rsmith

Differential Revision: https://reviews.llvm.org/D24682

llvm-svn: 282679
2016-09-29 03:32:04 +00:00
Richard Smith 27143d82f0 Mark P0127R3 as done, and replace its __has_feature check with the corresponding SD-6 macro.
llvm-svn: 282652
2016-09-29 00:08:05 +00:00
Richard Smith 5f274389d1 P0127R2: Support type deduction for types of non-type template parameters in
C++1z.

Patch by James Touton! Some bugfixes and rebasing by me.

llvm-svn: 282651
2016-09-28 23:55:27 +00:00
Justin Lebar b17840de33 [CUDA] Disallow variable-length arrays in CUDA device code.
Reviewers: tra

Subscribers: cfe-commits, jhen

Differential Revision: https://reviews.llvm.org/D25050

llvm-svn: 282647
2016-09-28 22:45:58 +00:00
Justin Lebar 2a8db34044 [CUDA] Disallow exceptions in device code.
Reviewers: tra

Subscribers: cfe-commits, jhen

Differential Revision: https://reviews.llvm.org/D25036

llvm-svn: 282646
2016-09-28 22:45:54 +00:00
Gor Nishanov e2f51befb8 [Coroutines] Add proper mangling for operator co_await for MicrosoftABI
Reviewers: rnk, rsmith

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D25045

llvm-svn: 282645
2016-09-28 22:37:17 +00:00
Richard Smith 38175a2e75 Fix bug where template argument deduction of a non-type template parameter used
as a template argument in a template-id, from a null non-type template
argument, failed.

Extracted from a patch by James Touton!

llvm-svn: 282641
2016-09-28 22:08:38 +00:00
Richard Smith 6e4bedc0d7 Add a couple more tentative names for upcoming SD-6 feature checks. These might
not reflect the final chosen names, but supporting them now seems to have
little downside.

llvm-svn: 282629
2016-09-28 20:42:56 +00:00
Richard Smith 38d91d49ce P0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).
llvm-svn: 282627
2016-09-28 20:26:06 +00:00
Richard Smith b02043cd0f P0096R2: Implement more recent revision of SD-6 (C++ feature test macros).
llvm-svn: 282622
2016-09-28 19:44:50 +00:00
Richard Smith 762672a73a Re-commit r282556, reverted in r282564, with a fix to CallArgList::addFrom to
function correctly when targeting MS ABIs (this appears to have never mattered
prior to this change).

Update test case to always cover both 32-bit and 64-bit Windows ABIs, since
they behave somewhat differently from each other here.

Update test case to also cover operators , && and ||, which it appears are also
affected by P0145R3 (they're not explicitly called out by the design document,
but this is the emergent behavior of the existing wording).


Original commit message:

P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side of
assignment and compound-assignment operators before the left-hand side. (Even
if it's an overloaded operator.)

This completes the implementation of P0145R3 + P0400R0 for all targets except
Windows, where the evaluation order guarantees for <<, >>, and ->* are
unimplementable as the ABI requires the function arguments are evaluated from
right to left (because parameter destructors are run from left to right in the
callee).

llvm-svn: 282619
2016-09-28 19:09:10 +00:00
Artem Belevich d4d9dc8252 [CUDA] Added support for CUDA-8
Differential Revision: https://reviews.llvm.org/D24946

llvm-svn: 282610
2016-09-28 17:47:40 +00:00
Artem Belevich fda9905062 [CUDA] added __nvvm_atom_{sys|cta}_* builtins.
These builtins are available on sm_60+ GPU only.

Differential Revision: https://reviews.llvm.org/D24944

llvm-svn: 282609
2016-09-28 17:47:35 +00:00
Eric Liu dd7faec9ca Trying to buildbot failures caused by r282577.
llvm-svn: 282583
2016-09-28 12:49:14 +00:00
Eric Liu 6ef82b6754 Merge conflicting replacements when they are order-independent.
Summary:
Now two replacements are considered order-independent if applying them in
either order produces the same result. These include (but not restricted
to) replacements that:
  - don't overlap (being directly adjacent is fine) and
  - are overlapping deletions.
  - are insertions at the same offset and applying them in either order
    has the same effect, i.e. X + Y = Y + X if one inserts text X and the
    other inserts text Y.

Discussion about this design can be found in D24717

Reviewers: djasper, klimek

Subscribers: omtcyfz, cfe-commits

Differential Revision: https://reviews.llvm.org/D24800

llvm-svn: 282577
2016-09-28 11:02:16 +00:00
Daniel Marjamaki 2593b402ce [StaticAnalyzer] Fix false positives for vardecls that are technically unreachable but they are needed.
Example:

    switch (x) {
      int a;  // <- This is unreachable but needed
    case 1:
      a = ...

Differential Revision: https://reviews.llvm.org/D24905

llvm-svn: 282574
2016-09-28 10:39:53 +00:00
Aleksei Sidorin a693b37e14 [ASTImporter] Implement some expression-related AST node import (part 2)
* Some code cleanup
* Add tests not present in http://reviews.llvm.org/D14286
* Integrate a test suite from Serge Pavlov (http://reviews.llvm.org/D14224)
* ArrayTypeTraitExpr: serialize sub-expression to avoid keeping it undefined
* Implement import of some nodes:
  - ArrayTypeTraitExpr
  - ExpressionTraitExpr
  - OpaqueValueExpr
  - ArraySubscriptExpr
  - ExplicitCastExpr
  - ImplicitValueInitExpr
  - OffsetOfExpr
  - CXXThisExpr
  - CXXThrowExpr
  - CXXNoexceptExpr
  - CXXDefaultArgExpr
  - CXXScalarValueInitExpr
  - CXXBindTemporaryExpr
  - CXXTemporaryObjectExpr
  - MaterializeTemporaryExpr
  - ExprWithCleanups

  - StaticAssertDecl
  - FriendDecl

  - DecayedType

Differential Revision: https://reviews.llvm.org/D14326

llvm-svn: 282572
2016-09-28 10:16:56 +00:00
Martin Storsjo 963f75efc2 [Headers] Replace stray indentation with tabs with spaces. NFC.
This matches the rest of the surrounding file.

llvm-svn: 282569
2016-09-28 09:34:51 +00:00
Richard Smith 4499145a5f Revert r282556. This change made several bots unhappy.
llvm-svn: 282564
2016-09-28 02:20:06 +00:00
Richard Smith 97a616d624 P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side of
assignment and compound-assignment operators before the left-hand side. (Even
if it's an overloaded operator.)

This completes the implementation of P0145R3 + P0400R0 for all targets except
Windows, where the evaluation order guarantees for <<, >>, and ->* are
unimplementable as the ABI requires the function arguments are evaluated from
right to left (because parameter destructors are run from left to right in the
callee).

llvm-svn: 282556
2016-09-27 23:44:22 +00:00
Richard Trieu 3d1235a97d Revert r282547 and add test to show correct behavior.
llvm-svn: 282555
2016-09-27 23:44:07 +00:00
Alex Lorenz 08780529b3 [Coverage] The coverage region for switch covers the code after the switch.
This patch fixes a regression introduced in r262697 that changed the way the
coverage regions for switches are constructed. The PGO instrumentation counter
for a switch statement refers to the counter at the exit of the switch.
Therefore, the coverage region for the switch statement should cover the code
that comes after the switch, and not the switch statement itself.

rdar://28480997

Differential Revision: https://reviews.llvm.org/D24981

llvm-svn: 282554
2016-09-27 23:30:36 +00:00
Richard Trieu 0013782030 Fix defaulted member functions for templated classes.
In some cases, non-special member functions were being marked as being defaulted
in templated classes.  This can cause interactions with later code that expects
the default function to be one of the specific member functions.  Fix the check
so that templated class members are checked the same way as non-templated class
members are.

llvm-svn: 282547
2016-09-27 22:28:59 +00:00
Adam Nemet b4e64a77d3 Shorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC
With the new streaming interface in LLVM, these class names need to be
typed a lot and it's way too looong.

llvm-svn: 282545
2016-09-27 22:19:29 +00:00
Adam Nemet 699fc5b191 Adapt to LLVM optimization remark interface change. NFC
llvm-svn: 282540
2016-09-27 20:55:12 +00:00
Matthias Braun ec1c5a2048 Adapt to LLVM EnableStatistics() change.
llvm-svn: 282533
2016-09-27 19:38:59 +00:00
Adam Nemet 95d0c628cf Revert "Adapt to LLVM optimization remark interface change. NFC"
This reverts commit r282500.

llvm-svn: 282504
2016-09-27 16:39:27 +00:00
Adam Nemet 8f1e871088 Adapt to LLVM optimization remark interface change. NFC
llvm-svn: 282500
2016-09-27 16:15:21 +00:00
Ayman Musa 17a2819b05 Update to commit r282488, fix the buildboot failure.
llvm-svn: 282492
2016-09-27 15:37:31 +00:00
Ayman Musa 2e250e8845 [avx512] Add aliases to some missing avx512 intrinsics.
Differential Revision:https: //reviews.llvm.org/D24961

llvm-svn: 282488
2016-09-27 14:06:32 +00:00
Nemanja Ivanovic 10e2b5dcaa [Power9] Builtins for ELF v.2 ABI conformance - front end portion
This patch corresponds to review:
https://reviews.llvm.org/D24397

It adds the __POWER9_VECTOR__ macro and the -mpower9-vector option along with
a number of altivec.h functions (refer to the code review for a list).

llvm-svn: 282481
2016-09-27 10:45:22 +00:00
Richard Smith 4088571c51 Remove default argument from lambda to appease old MSVC.
llvm-svn: 282464
2016-09-27 00:53:24 +00:00
Richard Smith bde62d78e9 P0145R3 (C++17 evaluation order tweaks): evaluate the base expression before
the pointer-to-member expression in calls through .* and ->* expressions.

llvm-svn: 282457
2016-09-26 23:56:57 +00:00
Richard Smith 9e67b9922b P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array
subscripting before the RHS, regardless of which is the base and which is the
index.

llvm-svn: 282453
2016-09-26 23:49:47 +00:00
Daniel Jasper e31388aee9 [clang-format] Don't allow newline after uppercase Obj-C block return types
Fixes the following:
  BOOL (^aaa)(void) = ^BOOL {
  };

The first BOOL's token was getting set to TT_FunctionAnnotationRParen
incorrectly, which was causing an unexpected newline after (^aaa). This
was introduced in r245846.

Patch by Kent Sutherland, thank you!

llvm-svn: 282448
2016-09-26 22:19:08 +00:00
Saleem Abdulrasool eae64f8a62 headers: add missing Windows ARM Interlocked intrinsics
On ARM, there are multiple versions of each of the intrinsics, with
acquire/relaxed/release barrier semantics.

The newly added ones are provided as inline functions here instead of builtins,
since they should only be available on certain archs (arm/aarch64).

This is necessary in order to compile C++ code for ARM in MSVC mode.

Patch by Martin Storsjö!

llvm-svn: 282447
2016-09-26 22:12:43 +00:00
Richard Smith 3b66056a3f [Modules TS] Diagnose 'export' declaration within 'export' declaration.
llvm-svn: 282443
2016-09-26 21:27:23 +00:00
Matthias Braun abb6eea19c CC1: Add -save-stats option
This option behaves in a similar spirit as -save-temps and writes
internal llvm statistics in json format to a file.

Differential Revision: https://reviews.llvm.org/D24820

llvm-svn: 282426
2016-09-26 18:53:34 +00:00
Aaron Ballman 5fa302cb65 Complete support for the cxxCtorInitializer() AST matcher so that it can be used as a top-level matcher.
llvm-svn: 282417
2016-09-26 17:04:27 +00:00
Daniel Marjamaki 13264ebea4 [analyzer] Improve CastToStruct checker so it can also detect widening casts of struct data
Example:

struct AB {
  int A;
  int B;
};

struct ABC {
  int A;
  int B;
  int C;
};

void f() {
  struct AB Data;
  struct ABC *P = (struct ABC *)&Data;
}

Differential Revision: https://reviews.llvm.org/D23508

llvm-svn: 282411
2016-09-26 15:17:18 +00:00
Daniel Jasper 3f2cde91d8 clang-format: Only special-case top-level */& in multivar-declstmts.
Before (even with PointerAlignment: Left):
  vector<int *> a, b;

After:
  vector<int*> a, b;

llvm-svn: 282410
2016-09-26 15:14:24 +00:00
Saleem Abdulrasool c094131557 Driver: avoid failing in the backend
Avoid failing in the backend when the rewrite map does not exist.  Rather check
that the map exists in the frontend before handing it off to the backend.  Add
the missing rewrite maps that the tests were referencing.

llvm-svn: 282379
2016-09-26 04:48:22 +00:00
Konstantin Zhuravlyov 5b48d725a0 [AMDGPU] Expose flat work group size, register and wave control attributes
__attribute__((amdgpu_flat_work_group_size(<min>, <max>))) - request minimum and maximum flat work group size
__attribute__((amdgpu_waves_per_eu(<min>[, <max>]))) - request minimum and/or maximum waves per execution unit

Differential Revision: https://reviews.llvm.org/D24513

llvm-svn: 282371
2016-09-26 01:02:57 +00:00
Alexander Shaposhnikov fbc4d68e71 Remove excessive padding from RedeclarableResult
This diff reorders the fields of the class RedeclarableResult 
to remove excessive padding.

Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D24754

llvm-svn: 282322
2016-09-24 04:21:53 +00:00
Alexander Shaposhnikov 96cbe7b9a7 Remove excessive padding from ObjCCategoriesVisitor
This diff reorders the fields of ObjCCategoriesVisitor 
to remove excessive padding. 

Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D24753

llvm-svn: 282318
2016-09-24 02:07:19 +00:00
Teresa Johnson 5f9f8ab3a7 Use llvm::to_string instead of std::to_string to fix bot
This should fix the android build in this bot:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/11143

llvm-svn: 282308
2016-09-23 22:25:03 +00:00
Peter Collingbourne 2d3a26ffb9 Update clang for r282299.
llvm-svn: 282301
2016-09-23 21:43:51 +00:00
Alexander Shaposhnikov a1fead293f [analyzer] Fix crash in RetainCountChecker::checkEndFunction
The class BodyFarm creates bodies for
OSAtomicCompareAndSwap*, objc_atomicCompareAndSwap*, dispatch_sync*, dispatch_once*
and for them the flag isBodyAutosynthesized is set to true.

This diff
1. makes AnalysisConsumer::HandleCode skip the autosynthesized code
2. replaces assert(LCtx->getParent()) in RetainCountChecker::checkEndFunction
by assert(!LCtx->inTopFrame()) (minor cleanup)

Test plan: make -j8 check-clang-analysis

Differential revision: https://reviews.llvm.org/D24792

llvm-svn: 282293
2016-09-23 20:49:01 +00:00
Teresa Johnson 12286d22b7 [LTO] Add -flto-jobs=N to control backend parallelism
Summary:
Currently, a linker option must be used to control the backend
parallelism of ThinLTO. The linker option varies depending on the
linker (e.g. gold vs ld64). Add a new clang option -flto-jobs=N
to control this.

I've added in the wiring to pass this to the gold plugin. I also
added in the logic to pass this down in the form I understand that
ld64 uses on MacOS, for the darwin target.

Reviewers: mehdi_amini, dexonsmith

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D24826

llvm-svn: 282291
2016-09-23 20:38:09 +00:00
Renato Golin fa007aeef4 Revert "set the underlying value of “#pragma STDC FP_CONTRACT” on by default"
This reverts commit r282259, as it broke the AArch64 test-suite bots.

llvm-svn: 282289
2016-09-23 20:32:52 +00:00
Sebastian Pop 6919ae5abc set the underlying value of “#pragma STDC FP_CONTRACT” on by default
Clang has the default FP contraction setting of “-ffp-contract=on”, which
doesn't really mean “on” in the conventional sense of the word, but rather
really means “according to the per-statement effective value of the relevant
pragma”.

Before this patch, Clang has that pragma defaulting to “off”. Since the
“-ffp-contract=on” mode is really an AND of two booleans and the second of them
defaults to “off”, the whole thing effectively defaults to “off”. This patch
changes the default value of the pragma to “on”, thus making the default pair of
booleans (on, on) rather than (on, off). This makes FP optimization slightly
more aggressive than before when not using either “-Ofast”, “-ffast-math”, or
“-ffp-contract=fast”. Even with this patch the compiler still respects
“-ffp-contract=off”.

As per a suggestion by Steve Canon, the added code does _not_ require “-O3” or
higher. This is so as to try our best to preserve identical floating-point
results for unchanged source code compiling for an unchanged target when only
changing from any optimization level in the set (“-O0”, “-O1”, “-O2”, “-O3”) to
any other optimization level in that set. “-Os” and “-Oz” seem to be behaving
identically, i.e. should probably be considered a part of the aforementioned
set, but I have not reviewed this rigorously. “-Ofast” is explicitly _not_ a
member of that set.

Patch authored by Abe Skolnik [a.skolnik@samsung.com] and Stephen Canon [scanon@apple.com].

Differential Revision: https://reviews.llvm.org/D24481

llvm-svn: 282259
2016-09-23 16:16:25 +00:00
Sjoerd Meijer e9eb0913a9 Revert of r282255 because of "Fell off the end of a string-switch" buildbot
failures.

llvm-svn: 282257
2016-09-23 15:37:17 +00:00
Sjoerd Meijer 0bfdab7a38 Fix for r280064 that added options for fp denormals and exceptions.
These options were forgotten to be copied in setCommandLineOpts.

llvm-svn: 282255
2016-09-23 15:21:33 +00:00
Eric Liu c0d3a80123 [clang-format] support header deletion in cleanupAroundReplacemnts.
Summary:
- If a replacement has offset UINT_MAX, length 0, and a replacement text
  that is an #include directive, this will insert the #include into the
  correct block in the \p Code.
- If a replacement has offset UINT_MAX, length 1, and a replacement text
  that is the name of the header to be removed, the header will be removed
  from \p Code if it exists.

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D24829

llvm-svn: 282253
2016-09-23 15:10:56 +00:00
Alexey Bader 465c18973d [OpenCL] Augment pipe built-ins with pipe packet size and alignment.
Reviewers: Anastasia, vpykhtin

Subscribers: dmitry, cfe-commits

Differential Revision: https://reviews.llvm.org/D23992

llvm-svn: 282252
2016-09-23 14:20:00 +00:00
Etienne Bergeron a768cd7996 [asan] Fix incorrect SEH symbol mangling on win64.
Summary:
The ASAN unittests are failing (check-asan-dynamic) due to an incorrect symbol name:
```
LINK : error LNK2001: unresolved external symbol ___asan_seh_interceptor
```

On win64, the linker is not adding an extra underscore. This was correctly fixed in the same file for other uses.

After that patch, most of the unittests are passing, but some related to SEH needs to be fixed.
```
Failing Tests (4):
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memchr.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_seh.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/seh.cc

  Expected Passes    : 339
  Passes With Retry  : 3
  Expected Failures  : 16
  Unsupported Tests  : 152
  Unexpected Failures: 4
```

Reviewers: rnk, kcc, majnemer

Subscribers: majnemer, chrisha, cfe-commits

Differential Revision: https://reviews.llvm.org/D24841

llvm-svn: 282251
2016-09-23 14:07:47 +00:00
Daniel Marjamaki 1ff60ef286 Minor tweak. Avoid hardcoding.
llvm-svn: 282242
2016-09-23 12:23:44 +00:00
Craig Topper a7e253e8fb [AVX-512] Add initial support for checking rounding mode arguments of builtins.
The backend can't encode all possible values of the argument and will fail isel. Checking in the frontend presents a friendlier experience to the user.

I started with builtins that can only take _MM_CUR_DIRECTION or _MM_NO_EXC. More builtins coming in the future.

llvm-svn: 282228
2016-09-23 04:48:31 +00:00
Craig Topper f0ddc898f1 [X86] Split up the single switch statement in Sema::CheckX86BuiltinFunctionCall into different switches or ifs for each type of check.
This in preparation for a new check that will check some of the builtins that already had the immediate range check.

llvm-svn: 282227
2016-09-23 04:48:27 +00:00
Renato Golin 0201a9e94e [OpenBSD] Add type sign information for OpenBSD
Like NetBSD, OpenBSD prefers having a consistent set of typedefs
across the architectures it supports over strictly following the ARM
ABIs.  The diff below makes sure that clang's view of those types
matches OpenBSD's system header files.  It also adds a test that
checks the relevant types on all OpenBSD platforms that clang works
on.  Hopefully we can add mips64 and powerpc to that list in the
future.

Patch by Mark Kettenis <mark.kettenis@xs4all.nl>

llvm-svn: 282184
2016-09-22 19:28:20 +00:00
Daniel Marjamaki ee5b5f52ba Fix Wbitfield-constant-conversion false positives
Summary:
The diagnostic did not handle ~ well. An expression such as ~0 is often used when 'all ones' is needed.

Differential Revision: https://reviews.llvm.org/D24232

llvm-svn: 282156
2016-09-22 14:13:46 +00:00
Martin Probst 4210d2fd1e clang-format: [JS] reserved words in method names.
Summary:
Before:
    class X {
      delete () {
        ...
      }
    }

After:
    class X {
      delete() {
        ...
      }
    }

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D24804

llvm-svn: 282138
2016-09-22 07:18:00 +00:00
George Burgess IV d273aab55b [Sema] Fix PR30481: crash on checking printf args.
We were falling through from one case to another in a switch statement.
Oops.

llvm-svn: 282124
2016-09-22 00:00:26 +00:00
Dmitry Polukhin fda467b252 PR30401: Fix substitutions for functions with abi_tag
llvm-svn: 282059
2016-09-21 08:27:03 +00:00
Martin Probst 6f99d2433b clang-format: [JS] do not wrapp @returns tags.
Summary: @returns is incorrect code, the standard is @return. However wrapping it can still confuse users.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D24767

llvm-svn: 282056
2016-09-21 06:56:38 +00:00
Anna Zaks c154f7bc37 [analyzer] Add a checker that detects blocks in critical sections
This checker should find the calls to blocking functions (for example: sleep, getc, fgets,read,recv etc.) inside a critical section. When sleep(x) is called while a mutex is held, other threads cannot lock the same mutex. This might take some time, leading to bad performance or even deadlock.

Example:

mutex_t m;

void f() {
  sleep(1000); // Error: sleep() while m is locked! [f() is called from foobar() while m is locked]
  // do some work
}

void foobar() {
  lock(m);
  f();
  unlock(m);
}

A patch by zdtorok (Zoltán Dániel Török)!

Differential Revision: https://reviews.llvm.org/D21506

llvm-svn: 282011
2016-09-20 20:28:50 +00:00