Commit Graph

68798 Commits

Author SHA1 Message Date
George Burgess IV a911cb4ec8 [docs] Point coroutine link to an actual document
Unsure if there's a better document, but what we had before led to a
404. :)

llvm-svn: 303962
2017-05-26 02:56:51 +00:00
Tim Northover 0150333a3c Create valid LValue to represent null pointers in constant exprs
We were leaving the SubobjectDesignator in a surprising situation, where
it was allegedly valid but didn't actually refer to a type. This caused
a crash later on.

This patch fills out the SubobjectDesignator with the pointee type (as
happens in other evaluations of constant pointers) so that we don't
crash later.

llvm-svn: 303957
2017-05-26 02:16:00 +00:00
Richard Smith 1d60987fd3 Factor resolving of header directives -> files out of module map parser.
llvm-svn: 303945
2017-05-26 00:01:53 +00:00
Richard Trieu d3bc3e0138 "*" => "+" to avoid matching on empty string.
llvm-svn: 303934
2017-05-25 23:25:36 +00:00
Richard Trieu 13b12dc02d Make test/Driver/baremetal.cpp work when output directory isn't named 'bin'.
llvm-svn: 303932
2017-05-25 23:03:08 +00:00
Richard Smith 883dbc43d9 Switch from using a DiagnosticTrap and a note for "while defining a special
member function" context notes to registering an entry on the context stack.

Also reorder the steps within defining special members to be consistent.

This has a few benefits: if multiple diagnostics are produced while checking
such a member, the note is now attached to the first such diagnostic rather
than the last, this prepares us for persisting these diagnostics between the
point at which we require the implicit instantiation of a template and the
point at which that instantiation is actually performed, and this fixes some
cases where we would fail to produce a full note stack leading back to user
code in the case of such a diagnostic.

The reordering exposed a case where we could recursively attempt to define a
defaulted destructor while we're already defining one (and other such cases
also appear to be possible, with or without this change), so this change also
reuses the "willHaveBody" flag on function declarations to track that we're in
the middle of synthesizing a body for the function and bails out if we try to
define a function that we're already defining.

llvm-svn: 303930
2017-05-25 22:47:05 +00:00
Aaron Ballman c674a056e9 Update the getting started documentation to match the corresponding LLVM commit in r303912.
llvm-svn: 303913
2017-05-25 21:02:49 +00:00
Hans Wennborg ca7a3947f5 Make test/Driver/baremetal.cpp pass on Windows
llvm-svn: 303910
2017-05-25 20:39:52 +00:00
Reid Kleckner 581a6c5d56 Revert "[AMDGPU] add __builtin_amdgcn_s_getpc"
This reverts commit r303861, the LLVM intrinsic was reverted.

llvm-svn: 303908
2017-05-25 20:28:26 +00:00
Jonathan Roelofs 9b22df691b Appease more buildbots about r303873
llvm-svn: 303898
2017-05-25 18:55:22 +00:00
Erich Keane d46083cc3b Revert MSVC CXXOperatorNames patch due to issues with Chromium
llvm-svn: 303882
2017-05-25 16:24:49 +00:00
Jonathan Roelofs 8d765ef92d Relax testcase to appease buildbots
When lld isn't built, the tests as they were previously, were too picky about
the path to the linker.

llvm-svn: 303880
2017-05-25 16:20:51 +00:00
Jonathan Roelofs 901c776d06 Don't defer to the GCC driver for linking arm-baremetal
Also comes with a cmake cache for building the runtime bits:

 $ cmake <normal cmake flags> \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259

llvm-svn: 303873
2017-05-25 15:42:13 +00:00
Eric Fiselier 40304afb06 Make git-clang-format python 3 compatible
Summary: This patch attempts to make `git-clang-format` both python2 and python3 compatible. Currently it only works in python2.

Reviewers: modocache, compnerd, djasper, jbcoe, srhines, ddunbar

Reviewed By: jbcoe

Subscribers: kimgr, mgorny, llvm-commits, cfe-commits

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

llvm-svn: 303871
2017-05-25 15:24:04 +00:00
Eric Fiselier fc50f62caa [coroutines] Diagnose when promise types fail to declare either return_void or return_value.
Summary:
According to the PDTS it's perfectly legal to have a promise type that defines neither `return_value` nor `return_void`. However a coroutine that uses such a promise type will almost always have UB, because it can never `co_return`.

