Commit Graph

65608 Commits

Author SHA1 Message Date
Justin Lebar 4a759ff44c [CUDA] Add missing ':' to noexcept.cu test.
llvm-svn: 283280
2016-10-05 00:27:38 +00:00
Justin Lebar 3e6449b4f4 [CUDA] Mark device functions as nounwind.
Summary:
This prevents clang from emitting 'invoke's and catch statements.

Things previously mostly worked thanks to TryToMarkNoThrow() in
CodeGenFunction.  But this is not a proper IPO, and it doesn't properly
handle cases like mutual recursion.

Fixes bug 30593.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 283272
2016-10-04 23:41:49 +00:00
Justin Lebar 49e7614efb [CUDA] Destroy deferred diagnostics before destroying the ASTContext's PartialDiagnostic allocator.
Summary:
This will let us (in a separate patch) allocate deferred diagnostics in
the ASTContext's PartialDiagnostic arena.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 283271
2016-10-04 23:41:45 +00:00
Albert Gutowski f3a0bce155 Separate builtins for x84-64 and i386; implement __mulh and __umulh
Summary: We need x86-64-specific builtins if we want to implement some of the MS intrinsics - winnt.h contains definitions of some functions for i386, but not for x86-64 (for example _InterlockedOr64), which means that we cannot treat them as builtins for both i386 and x86-64, because then we have definitions of builtin functions in winnt.h on i386.

Reviewers: thakis, majnemer, hans, rnk

Subscribers: cfe-commits

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

llvm-svn: 283264
2016-10-04 22:29:49 +00:00
Hans Wennborg 625fba8840 clang-cl: Make /Fo apply also when using -flto
llvm-svn: 283258
2016-10-04 21:01:04 +00:00
Hans Wennborg 26228e3010 clang-cl: Use the .obj file extension also in LTO mode
llvm-svn: 283257
2016-10-04 21:01:02 +00:00
Hans Wennborg 2b0eea4a3b clang-cl: expose the -fuse-ld option
llvm-svn: 283256
2016-10-04 21:01:00 +00:00
Hans Wennborg 02d03befb9 clang-cl: Expose the -flto option
We could hook up /GL as an alias for -flto, but that might be
confusing, as clang-cl in that mode would not be drop-in compatible
with cl.exe /GL, as it requires the linker to be lld.

Exposing -flto seems like a less confusing way to expose this
functionality.

llvm-svn: 283255
2016-10-04 21:00:57 +00:00
Anna Zaks fb859a934a [analyzer] Add PostStmt callback for ArraySubscriptExpr
A patch by Jan Smets!

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

llvm-svn: 283253
2016-10-04 20:49:31 +00:00
Sanjay Patel 0bb72c1424 [clang] make reciprocal estimate codegen a function attribute
The motivation for the change is that we can't have pseudo-global settings
for codegen living in TargetOptions because that doesn't work with LTO.

Ideally, these reciprocal attributes will be moved to the instruction-level
via FMF, metadata, or something else. But making them function attributes is
at least an improvement over the current state.

I'm committing this patch ahead of the related LLVM patch to avoid bot failures,
but if that patch needs to be reverted, then this should be reverted too.

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

llvm-svn: 283251
2016-10-04 20:44:05 +00:00
Vedant Kumar e356f1a50c [ubsan] Disable bounds-check for flexible array ivars
This eliminates a class of false positives for -fsanitize=array-bounds
on instrumented ObjC projects.

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

