Commit Graph

81284 Commits

Author SHA1 Message Date
Elizabeth Andrews 878a24ee24 Reapply "Fix crash on switch conditions of non-integer types in templates"
This patch reapplies commit 759948467e. Patch was reverted due to a
clang-tidy test fail on Windows. The test has been modified. There
are no additional code changes.

Patch was tested with ninja check-all on Windows and Linux.

Summary of code changes:

Clang currently crashes for switch statements inside a template when the
condition is a non-integer field member because contextual implicit
conversion is skipped when parsing the condition. This conversion is
however later checked in an assert when the case statement is handled.
The conversion is skipped when parsing the condition because
the field member is set as type-dependent based on its containing class.
This patch sets the type dependency based on the field's type instead.

This patch fixes Bug 40982.
2019-12-03 15:27:19 -08:00
Akira Hatanaka f139ae3d93 [NFC] Pass a reference to CodeGenFunction to methods of LValue and
AggValueSlot

This reapplies 8a5b7c3570 after a null
dereference bug in CGOpenMPRuntime::emitUserDefinedMapper.

Original commit message:

This is needed for the pointer authentication work we plan to do in the
near future.

a63a81bd99/clang/docs/PointerAuthentication.rst
2019-12-03 15:22:13 -08:00
Reid Kleckner 705a6aef35 [MS] Emit exported complete/vbase destructors
Summary:
Fixes PR44205

I checked, and deleting destructors are not affected.

Reviewers: hans

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70931
2019-12-03 14:46:32 -08:00
Akira Hatanaka 9f37c0e703 Revert "[NFC] Pass a reference to CodeGenFunction to methods of LValue and"
This reverts commit 8a5b7c3570. This seems
to have broken UBSan because of a null dereference.
2019-12-03 13:08:01 -08:00
Michael Liao 59e69fefab Fix warning on extra ';'. NFC. 2019-12-03 16:02:55 -05:00
Vedant Kumar 859bf4d2be [Coverage] Emit a gap region to cover switch bodies
Emit a gap region beginning where the switch body begins. This sets line
execution counts in the areas between non-overlapping cases to 0.

This also removes some special handling of the first case in a switch:
these are now treated like any other case.

This does not resolve an outstanding issue with case statement regions
that do not end when a region is terminated. But it should address
llvm.org/PR44011.

Differential Revision: https://reviews.llvm.org/D70571
2019-12-03 12:35:54 -08:00
Aaron Ballman bf830b01a2 Switch to opening the temp file in binary mode
This corrects an issue where the script would write the file with the
incorrect line endings on Windows.
2019-12-03 15:31:46 -05:00
Tyker bc840b21e1 [Diagnostic] add a warning which warns about misleading indentation
Summary: Add a warning for misleading indentation similar to GCC's -Wmisleading-indentation

Reviewers: aaron.ballman, xbolva00

Reviewed By: aaron.ballman, xbolva00

Subscribers: tstellar, cfe-commits, arphaman, Ka-Ka, thakis

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70638
2019-12-03 21:21:27 +01:00
Tyker 2f96047275 [NFCI] update formating for misleading indentation warning
Reviewers: xbolva00

Reviewed By: xbolva00

Differential Revision: https://reviews.llvm.org/D70861
2019-12-03 21:21:27 +01:00
Akira Hatanaka 8a5b7c3570 [NFC] Pass a reference to CodeGenFunction to methods of LValue and
AggValueSlot

This is needed for the pointer authentication work we plan to do in the
near future.

a63a81bd99/clang/docs/PointerAuthentication.rst
2019-12-03 11:30:09 -08:00
Aaron Ballman 898df29c5b Correcting the offsets within the test to fix the bots. 2019-12-03 13:21:35 -05:00
Aaron Ballman fa6c157ebe Differentiate between the presumed and actual file when dumping the AST to JSON
Currently, when dumping the AST to JSON, the presumed file is what is included
when dumping a source location. This patch changes the behavior to instead dump
the actual file, and only dump a presumed file name when it differs from the
actual file.

This also corrects an issue with the test script generator that would prevent
it from working on Windows due to file permissions issues.
2019-12-03 13:05:59 -05:00
Mitchell Balan 26748a321e [clang-format] Add new option to add spaces around conditions
Summary:
This diff adds a new option SpacesAroundConditions that inserts spaces inside the braces for conditional statements.

Reviewers: klimek, owenpan, mitchell-stellar, MyDeveloperDay

Patch by: timwoj

Subscribers: rsmmr, cfe-commits

Tags: clang, clang-format

Differential Revision: https://reviews.llvm.org/D68346
2019-12-03 12:20:54 -05:00
Sam McCall c9c714c705 Reland [clangd] Rethink how SelectionTree deals with macros and #includes.
This reverts commit 905b002c13.

