Commit Graph

64184 Commits

Author SHA1 Message Date
Daniel Jasper 6465008e0e clang-format: [JS] Support annotated classes.
llvm-svn: 272654
2016-06-14 11:28:02 +00:00
Roger Ferrer Ibanez 985c0c274b Reverting "Warn when taking address of a packed member"
This new diagnostic is causing some false positives that have to be addressed.

This reverts commit 272552

llvm-svn: 272653
2016-06-14 11:20:07 +00:00
Daniel Sanders 32b2d6b160 [mips] Defer validity check for CPU/ABI pairs and improve error message for invalid cases.
Summary:
The validity of ABI/CPU pairs is no longer checked on the fly but is
instead checked after initialization. As a result, invalid CPU/ABI pairs
can be reported as being known but invalid instead of being unknown. For
example, we now emit:
  error: ABI 'n32' is not supported on CPU 'mips32r2'
instead of:
  error: unknown target ABI 'n64'

Reviewers: atanasyan

Subscribers: sdardis, cfe-commits

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

llvm-svn: 272645
2016-06-14 08:58:50 +00:00
Faisal Vali 81a88beec4 Fix PR28100 - Allow redeclarations of deleted explicit specializations.
See https://llvm.org/bugs/show_bug.cgi?id=28100.

In r266561 when I implemented allowing explicit specializations of function templates to override deleted status, I mistakenly assumed (and hence introduced a violable assertion) that when an explicit specialization was being declared, the corresponding specialization of the most specialized function template that it would get linked to would always be the one that was implicitly generated - and so if it was marked as 'deleted' it must have inherited it from the primary template and so should be safe to reset its deleted status, and set it to being an explicit specialization.  Obviously during redeclaration of a deleted explicit specialization, in order to avoid a recursive reset, we need to check that the previous specialization is not an explicit specialization (instead of assuming and asserting it) and that it hasn't been referenced, and so only then is it safe to reset its 'deleted' status.

All regression tests pass.

Thanks to Zhendong Su for reporting the bug and David Majnemer for tracking it to my commit r266561, and promptly bringing it to my attention.