llvm-svn: 283249
2016-10-04 20:36:04 +00:00
Daniel Jasper 85d1f0b610 clang-format: Fix bad multi-variable for-loop formatting.
Before:
  for (int*p, *q; p != q; p = p->next) {

After:
  for (int *p, *q; p != q; p = p->next) {

llvm-svn: 283246
2016-10-04 20:18:25 +00:00
Mike Aizatsky a271d1a531 [sancov] documentation update after r283241
llvm-svn: 283242
2016-10-04 19:19:16 +00:00
Reid Kleckner 56f4535634 Test what happens when tag lookup and redeclaration lookup disagree
Clang has a diagnostic for the what happens when an elaborated type
implicitly creates a tag declaration and the initial tag lookup fails,
but the redeclaration lookup succeeds and finds a non-tag type. However,
it wasn't tested, and looked like dead code. After much staring, we
discovered how to exercise it, and are now committing the test for
posterity.

In this example, the tag lookup will not find A, but then when we go to
insert a declaration of A at global scope, we discover the template
friend, which is not a tag type.

  struct C {
    template <typename> friend struct A;
  };
  struct B {
    struct A *p;
  };

llvm-svn: 283235
2016-10-04 18:10:23 +00:00
Alex Lorenz 9e5afc4a2c [Sema] Format a comment line so that it fits 80 columns. NFC
llvm-svn: 283228
2016-10-04 16:06:37 +00:00
Reid Kleckner d2c0c25be4 [MS] Move hex long long sign compat hack to -fms-compatibility
Treating large 0x*LL literals as signed instead of unsigned is not a
conforming language extension, so move it out of -fms-extensions.

Came up in PR30605

llvm-svn: 283227
2016-10-04 15:57:49 +00:00
David Sheinkman 92589990ba [OpenMP] fix segfault when a variable referenced in reduction clause is a reference parameter\nDifferential Revision: http://reviews.llvm.org/D24524
llvm-svn: 283223
2016-10-04 14:41:36 +00:00
Davide Italiano 46f40a000a [ThinLTO] Spell `llvm-ar` correctly.
llvm-svn: 283217
2016-10-04 13:16:00 +00:00
Serge Pavlov 06b7a87298 Do not find friend function definitions inside non-instantiated class.
Previously if a file-level function was defined inside befriending
template class, it always was treated as defined. For instance, the code like:
```
  int func(int x);
  template<typename T> class C1 {
    friend int func(int x) { return x; }
  };
  template<typename T> class C2 {
    friend int func(int x) { return x; }
  };
```
could not be compiled due to function redefinition, although not of the templates
is instantiated. Moreover, the body of friend function can contain use of template
parameters, attempt to get definition of such function outside any instantiation
causes compiler abnormal termination.

Other compilers (gcc, icc) follow viewpoint that the body of the function defined
in friend declaration becomes available when corresponding class is instantiated.
This patch implements this viewpoint in clang.

Definitions introduced by friend declarations in template classes are not added
to the redeclaration chain of corresponding function. Only when the template is
instantiated, instantiation of the function definition is placed to the chain.

The fix was made in collaboration with Richard Smith.

This change fixes PR8035, PR17923, PR22307 and PR25848.

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

llvm-svn: 283207
2016-10-04 10:11:43 +00:00
Manuel Klimek 8a70450590 Minor cleanups in clang-format.el.
- Enable lexical binding
- Formatting
- Enable file name completion for the clang-format-executable variable
- Add a missing docstring
- When available, use bufferpos-to-filepos and filepos-to-bufferpos. These functions given more precise mapping than byte-to-position and position-bytes.
- Rename arguments of clang-format-region to match the docstring
- Instead of binding local variables to nil and then assigning them, bind them directly to their values
- Make use of the fact that insert-file-contents returns the number of characters it inserted
- Use cl-destructuring-bind to make the code a bit shorter
- Use standard iteration (dolist) instead of mapc with a lambda, which is more common and shorter
- Remove a message that was most likely only present for debugging purposes

Patch by Philipp Stephani.

llvm-svn: 283206
2016-10-04 09:53:04 +00:00
Dean Michael Berris 4541bb7fd0 Revert "[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed"
This reverts 283193 -- broke the build.

llvm-svn: 283199
2016-10-04 08:54:51 +00:00
NAKAMURA Takumi 90893f0eab Revert r283106, "Wdocumentation fix"
It should depend on r283094 and r283182.

llvm-svn: 283195
2016-10-04 08:32:33 +00:00
Dean Michael Berris 5db9121b31 [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed
Added the code which explicitly emits an error in Clang in case
`-fxray-instrument` is passed, but XRay is not supported for the
selected target.

Author: rSerge

Reviewers: dberris, rsmith, aaron.ballman, rnk

Subscribers: cfe-commits, iid_iunknown

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

llvm-svn: 283193
2016-10-04 08:22:47 +00:00
Vitaly Buka 1a8d52d1ae Revert "[analyzer] Improve CloneChecker diagnostics" as its depends on reverted r283092
This reverts commit r283094.

llvm-svn: 283182
2016-10-04 02:40:35 +00:00
Vitaly Buka b3814f6f38 Revert "[analyzer] Add extra notes to ObjCDeallocChecker" as its depends on reverted r283092
This reverts commit r283093.

llvm-svn: 283181
2016-10-04 02:36:58 +00:00
Vitaly Buka 20efb97ff3 Revert "[analyzer] Extend bug reports with extra notes" to fix Windows bot.
This reverts commit r283092.

llvm-svn: 283180
2016-10-04 02:19:17 +00:00
Vitaly Buka bba7416978 Revert "[analyzer] A blind attempt to fix a buildbot" as it does not help.
This reverts commit r283141.

llvm-svn: 283179
2016-10-04 02:19:12 +00:00
Gor Nishanov 3e048bb140 [coroutines] Switch to using std::experimental namespace per P0057R5
Summary:
Look for coroutine_traits and friends in std::experimental namespace.
Patch (mostly) by EricWF.

Reviewers: cfe-commits, EricWF, rsmith

Subscribers: majnemer, mehdi_amini

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

llvm-svn: 283170
2016-10-04 00:31:16 +00:00
Gor Nishanov 97e3b6d895 [coroutines] Adding builtins for coroutine intrinsics and backendutil support.
Summary:
With this commit simple coroutines can be created in plain C using coroutine builtins.

Reviewers: rnk, EricWF, rsmith

Subscribers: modocache, mgorny, mehdi_amini, beanz, cfe-commits

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

llvm-svn: 283155
2016-10-03 22:44:48 +00:00
Manman Ren a0042c4922 ObjectiveC: fix a seg fault when deserialing redeclaration of ObjCMethodDecl.
The deserialization of redeclartion can cause seg fault since getCanonicalDecl
of the redeclaration returns the lookup result on the ObjCContainerDecl,
which can be null if FindExternalVisibleDeclsByName is not done updating
the lookup results.

The fix is to return the redeclaration itself as the canonical decl. Note that
the handling for redeclaration of ObjCMethodDecl is not in line with other
redeclarables.

rdar://28488466

llvm-svn: 283145
2016-10-03 21:26:46 +00:00
Artem Dergachev 844ba8879e [analyzer] A blind attempt to fix a buildbot after r283092.
The msvc compiler seems to crash compiling the BugReport class.

llvm-svn: 283141
2016-10-03 20:12:12 +00:00
Eric Liu 385f10152c Added more comments to tooling::Replacements.
Summary: Also test phabricator commit processing.

Subscribers: klimek, cfe-commits

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

llvm-svn: 283135
2016-10-03 19:14:30 +00:00
Reid Kleckner f33bfcb0e0 Factor out a diagnostic kind enum for use in two %select expressions
NFC

llvm-svn: 283131
2016-10-03 18:34:23 +00:00
Justin Lebar 53b000afc2 [CUDA] Clean up some comments in Sema::IsOverload. NFC
llvm-svn: 283121
2016-10-03 16:48:27 +00:00
Justin Lebar e060feb7b1 [CUDA] Disallow overloading destructors.
Summary:
We'd attempted to allow this, but turns out we were doing a very bad
job.  :)

Making this work properly would be a giant change in clang.  For
example, we'd need to make CXXRecordDecl::getDestructor()
context-sensitive, because the destructor you end up with depends on
where you're calling it from.

For now (and hopefully for ever), just disallow overloading of
destructors in CUDA.

Reviewers: rsmith

Subscribers: cfe-commits, tra

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

llvm-svn: 283120
2016-10-03 16:48:23 +00:00
Vedant Kumar 30914f3d1c [ARC] Ignore qualifiers in copy-restore expressions
When ARC is enabled, an ObjCIndirectCopyRestoreExpr models the passing
of a function argument s.t:

  * The argument is copied into a temporary,
  * The temporary is passed into the function, and
  * After the function call completes, the temporary is move-assigned
    back to the original location of the argument.

The argument type and the parameter type must agree "except possibly in
qualification". This commit weakens an assertion in EmitCallArg() to
actually reflect that.

llvm-svn: 283116
2016-10-03 15:29:22 +00:00
Yaxun Liu ea6b796e0e [OpenCL] Fix bug in __builtin_astype causing invalid LLVM cast instructions
__builtin_astype is used to cast OpenCL opaque types to other types, as such, it needs to be able to handle casting from and to pointer types correctly.

Current it cannot handle 1) casting between pointers of different addr spaces 2) casting between pointer type and non-pointer types.