Avoid tricky (and invalid) comparator for std::set.
2019-12-03 17:53:43 +01:00
Mariya Podchishchaeva c094e7dc4b [SYCL] Add sycl_kernel attribute for accelerated code outlining
SYCL is single source offload programming model relying on compiler to
separate device code (i.e. offloaded to an accelerator) from the code
executed on the host.

Here is code example of the SYCL program to demonstrate compiler
outlining work:

```
int foo(int x) { return ++x; }
int bar(int x) { throw std::exception("CPU code only!"); }
...
using namespace cl::sycl;
queue Q;
buffer<int, 1> a(range<1>{1024});
Q.submit([&](handler& cgh) {
  auto A = a.get_access<access::mode::write>(cgh);
  cgh.parallel_for<init_a>(range<1>{1024}, [=](id<1> index) {
    A[index] = index[0] + foo(42);
  });
}
...
```

SYCL device compiler must compile lambda expression passed to
cl::sycl::handler::parallel_for method and function foo called from this
lambda expression for an "accelerator". SYCL device compiler also must
ignore bar function as it's not required for offloaded code execution.

This patch adds the sycl_kernel attribute, which is used to mark code
passed to cl::sycl::handler::parallel_for as "accelerated code".

Attribute must be applied to function templates which parameters include
at least "kernel name" and "kernel function object". These parameters
will be used to establish an ABI between the host application and
offloaded part.

Reviewers: jlebar, keryell, Naghasan, ABataev, Anastasia, bader, aaron.ballman, rjmccall, rsmith

Reviewed By: keryell, bader

Subscribers: mgorny, OlegM, ArturGainullin, agozillon, aaron.ballman, ebevhan, Anastasia, cfe-commits

Tags: #clang

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

Signed-off-by: Alexey Bader <alexey.bader@intel.com>
2019-12-03 16:13:22 +03:00
Anastasia Stulova 980133a209 [OpenCL] Use generic addr space for lambda call operator
Since lambdas are represented by callable objects, we add
generic addr space for implicit object parameter in call
operator.

Any lambda variable declared in __constant addr space
(which is not convertible to generic) fails to compile with
a diagnostic. To support constant addr space we need to
add a way to qualify the lambda call operators.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69938
2019-12-03 16:07:18 +00:00
Nicolas Manichon cc3c935da2 Add FunctionDecl::getParameterSourceRange()
This source range covers the list of parameters of the function declaration,
including the ellipsis for a variadic function.
2019-12-03 08:21:55 -05:00
Russell Gallop aedeab7f85 [Support] Add ProcName to TimeTraceProfiler
This was hard-coded to "clang". This change allows it to to be used on
processes other than clang (such as lld).

This gets reported as clang-10 on Linux and clang.exe on Windows so
adapted test to accommodate this.