This patch changes Clang to diagnose such cases as an error. It also cleans up some of the diagnostic messages relating to member lookup in the promise type.

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303868
2017-05-25 14:59:39 +00:00
Eric Fiselier 4bf928282f [coroutines] Bump __cpp_coroutines version
Summary: This patch is needed so that Libc++ can actually tess if Clang supports coroutines, instead of just paying lip service with a partial implementation. Otherwise the libc++ test suite will fail against older versions of Clang

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303867
2017-05-25 14:58:46 +00:00
Tim Corringham 702fe45bcd [AMDGPU] add __builtin_amdgcn_s_getpc
Summary: Added the builtin corresponding to the s_getpc intrinsic added in llvm D32862

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 303861
2017-05-25 14:16:11 +00:00
Oren Ben Simhon 140c1fb9ec [X86] Adding avx512_vpopcntdq feature set and its intrinsics
AVX512_VPOPCNTDQ is a new feature set that was published by Intel.
The patch represents the Clang side of the addition of six intrinsics for two new machine instructions (vpopcntd and vpopcntq).
It also includes the addition of the new feature set.

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

llvm-svn: 303857
2017-05-25 13:44:11 +00:00
Krzysztof Parzyszek 5960a57ef7 [CodeGen] Pessimize aliasing for member unions (and may-alias) objects
Use the TBAA info of the omnipotent char for these objects.

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

llvm-svn: 303851
2017-05-25 12:55:47 +00:00
Egor Churaev 1db4c88a9a [OpenCL] reserve_id_t cannot be used as argument to kernel function
Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

llvm-svn: 303846
2017-05-25 07:18:37 +00:00
Egor Churaev c1e4611754 [OpenCL] Added regression test on invalid vector initialization.
Summary: This patch increases code coverage.

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: cfe-commits, bader, yaxunl

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

llvm-svn: 303844
2017-05-25 06:55:02 +00:00
Eric Fiselier da8f9b5b1b [coroutines] Fix fallthrough diagnostics for coroutines
Summary:
This patch fixes a number of issues with the analysis warnings emitted when a coroutine may reach the end of the function w/o returning.

* Fix bug where coroutines with `return_value` are incorrectly diagnosed as missing `co_return`'s.
* Rework diagnostic message to no longer say "non-void coroutine", because that implies the coroutine doesn't have a void return type, which it might. In this case a non-void coroutine is one who's promise type does not contain `return_void()`

As a side-effect of this patch, coroutine bodies that contain an invalid coroutine promise objects are marked as invalid.

Reviewers: GorNishanov, rsmith, aaron.ballman, majnemer

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303831
2017-05-25 02:16:53 +00:00
Tim Northover 9d891185ad Revert "Sema: allow imaginary constants via GNU extension if UDL overloads not present."
This reverts commit r303697. It broke libc++ tests that were specifically
checking incompatibility in C++14 mode.

llvm-svn: 303813
2017-05-24 22:18:35 +00:00
Saleem Abdulrasool b6e946b164 Basic: fix whitespace in file header (NFC)
llvm-svn: 303804
2017-05-24 20:27:09 +00:00
Gor Nishanov 33d5fd24a0 [coroutines] Add support for coroutines with non-scalar parameters
Summary:
Simple types like int are handled by LLVM Coroutines just fine.
But for non-scalar parameters we need to create copies of those parameters in the coroutine frame and make all uses of those parameters to refer to parameter copies.

Reviewers: rsmith, EricWF, GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303803
2017-05-24 20:09:14 +00:00
Erich Keane 25411b7684 For Microsoft compatibility, set fno_operator_names
There's a Microsoft header in the Windows SDK which won't 
compile with clang because it uses an operator name (and) 
as a field name. This patch allows that file to compile by 
setting the option which disables operator names. 
The header which doesn't compile <Query.h> C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40: 
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
                   ~~~~~~~~~~~~~~~ ^

                   1 error generated.

Contributed for Melanie Blower

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