llvm-svn: 272631
2016-06-14 03:23:15 +00:00
David Majnemer 15b311c752 [Parser] Handle __pragma(pack, etc. after type definitions
Support certain MS pragmas right after the closing curly brace of a
class.  Clang did not expect __pragma in this position.

This fixes PR28094.

llvm-svn: 272628
2016-06-14 03:20:28 +00:00
Serge Pavlov b82a9401df Detect recursive default argument definition
If definition of default function argument uses itself, clang crashed,
because corresponding function parameter is not associated with the default
argument yet. With this fix clang emits appropriate error message.

This change fixes PR28105.

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

llvm-svn: 272623
2016-06-14 02:55:56 +00:00
Vedant Kumar d6d4b3717e Remove stray semi-colon in *.py file, NFC
llvm-svn: 272610
2016-06-14 01:14:50 +00:00
Richard Smith d62d498ed7 Remove nonsense and simplify. To forward a reference, we always just load the
pointer-to-pointer representing the parameter. An aggregate rvalue representing
a pointer does not make sense.

We got away with this weirdness because CGCall happens to blindly load an
RValue in aggregate form in this case, without checking whether an RValue for
the type should be in scalar or aggregate form.

llvm-svn: 272609
2016-06-14 01:13:21 +00:00
Richard Smith 50f89da25c Add a test to ensure that pass_object_size is handled properly by a delegate constructor.
llvm-svn: 272605
2016-06-14 00:48:35 +00:00
Vedant Kumar f3300c9f74 [docs] Coverage: Document the profile merge pool specifier
llvm-svn: 272604
2016-06-14 00:42:12 +00:00
Taewook Oh 755e4d2d17 Patch for r272584 (http://reviews.llvm.org/rL272584) to address clang-x64-ninja-win7 buildbot failure.
Patch by Eric Niebler

llvm-svn: 272592
2016-06-13 21:55:33 +00:00
Erik Pilkington 142a874890 [Parser] Only correct delayed typos when needed
ActOnBinOp corrects delayed typos when in C mode; don't correct them in that
case. Fixes PR26700.

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

llvm-svn: 272587
2016-06-13 20:56:45 +00:00
Taewook Oh f42103ce8b Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.
Differential Revision: http://reviews.llvm.org/D19843
Corresponding LLVM change: http://reviews.llvm.org/D19842

Re-commit of r272562 after addressing clang-x86-win2008-selfhost failure.

llvm-svn: 272584
2016-06-13 20:40:21 +00:00
Hans Wennborg 92375f55ed clang-cl: Support -resource-dir option (PR28074)
It's useful e.g. for distributed build systems.

llvm-svn: 272583
2016-06-13 20:31:30 +00:00
Richard Smith 4bc32f28a9 Add test for DR1359.
llvm-svn: 272575
2016-06-13 19:04:44 +00:00
Artem Belevich 6530a3e73f Test fix -- use captured call result instead of hardcoded %2.
llvm-svn: 272573
2016-06-13 18:44:22 +00:00
Taewook Oh cb07d65173 Revert r272562 for build bot failure (clang-x86-win2008-selfhost)
llvm-svn: 272572
2016-06-13 18:32:30 +00:00
Samuel Antao c1ffba5062 [CUDA][OpenMP] Create generic offload toolchains
Summary:
This patch introduces the concept of offloading tool chain and offloading kind. Each tool chain may have associated an offloading kind that marks it as used in a given programming model that requires offloading. 

It also adds the logic to iterate on the tool chains based on the kind. Currently, only CUDA is supported, but in general a programming model (an offloading kind) may have associated multiple tool chains that require supporting offloading.

This patch does not add tests - its goal is to keep the existing functionality.

This patch is the first of a series of three that attempts to make the current support of CUDA more generic and easier to extend to other programming models, namely OpenMP. It tries to capture the suggestions/improvements/concerns on the initial proposal in  http://lists.llvm.org/pipermail/cfe-dev/2016-February/047547.html. It only tackles the more consensual part of the proposal, i.e.does not address the problem of intermediate files bundling yet.

Reviewers: ABataev, jlebar, echristo, hfinkel, tra

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

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

llvm-svn: 272571
2016-06-13 18:10:57 +00:00
Martin Probst fb2342d274 clang-format: [JS] Initialize new configuration value.
llvm-svn: 272569
2016-06-13 17:50:10 +00:00
Paul Robinson f2a34a889d Capture the resource directory and use it for subsequent checks.
This is the same tactic used in linux-header-search.cpp.

llvm-svn: 272568
2016-06-13 17:41:05 +00:00
David Majnemer d423574fde [immintrin] Reimplement _bit_scan_{forward,reverse}
There is no need to use a target-specific intrinsic to implement
_bit_scan_forward or _bit_scan_reverse, reimplementing them using
generic intrinsics makes it more likely that the middle end will
understand what's going on.

llvm-svn: 272564
2016-06-13 17:26:16 +00:00
Taewook Oh e8533670bf Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.
Differential Revision: http://reviews.llvm.org/D19843
Corresponding LLVM change: http://reviews.llvm.org/D19842

Re-commit after addressing issues with of generating too many warnings for Windows and asan test failures.

Patch by Eric Niebler

llvm-svn: 272562
2016-06-13 17:03:18 +00:00
Martin Probst ece8c0c65f clang-format: [JS] Indent namespaces in JavaScript/TS by default.
Summary: There's no convention of avoiding the nested indentation.

Reviewers: djasper

Subscribers: klimek, alexeagle, cfe-commits

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

llvm-svn: 272559
2016-06-13 16:41:28 +00:00
Martin Probst 0cd74ee875 clang-format: [JS] Introduce JavaScriptWrapImports option.
Summary:
When turned on, clang-format wraps JavaScript imports (and importing exports),
instead of forcing the entire import statement onto one line.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 272558
2016-06-13 16:39:50 +00:00
Roger Ferrer Ibanez ac6617b288 Warn when taking address of a packed member
This patch implements PR#22821.

Taking the address of a packed member is dangerous since the reduced
alignment of the pointee is lost. This can lead to memory alignment
faults in some architectures if the pointer value is dereferenced.

This change adds a new warning to clang emitted when taking the address
of a packed member. A packed member is either a field/data member
declared as attribute((packed)) or belonging to a struct/class
declared as such. The associated flag is -Waddress-of-packed-member

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

llvm-svn: 272552
2016-06-13 15:41:40 +00:00
Asaf Badouh 880f0c252b [X86][AVX512F] bugfix - sqrtps should get __mask16 as mask parameter
CR: Michael Zuckerman
llvm-svn: 272549
2016-06-13 15:15:57 +00:00
Daniel Jasper 1f5d6371fd clang-format: Restrict r272537 to function ref qualifiers.
Seems this isn't generally desirable.

Before:
  int const * a;

After:
  int const* a;

llvm-svn: 272548
2016-06-13 14:45:12 +00:00
Simon Pilgrim 532de1ceb9 Fix unused variable warning
llvm-svn: 272541
2016-06-13 10:05:19 +00:00
Simon Pilgrim beca5f295c [Clang][X86] Convert non-temporal store builtins to generic __builtin_nontemporal_store in headers
We can now use __builtin_nontemporal_store instead of target specific builtins for naturally aligned nontemporal stores which avoids the need for handling in CGBuiltin.cpp

The scalar integer nontemporal (unaligned) store builtins will have to wait as __builtin_nontemporal_store currently assumes natural alignment and doesn't accept the 'packed struct' trick that we use for normal unaligned load/stores.

The nontemporal loads require further backend support before we can safely convert them to __builtin_nontemporal_load

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

llvm-svn: 272540
2016-06-13 09:57:52 +00:00
Daniel Jasper 215616691a clang-format: Fix incorrect function type detection.
Before:
  returnsFunction (&param1, &param2)(param);

After:
  returnsFunction(&param1, &param2)(param);

llvm-svn: 272538
2016-06-13 07:49:35 +00:00
Daniel Jasper 43e4d3a05b clang-format: Don't merge const and &, e.g. in function ref qualifiers.
Before (when aligning & to the right):
  SomeType MemberFunction(const Deleted &) const&;

After:
  SomeType MemberFunction(const Deleted &) const &;

This also applies to variable declarations, e.g.:
  int const * a;

However, this form is very uncommon (most people would write
"const int* a" instead) and contracting to "const*" might actually send
the wrong signal of what the const binds to.

llvm-svn: 272537
2016-06-13 07:49:28 +00:00
Daniel Jasper 594be2f037 clang-format: Fix incorrect cast detection.
Before:
  auto s = sizeof...(Ts)-1;

After:
  auto s = sizeof...(Ts) - 1;

llvm-svn: 272536
2016-06-13 07:49:09 +00:00
Daniel Jasper 87448c5548 clang-format: Don't indent lambda body relative to its return type.
Before:
  []()  //
      -> int {
        return 1;  //
      };

After:
  []()  //
      -> int {
    return 1;  //
  };

llvm-svn: 272535
2016-06-13 07:48:45 +00:00
NAKAMURA Takumi dbc9e5f598 MPIBugReporter.h: Fix a warning. [-Wdocumentation]
llvm-svn: 272534
2016-06-13 05:46:35 +00:00
Craig Topper fc07498e4a [AVX512] Masked pcmpeqd, pcmpeqq, pcmpgtd, and pcmpgtq don't require avx512bw, just avx512vl.
llvm-svn: 272532
2016-06-13 04:15:11 +00:00
Mike Spertus 27c72d2fdb Improved Visual Studio visualization of OpaquePtr
Create a special visualizer for OpaquePtr<QualType> because the 
standard visualizer doesn't work with OpaquePtr<QualType>
due to QualType being heavily dependent on traits to be pointer-like.

Also, created an identical visualizer for UnionOpaquePtr

llvm-svn: 272531
2016-06-13 04:02:35 +00:00
Devin Coughlin 9cffa40b75 [analyzer] Remove some list initialization from MPI Checker to make MSVC bots happy.
This is a speculative attempt to fix the compiler error: "list initialization inside
member initializer list or non-static data member initializer is not implemented" with
r272529.

llvm-svn: 272530
2016-06-13 03:58:58 +00:00
Devin Coughlin 160f19cdda [analyzer] Add checker to verify the correct usage of the MPI API
This commit adds a static analysis checker to verify the correct usage of the MPI API in C
and C++. This version updates the reverted r271981 to fix a memory corruption found by the
ASan bots.

Three path-sensitive checks are included:
- Double nonblocking: Double request usage by nonblocking calls without intermediate wait
- Missing wait: Nonblocking call without matching wait.
- Unmatched wait: Waiting for a request that was never used by a nonblocking call

Examples of how to use the checker can be found at https://github.com/0ax1/MPI-Checker

A patch by Alexander Droste!

Reviewers: zaks.anna, dcoughlin

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

llvm-svn: 272529
2016-06-13 03:22:41 +00:00
Martin Probst 0eb40cfa6f clang-format: [JS] post-fix non-null assertion operator.
Summary:
Do not insert whitespace preceding the "!" postfix operator. This is an
incomplete fix, but should cover common usage.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 272524
2016-06-13 00:49:54 +00:00
Mike Spertus ce334cf156 Visual Studio Visualizer for PackExpansionType
llvm-svn: 272522
2016-06-12 22:54:46 +00:00
Mike Spertus 47f4890bc1 Visual Studio native visualizer for ParsedTemplateArgument
Does a good job with type and non-type template arguments
and lays the groundwork for template template arguments to
visualize well once there is a TemplateName visualizer.
Also fixed what looks like an incorrect comment in the
header for ParsedTemplate.h.

llvm-svn: 272521
2016-06-12 22:21:56 +00:00
Benjamin Kramer d6da1a097b Add some std::move where the value is only read otherwise.
This mostly affects smart pointers. No functionality change intended.

llvm-svn: 272520
2016-06-12 20:05:23 +00:00
Mike Spertus 5bf7fd8185 Rudimentary support for Visual Studio Stmt visualizer
Better than nothing...

llvm-svn: 272518
2016-06-12 18:42:04 +00:00
Craig Topper d1cb4ceacd [CodeGen] Update to use an ArrayRef of uint32_t instead of int in calls to CreateShuffleVector to match llvm interface change.
llvm-svn: 272492
2016-06-12 00:41:24 +00:00
Simon Pilgrim 778a7eddb5 [X86][BMI] Improved bmi intrinsics checks
Ready for matching with llvm/test/CodeGen/X86/bmi-intrinsics-fast-isel.ll (to be added shortly)

llvm-svn: 272490
2016-06-11 22:40:01 +00:00
Mike Spertus 897711f018 Visual Studio Visualizers for ActionResult, LocInfoType, and and TypeSourceInfo
Created a visualizer for ActionResult that displayed the validity and the pointer,
but many of them initially displayed poorly. It turns out that the primary culprit
is that LocInfoType is often passed in an action result, but it is not the same 
as other types. For example, LocInfoType is not in TypeNodes.def and clang::Type::TypeClass
does not have a LocInfoType enum. After adding a special visualizer for LocInfoType,
the display was more useful

llvm-svn: 272487
2016-06-11 20:15:19 +00:00
Faisal Vali 67b04465c0 Fix cv-qualification of '*this' captures and nasty bug PR27507
The bug report by Gonzalo (https://llvm.org/bugs/show_bug.cgi?id=27507 -- which results in clang crashing when generic lambdas that capture 'this' are instantiated in contexts where the Functionscopeinfo stack is not in a reliable state - yet getCurrentThisType expects it to be) - unearthed some additional bugs in regards to maintaining proper cv qualification through 'this' when performing by value captures of '*this'.

This patch attempts to correct those bugs and makes the following changes:

   o) when capturing 'this', we do not need to remember the type of 'this' within the LambdaScopeInfo's Capture - it is never really used for a this capture - so remove it.
   o) teach getCurrentThisType to walk the stack of lambdas (even in scenarios where we run out of LambdaScopeInfo's such as when instantiating call operators) looking for by copy captures of '*this' and resetting the type of 'this' based on the constness of that capturing lambda's call operator.

This patch has been baking in review-hell for > 6 weeks - all the comments so far have been addressed and the bug (that it addresses in passing, and I regret not submitting as a separate patch initially) has been reported twice independently, so is frequent and important for us not to just sit on. I merged the cv qualification-fix and the PR-fix initially in one patch, since they resulted from my initial implementation of star-this and so were related. If someone really feels strongly, I can put in the time to revert this - separate the two out - and recommit.  I won't claim it's immunized against all bugs, but I feel confident enough about the fix to land it for now.

llvm-svn: 272480
2016-06-11 16:41:54 +00:00
Craig Topper 46422562f5 [AVX512] Use a regular expression instead of checking for a specific name in a CHECK line in test.
llvm-svn: 272470
2016-06-11 13:35:43 +00:00
Craig Topper 7cc9263ec2 [AVX512] Implement masked and 512-bit pshufd intrinsics directly with __builtin_shufflevector and __builtin_ia32_select.
llvm-svn: 272467
2016-06-11 12:50:19 +00:00
Craig Topper 26d5b87316 [X86] Add explicit typecasts to some intrinsics.
llvm-svn: 272466
2016-06-11 12:50:12 +00:00