Differential Revision: https://reviews.llvm.org/D70950
2019-12-03 13:04:27 +00:00
Sven van Haastregt 6713670b17 [OpenCL] Fix mangling of single-overload builtins
Commit 9a8d477a0e ("[OpenCL] Add builtin function attribute
handling", 2019-11-05) stopped Clang from mangling single-overload
builtins, which is incorrect.
2019-12-03 11:09:16 +00:00
Kadir Cetinkaya 01a26fa74a
[clang][CodeGen] Make use of cc1 instead of clang in the tests 2019-12-03 12:02:26 +01:00
Sourabh Singh Tomar f1e3988aa6 Recommit "[DWARF5]Addition of alignment atrribute in typedef DIE."
This revision is revised to update Go-bindings and Release Notes.

The original commit message follows.

This patch, adds support for DW_AT_alignment[DWARF5] attribute, to be emitted with typdef DIE.
When explicit alignment is specified.

Patch by Awanish Pandey <Awanish.Pandey@amd.com>

Reviewers: aprantl, dblaikie, jini.susan.george, SouraVX, alok,
deadalinx

Differential Revision: https://reviews.llvm.org/D70111
2019-12-03 09:51:43 +05:30
Alex Lorenz 389530524b [clang-scan-deps] do not skip empty #if/#elif in the minimizer to avoid missing `__has_include` dependencies
This patch makes the minimizer more conservative to avoid missing dependency files that are brought in by __has_include
PP expressions that occur in a condition of an #if/#elif that was previously skipped. The __has_include PP expressions
can be used in an #if/#elif either directly, or through macro expansion, so we can't detect them at the time of minimization.

Differential Revision: https://reviews.llvm.org/D70936
2019-12-02 18:47:22 -08:00
Reid Kleckner 536cedaecb FileCheck IR output for blockaddress in new test
Minor improvement to a test added in 1ac700cdef
2019-12-02 15:05:50 -08:00
Thomas Preud'homme 717140a0dc [clang test] Do not assume default target
Summary:
clang test Driver/darwin-opt-record.c assumes the default target is
x86_64 by its uses of the -arch x86_64 and -arch x86_64h and thus fail
on systems where it is not the case. Adding a target
x86_64-apple-darwin10 reveals another problem: the driver refuses 2
-arch for an assembly output so this commit also changes the output to
be an object file.

Reviewers: thegameg

Reviewed By: thegameg

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70748
2019-12-02 22:57:30 +00:00
Richard Smith 711c669ae9 Fix comment to more accurately describe C++ language requirements around tail padding.
Summary:
As of C++ core issue 43 (http://wg21.link/cwg43), which was voted into
the C++ working draft in 1999, it is not permissible to memcpy a base
class subobject, even if it's of POD type, so there is no problem with
reusing the tail padding of a base class. That issue was voted into the
standard in DR status, so it applies retroactively to C++98 (and is in
any case part of C++03).

So stop suggesting that AlwaysUseTailPadding mode is non-conforming.

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70923
2019-12-02 14:41:27 -08:00
Dan Gohman 8f1e2151b8 [WebAssembly] Find wasm-opt with GetProgramPath
Instead of just searching for wasm-opt in PATH, use GetProgramPath, which
checks the `COMPILER_PATH` environment variable, -B paths, and `PATH`.

Differential Revision: https://reviews.llvm.org/D70780
2019-12-02 11:48:36 -08:00
David Green 1d4587346f [AArch64] Attempt to fixup test line. NFC
The test is complaining on some of the builders. This attempts to
adjust the run line to be more line the others in the same folder, using
clang_cc1 as opposed to the driver.
2019-12-02 19:30:54 +00:00
Alexey Bataev f17a1d8b28 [OPENMP]Use cast instead dyn_cast, NFC.
Here the expression is always a DeclRefExpr, no need to use dyn_cast.
2019-12-02 14:16:52 -05:00
Alexey Bataev 478541a6da [OPENMP]Fix PR44133: Emit definitions of used constructors/functions.
Need to fully rebuild the initializer/combiner when instatiating the
declare reduction constrcut to properly emit used functions.
2019-12-02 14:07:29 -05:00
Tyker 9ec6d71211 [clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70190
2019-12-02 19:55:13 +01:00
stevewan 3ebfab7095 Add AIX assembler support
Summary:
A skeleton of AIX toolchain and system linker support has been introduced in D68340, and this is a follow on patch to it.
This patch adds support to system assembler invocation to the AIX toolchain.

Reviewers: daltenty, hubert.reinterpretcast, jasonliu, Xiangling_L, dlj

Reviewed By: daltenty, hubert.reinterpretcast

Subscribers: wuzish, nemanjai, kbarton, jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69620
2019-12-02 11:29:36 -05:00
Simon Tatham d173fb5d28 [ARM,MVE] Add intrinsics to deal with predicates.
Summary:
This commit adds the `vpselq` intrinsics which take an MVE predicate
word and select lanes from two vectors; the `vctp` intrinsics which
create a tail predicate word suitable for processing the first m
elements of a vector (e.g. in the last iteration of a loop); and
`vpnot`, which simply complements a predicate word and is just
syntactic sugar for the `~` operator.

The `vctp` ACLE intrinsics are lowered to the IR intrinsics we've
already added (and which D70592 just reorganized). I've filled in the
missing isel rule for VCTP64, and added another set of rules to
generate the predicated forms.

I needed one small tweak in MveEmitter to allow the `unpromoted` type
modifier to apply to predicates as well as integers, so that `vpnot`
doesn't pointlessly convert its input integer to an `<n x i1>` before
complementing it.

Reviewers: ostannard, MarkMurrayARM, dmgreen

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D70485
2019-12-02 16:20:30 +00:00
Victor Campos dcf11c5e86 [ARM][AArch64] Complex addition Neon intrinsics for Armv8.3-A
Summary:
Add support for vcadd_* family of intrinsics. This set of intrinsics is
available in Armv8.3-A.

The fp16 versions require the FP16 extension, which has been available
(opt-in) since Armv8.2-A.

Reviewers: t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D70862
2019-12-02 14:38:39 +00:00
Sven van Haastregt 6236496561 [OpenCL] Fix address space for implicit conversion (PR43145)
Clang was creating a DerivedToBase ImplicitCastExpr that was also
casting between address spaces as part of the second step in the
standard conversion sequence.  Defer the address space conversion to
the third step in the sequence instead, such that we get a separate
ImplicitCastExpr for the address space conversion.

Differential Revision: https://reviews.llvm.org/D70605
2019-12-02 14:20:15 +00:00
Mark Murray 510792a2e0 [ARM][MVE][Intrinsics] Add VMINQ/VMAXQ/VMINNMQ/VMAXNMQ intrinsics.
Summary: Add VMINQ/VMAXQ/VMINNMQ/VMAXNMQ intrinsics and their predicated versions. Add unit tests.

Subscribers: kristof.beyls, hiraditya, dmgreen, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D70829
2019-12-02 11:18:53 +00:00
Tyker ae5484540f Revert "[clang][modules] Add support for merging lifetime-extended temporaries"
This reverts commit a3cbe1a202.
2019-12-01 22:38:31 +01:00
Tyker a3cbe1a202 [clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70190
2019-12-01 21:28:48 +01:00
Tyker 486d1a5358 Revert "[clang][modules] Add support for merging lifetime-extended temporaries"
This reverts commit 85c7438477.
2019-12-01 11:58:14 +01:00
Tyker 85c7438477 [clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70190
2019-11-30 23:09:11 +01:00
Brian Gesiak 8682d29a28 [Format] Add format check for coroutine keywords with negative numbers
Summary:
As a followup to D69144, this diff fixes the coroutine keyword spacing
for co_yield / co_returning negative numbers.

Reviewers: modocache, sammccall, Quuxplusone

Reviewed By: modocache

Subscribers: cfe-commits

Tags: #clang

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

Patch by Jonathan Thomas (jonathoma)!
2019-11-30 15:47:58 -05:00
Tyker 3f4b70c79e Revert "[clang][modules] Add support for merging lifetime-extended temporaries"
This reverts commit 3c7f6b4396.
2019-11-30 17:52:26 +01:00
Tyker 3c7f6b4396 [clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70190
2019-11-30 16:42:33 +01:00
Sam McCall 905b002c13 Revert "[clangd] Rethink how SelectionTree deals with macros and #includes."
This reverts commit 19daa21f84.

It causes a bunch of failures on a bot that I've been unable to
reproduce so far:
http://45.33.8.238/mac/3308/step_7.txt
2019-11-29 19:59:02 +01:00
Carey Williams 76fd58d0fe Revert "[ARM] Allocatable Global Register Variables for ARM"
This reverts commit 2d739f98d8.
2019-11-29 17:01:05 +00:00
Alexandre Ganea 3b0b7536a3 On Windows, fix fuse-ld.c test when lld is provided explictly in -DCMAKE_LINKER 2019-11-29 11:28:49 -05:00
Alexandre Ganea 471d06020a [CIndex] Fix annotate-deep-statements test when using a Debug build
Differential Revision: https://reviews.llvm.org/D70149
2019-11-29 10:52:20 -05:00
Sam McCall 19daa21f84 [clangd] Rethink how SelectionTree deals with macros and #includes.
Summary:
The exclusive-claim model is successful at resolving conflicts over tokens
between parent/child or siblings. However claims at the spelled-token
level do the wrong thing for macro expansions, where siblings can be
equally associated with the macro invocation.
Moreover, any model that only uses the endpoints in a range can fail when
a macro invocation occurs inside the node.

To address this, we use the existing TokenBuffer in more depth.
Claims are expressed in terms of expanded tokens, so there is no need to worry
about macros, includes etc.

Once we know which expanded tokens were claimed, they are mapped onto
spelled tokens for hit-testing.
This mapping is fairly flexible, currently the handling of macros is
pretty simple (map macro args onto spellings, other macro expansions onto the
macro name token).
This mapping is in principle token-by-token for correctness (though
there's some batching for performance).

The aggregation of the selection enum is now more principled as we need to be
able to aggregate several hit-test results together.

For simplicity i removed the ability to determine selectedness of TUDecl.
(That was originally implemented in 90a5bf92ff97b1, but doesn't seem to be very
important or worth the complexity any longer).

The expandedTokens(SourceLocation) helper could be added locally, but seems to
make sense on TokenBuffer.

Fixes https://github.com/clangd/clangd/issues/202
Fixes https://github.com/clangd/clangd/issues/126

Reviewers: hokein

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, ilya-biryukov

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70512
2019-11-29 15:21:13 +01:00
Ilya Biryukov e702bdb859 [Syntax] Build SimpleDeclaration node that groups multiple declarators
Summary:
Also remove the temporary TopLevelDeclaration node and add
UnknownDeclaration to represent other unknown nodes.

See the follow-up change for building more top-level declarations.
Adding declarators is also pretty involved and will be done in another
follow-up patch.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70787
2019-11-29 11:39:45 +01:00
Ilya Biryukov 4b24ab181a [AST] Remove unused and undefined `TypeLoc::IgnoreMacroDefinitions` function. NFC
Looks like an accidental leftover from the older version of the code.
2019-11-29 11:21:07 +01:00
Sam McCall 407ac2eb5f [clangd] Log cc1 args at verbose level.
Summary: This will help debugging driver issues.

Reviewers: kbobyrev

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70832
2019-11-29 11:00:01 +01:00