This patch fixes that.

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

llvm-svn: 283114
2016-10-03 14:41:50 +00:00
Sjoerd Meijer d98493414b This adds a separate file for the fp denormal regression tests. NFC.
I forgot to svn add the new file in my previous commit.

llvm-svn: 283110
2016-10-03 13:13:50 +00:00
Sjoerd Meijer a5d3fd4780 This adds a separate file for the fp denormal regression tests. NFC.
Differential Revision: https://reviews.llvm.org/D24907

llvm-svn: 283109
2016-10-03 13:12:20 +00:00
Simon Pilgrim efd4006080 Wdocumentation fix
llvm-svn: 283106
2016-10-03 12:37:08 +00:00
Alex Lorenz ea9b59a33d Fix PR 28885: Fix AST Printer output for the inherited constructor using
declarations.

This commit ensures that the correct record type is printed out for the
using declarations that represent C++ inherited constructors.
It fixes a regression introduced in r274049 which changed the name that's
stored in the using declarations that correspond to inherited constructors.

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

llvm-svn: 283105
2016-10-03 12:22:17 +00:00
Alex Lorenz 4ff920bf1b Revert r283102 (Typo in the phabricator link)
llvm-svn: 283104
2016-10-03 12:17:56 +00:00
Alex Lorenz 2bc02892be Fix PR 28885: Fix AST Printer output for the inherited constructor using
declarations.