llvm-svn: 303798
2017-05-24 19:31:19 +00:00
Argyrios Kyrtzidis 5f0c0aaf5a Address follow-up feedback for r303712
llvm-svn: 303789
2017-05-24 18:35:01 +00:00
Tony Jiang f70a913e13 Fix one test case faiulre in commit 303766.
It is clean when I build boostrap and run make checkall on my machine, I guess
it could be I only build bootstrap with assert, while the buildbots may build
without asserts, which could cause the difference.

llvm-svn: 303786
2017-05-24 18:12:11 +00:00
Alexey Bataev 979966fcd8 [OPENMP] Allow value of thread local variables in target regions.
If the variable is marked as TLS variable and target device does not
support TLS, the error is emitted for the variable even if it is not
used in target regions. Patch fixes this and allows to use the values of
the TLS variables in target regions.

llvm-svn: 303768
2017-05-24 16:00:02 +00:00
Tony Jiang 9aa2c0383d [PowerPC] Implement vec_xxsldwi builtin.
The vec_xxsldwi builtin is missing from altivec.h. This has been requested by
developers working on libvpx for VP9 support for Google.

The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653
Differential Revision: https://reviews.llvm.org/D33236

llvm-svn: 303766
2017-05-24 15:54:13 +00:00
Gor Nishanov afff89eecb [coroutines] Make generic lambda coroutines work
Summary:
1. Coroutine cannot be constexpr (added a check in SemaLambda.cpp not to mark coroutine as constexpr)
2. TransformCoroutineBodyStmt should transform ResultDecl and ReturnStmt

Reviewers: rsmith, GorNishanov

Reviewed By: GorNishanov

Subscribers: EricWF, cfe-commits

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

llvm-svn: 303764
2017-05-24 15:44:57 +00:00
Alex Lorenz 0a484baa85 Warn about uses of `@available` that can't suppress the
-Wunguarded-availability warnings

rdar://32306520

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

llvm-svn: 303761
2017-05-24 15:15:29 +00:00
Tony Jiang bbc48e9164 [PowerPC] Implement vec_xxpermdi builtin.
The vec_xxpermdi builtin is missing from altivec.h. This has been requested by
developers working on libvpx for VP9 support for Google.

The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653
Differential Revision: https://reviews.llvm.org/D33053

llvm-svn: 303760
2017-05-24 15:13:32 +00:00
Serge Pavlov b43573b9a4 Driver must return non-zero code on errors in command line
This is recommit of r302775, reverted in r302777 due to a fail in
clang-tidy. Original mesage is below.

Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

llvm-svn: 303756
2017-05-24 14:57:17 +00:00
Tony Jiang edc7849b1b Generalize two diagnostic messages to take function name as parameter.
llvm-svn: 303753
2017-05-24 14:45:57 +00:00
Gor Nishanov 29ff638cbf [coroutines] Improved diagnostics when unhandled_exception is missing in the promise_type
Summary: Now we helpfully provide a note pointing at the promise_type in question.

Reviewers: EricWF, GorNishanov

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303752
2017-05-24 14:34:19 +00:00
Alex Lorenz cc8e8494ad [index] The references to explicit class properties should be recorded
rdar://32376363

llvm-svn: 303751
2017-05-24 14:23:40 +00:00
Gor Nishanov ab7e8aebee [coroutines] [NFC] Add tests for return_void, unhandled_exception and promise dtor
Summary:
* Test that coroutine promise destructor is called.
* Test that we call return_void on fallthrough
* Test that we call unhandled exception in a try catch surrounding the body

Reviewers: EricWF, GorNishanov

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303748
2017-05-24 14:19:48 +00:00
Krasimir Georgiev 65e7206799 [clang-format] Remove unused using directive, NFC
llvm-svn: 303742
2017-05-24 12:15:42 +00:00
Serge Pavlov c46064c2a9 Method loadFromCommandLine should be able to report errors
Now FixedCompilationDatabase::loadFromCommandLine has no means to report
which error occurred if it fails to create compilation object. This is
a block for implementing D33013, because after that change driver will
refuse to create compilation if command line contains erroneous options.

This change adds additional argument to loadFromCommandLine, which is
assigned error message text if compilation object was not created. This is
the same way as other methods of CompilationDatabase report failure.

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

llvm-svn: 303741
2017-05-24 11:57:37 +00:00
Francois Ferrand a6b6d51ba4 clang-format: Introduce BreakConstructorInitializers option
Summary:
This option replaces the BreakConstructorInitializersBeforeComma option with an enum, thus introducing a mode where the colon stays on the same line as constructor declaration:

  // When it fits on line:
  Constructor() : initializer1(), initializer2() {}

  // When it does not fit:
  Constructor() :
      initializer1(), initializer2()
  {}

  // When ConstructorInitializerAllOnOneLineOrOnePerLine = true:
  Constructor() :
      initializer1(),
      initializer2()
  {}

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303739
2017-05-24 11:36:58 +00:00
Simon Pilgrim 2f5139340e Fix 'set but not used' [-Wunused-but-set-variable] warning
llvm-svn: 303734
2017-05-24 10:38:09 +00:00
Dean Michael Berris 170429e290 [XRay][clang] Allow imbuing arg1 logging attribute via -fxray-always-instrument=
Summary:
This change allows us to add arg1 logging support to functions through
the special case list provided through -fxray-always-instrument=. This
is useful for adding arg1 logging to functions that are either in
headers that users don't have control over (i.e. cannot change the
source) or would rather not do.

It only takes effect when the pattern is matched through the "fun:"
special case, as a category. As in:

  fun:*pattern=arg1

Reviewers: pelikan, rnk

Subscribers: cfe-commits

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

llvm-svn: 303719
2017-05-24 05:46:36 +00:00
Gor Nishanov 4c2f68fd7c [coroutines] Implement correct GRO lifetime
Summary:
Sema creates a declaration for gro variable as:

auto $gro = $promise.get_return_object();

However, gro variable has to outlive coroutine frame and coroutine promise, but,
it can only be initialized after the coroutine promise was created, thus, we
split its emission in two parts: EmitGroAlloca emits an alloca and sets up
the cleanups. Later when the coroutine promise is available we initialize
the gro and set the flag that the cleanup is now active.

Duplicate of: https://reviews.llvm.org/D31670 (which arc patch refuses to apply for some reason)

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, cfe-commits

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

llvm-svn: 303716
2017-05-24 02:38:26 +00:00
Gor Nishanov db615dd677 [coroutines] Fix leak in CGCoroutine.cpp
FinalBB need to be emitted even when unused to make sure it is deleted

llvm-svn: 303714
2017-05-24 01:54:37 +00:00
Argyrios Kyrtzidis 9f4950afd2 Change __has_feature(objc_diagnose_if_attr) to __has_feature(attribute_diagnose_if_objc) for consistency with rest of attribute checks.
llvm-svn: 303713
2017-05-24 01:38:00 +00:00
Argyrios Kyrtzidis a7233bd801 Enhance the 'diagnose_if' attribute so that we can apply it for ObjC methods and properties as well
This is an initial commit to allow using it with constant expressions, a follow-up commit will enable full support for it in ObjC methods.

llvm-svn: 303712
2017-05-24 00:46:27 +00:00
Bruno Cardoso Lopes f664a24aa3 [Modules] Fix overly conservative assertion for import diagnostic
We currenltly assert when want to diagnose a missing import and the decl
in question is already visible. It turns out that the decl in question
might be visible because another decl from the same module actually made
the module visible in a previous error diagnostic.

Remove the assertion and avoid re-exporting the module if it's already
visible.

rdar://problem/27975402

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

llvm-svn: 303705
2017-05-23 23:53:17 +00:00
Richard Smith ae50c56d65 [modules] When reparenting a local declaration, don't mark the declaration as
being visible with its owning module if we're not tracking owning modules for
local declarations.

This avoids the possibility of a declaration being (meaninglessly) marked as
hidden with no owning module, which would otherwise lead to violated AST
invariants (checked by the added assertion).

llvm-svn: 303699
2017-05-23 22:02:49 +00:00
Tim Northover 6b5eceac2e Sema: allow imaginary constants via GNU extension if UDL overloads not present.
C++14 added user-defined literal support for complex numbers so that you can
write something like "complex<double> val = 2i". However, there is an existing
GNU extension supporting this syntax and interpreting the result as a _Complex
type.

This changes parsing so that such literals are interpreted in terms of C++14's
operators if an overload is present but otherwise falls back to the original
GNU extension.

llvm-svn: 303694
2017-05-23 21:41:49 +00:00