This commit ensures that the correct record type is printed out for the
using declarations that represent C++ inherited constructors.
It fixes a regression introduced in r274049 which changed the name that's
stored in the using declarations that correspond to inherited constructors.

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

llvm-svn: 283102
2016-10-03 12:12:03 +00:00
Daniel Marjamaki fd1b3814b3 [StaticAnalyser] Add test case to ensure that unreachable code is found.
https://reviews.llvm.org/D24905

llvm-svn: 283096
2016-10-03 09:45:35 +00:00
Daniel Marjamaki 042a3c5a2d [StaticAnalyzer] Fix UnreachableCode false positives.
When there is 'do { } while (0);' in the code the ExplodedGraph and UnoptimizedCFG did not match.

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

llvm-svn: 283095
2016-10-03 08:28:51 +00:00
Artem Dergachev c87d2a613e [analyzer] Improve CloneChecker diagnostics
Highlight code clones referenced by the warning message with the help of
the extra notes feature recently introduced in r283092.

Change warning text to more clang-ish. Remove suggestions from the copy-paste
error checker diagnostics, because currently our suggestions are strictly 50%
wrong (we do not know which of the two code clones contains the error), and
for that reason we should not sound as if we're actually suggesting this.
Hopefully a better solution would bring them back.

Make sure the suspicious clone pair structure always mentions
the correct variable for the second clone.

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

llvm-svn: 283094
2016-10-03 08:11:50 +00:00
Artem Dergachev 918602df8d [analyzer] Add extra notes to ObjCDeallocChecker
The report is now highlighting instance variables and properties
referenced by the warning message with the help of the
extra notes feature recently introduced in r283092.

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

llvm-svn: 283093
2016-10-03 08:03:51 +00:00
Artem Dergachev 9dceb11b2f [analyzer] Extend bug reports with extra notes
These diagnostics are separate from the path-sensitive engine's path notes,
and can be added manually on top of path-sensitive or path-insensitive reports.

The new note diagnostics would appear as note:-diagnostic on console and
as blue bubbles in scan-build. In plist files they currently do not appear,
because format needs to be discussed with plist file users.

The analyzer option "-analyzer-config notes-as-events=true" would convert
notes to normal path notes, and put them at the beginning of the path.
This is a temporary hack to show the new notes in plist files.

A few checkers would be updated in subsequent commits,
including tests for this new feature.

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

llvm-svn: 283092
2016-10-03 07:58:26 +00:00
Aditya Kumar b906230bcb Keep the test only for Itanium abi
llvm-svn: 283085
2016-10-03 02:36:33 +00:00
Michal Gorny 9fbdfd1785 [cmake] Install 'clang-cpp' symlink
Install the 'clang-cpp' symlink used to spawn the preprocessor. The code
handling this suffix is already included in Driver. FreeBSD is already
creating such a symlink in ports, and a similar one was requested
by Gentoo/FreeBSD team. The goal is to handle software that takes a C
preprocessor via a variable but does not handle passing options
correctly (i.e. 'clang -E' does not work).

Bug: https://bugs.gentoo.org/478810

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

llvm-svn: 283075
2016-10-02 19:28:57 +00:00