Commit Graph

80929 Commits

Author SHA1 Message Date
Jan Korous 03b84e4f6d [clang] Report sanitizer blacklist as a dependency in cc1
Previously these were reported from the driver which blocked clang-scan-deps from getting the full set of dependencies from cc1 commands.

Also the default sanitizer blacklist that is added in driver was never reported as a dependency. I introduced -fsanitize-system-blacklist cc1 option to keep track of which blacklists were user-specified and which were added by driver and clang -MD now also reports system blacklists as dependencies.

Differential Revision: https://reviews.llvm.org/D69290
2019-11-07 14:06:43 -08:00
Dávid Bolvanský 01b10bc7b1 [Diagnostics] Teach -Wnull-dereference about address_space attribute
Summary:
Clang should not warn for:

> test.c:2:12: warning: indirection of non-volatile null pointer will be deleted,
>       not trap [-Wnull-dereference]
>     return *(int __attribute__((address_space(256))) *) 0;
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Solves PR42292.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69664
2019-11-07 22:43:27 +01:00
Vedant Kumar b95bb0847a [CodeGenModule] Group blocks runtime globals together, NFC 2019-11-07 12:46:26 -08:00
Mark de Wever 2b943c4687 [Sema] Fixes a crash with a templated destructor
The issue was introduced by D33189 which fixed PR33189.

Fixes PR38671: "destructor cannot be declared as a template" leads to segfault in Sema::LookupSpecialMember

Differential Revision: https://reviews.llvm.org/D69225
2019-11-07 21:22:27 +01:00
David Blaikie 8d8f9c2440 [clang] Add -fdebug-default-version for specifying the default DWARF version
This flag decouples specifying the DWARF version from enabling/disabling
DWARF in general (or the gN level - gmlt/limited/standalone, etc) while
still allowing existing -gdwarf-N flags to override this default.

Patch by Caroline Tice!

Differential Revision: https://reviews.llvm.org/D69822
2019-11-07 12:05:58 -08:00
Edward Jones 90ecfa2f5f Revert "[Sema] Suppress -Wchar-subscripts if the index is a literal char"
This reverts commit 7adab7719e.
2019-11-07 18:45:40 +00:00
Reid Kleckner dd870f6929 Fix warning about unused std::unique result, erase shifted elements
This is actually a functional change. I haven't added any new test
coverage. I'm just trying to fix the warning and hoping for the best.
2019-11-07 10:39:29 -08:00
Reid Kleckner f37b5c800e [RISCV] Fix up tests on Windows after new usage of sys::path::append 2019-11-07 09:53:56 -08:00
Alexey Bataev bcf754a321 [OPENMP][DOCS] Update OpenMP status (NFC)
Summary: This is updating the OpenMP status table. Cray has volunteered for `defaultmap` and supporting `in_reduction` on the `target` construct, so the status on those entries from was changed from "unclaimed". Also, a new entry was added for supporting non-contiguous arrays sections on the `target update` directive.

Reviewers: ABataev, hfinkel, jdoerfert, kkwli0

Reviewed By: ABataev

Subscribers: guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69923
2019-11-07 11:07:56 -05:00
Edward Jones 7adab7719e [Sema] Suppress -Wchar-subscripts if the index is a literal char
Assume that the user knows what they're doing if they provide a char
literal as an array index. This more closely matches the behavior of
GCC.

Differential Revision: https://reviews.llvm.org/D58896
2019-11-07 15:45:44 +00:00
Melanie Blower af57dbf12e Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior=
Add options to control floating point behavior: trapping and
    exception behavior, rounding, and control of optimizations that affect
    floating point calculations. More details in UsersManual.rst.

    Reviewers: rjmccall

    Differential Revision: https://reviews.llvm.org/D62731
2019-11-07 07:22:45 -08:00
Edward Jones de61aa3118 [RISCV] Improve sysroot computation if no GCC install detected
If a GCC installed is not detected, the driver would default to
the root of the filesystem. This is not ideal when this doesn't
match the install directory of the toolchain and can cause
undesireable behavior such as picking up system libraries or
the system linker when cross-compiling.

Differential Revision: https://reviews.llvm.org/D68391
2019-11-07 15:17:40 +00:00
Sven van Haastregt 3d30f2cff7 [OpenCL] Add geometric and relational builtin functions
Add the geometric and relational builtin functions from the OpenCL C
specification.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D69908
2019-11-07 15:00:19 +00:00
Sven van Haastregt 0e70c35094 [OpenCL] Add integer builtin functions
This patch adds the integer builtin functions from the OpenCL C
specification.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D69901
2019-11-07 14:59:33 +00:00
Tim Northover 10e0d64337 CodeGen: set correct result for atomic compound expressions
Atomic compound expressions try to use atomicrmw if possible, but this
path doesn't set the Result variable, leaving it to crash in later code
if anything ever tries to use the result of the expression. This fixes
that issue by recalculating the new value based on the old one
atomically loaded.
2019-11-07 13:36:44 +00:00
Sven van Haastregt 6fc73f6366 [OpenCL] Add math and common builtin functions
Add the remaining math and common builtin functions from the OpenCL C
specification.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D69883
2019-11-07 13:16:04 +00:00
Simon Atanasyan a751f557d8 [mips] Set macros for Octeon+ CPU 2019-11-07 13:58:51 +03:00
Simon Atanasyan 3552d3e0f7 [mips] Add `octeon+` to the list of CPUs accepted by the driver 2019-11-07 13:58:50 +03:00
Haojian Wu 118f7836a6 [clang-rename] Respect the traversal scope when traversing the entire AST.
Summary:
This should be NFC to clang-rename, by default the traversal scope is
TUDecl. Traversing the TUDecl in clangd is a performance cliff, we should
avoid it.

Reviewers: ilya-biryukov

Subscribers: kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69892
2019-11-07 10:43:54 +01:00
Hans Wennborg 5b9a072c39 Revert a5c8ec4 "[CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood"
This caused Chromium builds to fail with "inlinable function call in a function
with debug info must have a !dbg location" errors. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1022296#c1 for a
reproducer.

> Currently, clang emits subprograms for declared functions when the
> target debugger or DWARF standard is known to support entry values
> (DW_OP_entry_value & the GNU equivalent).
>
> Treat DW_AT_tail_call the same way to allow debuggers to follow cross-TU
> tail calls.
>
> Pre-patch debug session with a cross-TU tail call:
>
> ```
>   * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt]
>     frame #1: 0x0000000100000f99 main`main at a.c:8:10 [opt]
> ```
>
> Post-patch (note that the tail-calling frame, "helper", is visible):
>
> ```
>   * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt]
>     frame #1: 0x0000000100000f80 main`helper [opt] [artificial]
>     frame #2: 0x0000000100000f99 main`main at a.c:8:10 [opt]
> ```
>
> rdar://46577651
>
> Differential Revision: https://reviews.llvm.org/D69743
2019-11-07 10:30:07 +01:00
Anders Waldenborg 86825dbe33 [clang-format] Make '.clang-format' variants finding a loop (NFC)
This simplifies logic making it trivial to add searching for other
files later.

Differential revision: https://reviews.llvm.org/D68568
2019-11-07 10:00:04 +01:00
Ilya Biryukov 96065cf79f [Syntax] Silence "unused function" warning in no-assert builds. NFC
A helper `isImpicitExpr` is only used inside assert.
2019-11-07 09:37:25 +01:00
kristina 79c89033fd [Clang] Add ENABLE_LINKER_BUILD_ID to Hurd driver.
This was added for Linux toolchains in rC271692, this
patch extends this to the Hurd toolchain.

Patch by sthibaul (Samuel Thibault)

Differential Revision: https://reviews.llvm.org/D69754
2019-11-07 06:10:14 +00:00
Kelvin Li 9f10cc2d12 [OPENMP] [DOCS] fix section formatting issues [NFC]
Differential Revision: https://reviews.llvm.org/D69909
2019-11-06 22:03:09 -05:00
paulhoad eadb65f273 [clang-format] [NFC] update the documentation in Format.h to allow dump_format_style.py to get a little closer to being correct. (part 2)
Summary:
a change {D67541} cause LanguageStandard to now be subtly different from all other clang-format options, in that the Enum value (less the prefix) is not always allowed as valid as the configuration option.

This caused the ClangFormatStyleOptions.rst and the Format.h to diverge so that the ClangFormatStyleOptions.rst could no longer be generated from the Format.h using dump_format_stlye.py

This fix tried to remedy that:

1) by allowing an additional comment (in Format.h) after the enum to be used as the `in configuration ( XXXX )`  text, and changing the dump_format_style.py to support that.

This makes the following code:

```
enum {
...
LS_Cpp03, // c++03
LS_Cpp11, // c++11
...
};
```

would render as:

```* ``LS_Cpp03`` (in configuration: ``c++03``)
* ``LS_Cpp11`` (in configuration: ``c++11``)
```

And we also  move the deprecated alias into the text of the enum (otherwise it won't be added at the end as an option)

This patch includes a couple of other whitespace changes which help bring Format.h and ClangFormatStyleOptions.rst almost back into line and regeneratable...  (there is still one more)

Reviewers: klimek, mitchell-stellar, sammccall

Reviewed By: mitchell-stellar, sammccall

Subscribers: mrexodia, cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D69433
2019-11-06 20:03:05 +00:00
David Tenty 6740a88dc1 [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()
Summary:
this allows us to move logic about when it is appropriate set
LLVM_NO_DEAD_STRIP out of each tool and into add_llvm_executable,
which will enable future platform specific handling.

This is a follow on to the reverted D69356

Reviewers: hubert.reinterpretcast, beanz, lhames

Reviewed By: beanz

Subscribers: mgorny, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69638
2019-11-06 14:32:35 -05:00
Craig Topper a8ccb48f69 [X86] Add 'fxsr' feature to -march=pentium2 to match X86.td and gcc. 2019-11-06 10:27:53 -08:00
Craig Topper ba73aad4f6 [X86] Add 'mmx' to all CPUs that have a version of 'sse' and weren't already enabling '3dnow'
All SSE capable CPUs have MMX. 3dnow implicitly enables MMX.

We have code that detects if sse is enabled and implicitly enables
MMX unless -mno-mmx is passed. So in most cases we were already
enabling MMX if march passed a CPU that supported SSE.

The exception to this is if you pass -march for a cpu supports SSE
and also pass -mno-sse. We should still enable MMX since its part
of the CPU capability.
2019-11-06 10:02:40 -08:00
paulhoad 3ddac7e563 [clang-format] [RELAND] Remove the dependency on frontend
Summary: relanding {D68969} after it failed UBSAN build caused by the passing of an invalid SMLoc() (nullptr)

Reviewers: thakis, vlad.tsyrklevich, klimek, mitchell-stellar

Reviewed By: thakis

Subscribers: merge_guards_bot, mgorny, cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D69854
2019-11-06 17:33:37 +00:00
paulhoad 7681435de1 [clang-format] Assert that filenames are not empty
Summary:
Adds asserts to catch empty filenames, which otherwise will cause a crash in SourceManager.
The clang-format tool now outputs an error if an empty filename is used.
Fixes bug: 34667

Reviewers: krasimir, djasper, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Patch by: @jr

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D56345
2019-11-06 17:25:17 +00:00
Yitzhak Mandelbaum 6c683aa8d7 [libTooling] Fix breakage from change #84922 2019-11-06 11:31:35 -05:00
Yitzhak Mandelbaum 9f97480cdd [libTooling] Small changes in Transformer API.
Summary:
* Rename `transformer::change` to `transformer::changeTo`, make `change` forward
  to `changeTo` and mark it deprecated.

* Mark `transformer::text` and `transformer::selection` deprecated and migrate
  references to them in tests.

Reviewers: ilya-biryukov

Subscribers: gribozavr, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69896
2019-11-06 11:16:50 -05:00
Yitzhak Mandelbaum ce2b5cb6de [libTooling] Simplify type structure of `Stencil`s.
Summary:
Currently, stencils are defined as a sequence of `StencilParts`. This
differentiation adds an unneeded layer of complexity to the definition of
Stencils. This change significantly simplifies the type structure: a stencil is
now conceptually any object implementing `StencilInterface` and `Stencil` is
just a thin wrapper for pointers to this interface.

To account for the sequencing that was supported by the old `Stencil` type, we
introduce a sequencing class that implements `StencilInterface`. That is,
sequences are just another kind of Stencil and no longer have any special
status.

Corresponding to this change in the type structure, we change the way `cat` is
used (and defined). `cat` bundles multiple features: it builds a stencil from a
sequence of subcomponents and admits multiple different types for its arguments,
while coercing them into the right type. Previously, `cat` was also used to
coerce a single `StencilPart` into a `Stencil`. With that distinction gone, many
uses of `cat` (e.g. in the tests) are unnecessary and have, therefore, been
removed.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69613
2019-11-06 10:28:34 -05:00
Tim Northover 59f063b89c NeonEmitter: remove special 'a' type modifier.
'a' used to implement a splat in C++ code in NeonEmitter.cpp, but this
can be done directly from .td expansions now (and most ops already did).
So removing it simplifies the overall code.

https://reviews.llvm.org/D69716
2019-11-06 10:23:36 +00:00
Tim Northover 9577ee84e6 NeonEmitter: switch to enum for internal Type representation.
Previously we had a handful of bools (Signed, Floating, ...) that could
easily end up in an inconsistent state. This adds an enum Kind which
holds the mutually exclusive states a type might be in, retaining some
of the bools that modified an underlying type.

https://reviews.llvm.org/D69715
2019-11-06 10:02:15 +00:00
Ilya Biryukov 58fa50f437 [Syntax] Add nodes for most common statements
Summary:
Most of the statements mirror the ones provided by clang AST.
Major differences are:
  - expressions are wrapped into 'ExpressionStatement' instead of being
    a subclass of statement,
  - semicolons are always consumed by the leaf expressions (return,
    expression satement, etc),
  - some clang statements are not handled yet, we wrap those into an
    UnknownStatement class, which is not present in clang.

We also define an 'Expression' and 'UnknownExpression' classes in order
to produce 'ExpressionStatement' where needed. The actual implementation
of expressions is not yet ready, it will follow later.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63835
2019-11-06 10:56:06 +01:00
Simon Tatham 6c3fee47a6 [ARM,MVE] Add intrinsics for gather/scatter load/stores.
This patch adds two new families of intrinsics, both of which are
memory accesses taking a vector of locations to load from / store to.

The vldrq_gather_base / vstrq_scatter_base intrinsics take a vector of
base addresses, and an immediate offset to be added consistently to
each one. vldrq_gather_offset / vstrq_scatter_offset take a scalar
base address, and a vector of offsets to add to it. The
'shifted_offset' variants also multiply each offset by the element
size type, so that the vector is effectively of array indices.

At the IR level, these operations are represented by a single set of
four IR intrinsics: {gather,scatter} × {base,offset}. The other
details (signed/unsigned, shift, and memory element size as opposed to
vector element size) are all specified by IR intrinsic polymorphism
and immediate operands, because that made the selection job easier
than making a huge family of similarly named intrinsics.

I considered using the standard IR representations such as
llvm.masked.gather, but they're not a good fit. In order to use
llvm.masked.gather to represent a gather_offset load with element size
smaller than a pointer, you'd have to expand the <8 x i16> vector of
offsets into an <8 x i16*> vector of pointers, which would be split up
during legalization, so you'd spend most of your time undoing the mess
it had made. Also, ISel support for llvm.masked.gather would be easy
enough in a trivial way (you can expand it into a gather-base load
with a zero immediate offset), but instruction-selecting lots of
fiddly idioms back into all the _other_ MVE load instructions would be
much more work. So I think dedicated IR intrinsics are the more
sensible approach, at least for the moment.

On the clang tablegen side, I've added two new features to the
Tablegen source accepted by MveEmitter: a 'CopyKind' type node for
defining a type that varies with the parameter type (it lets you ask
for an unsigned integer type of the same width as the parameter), and
an 'unsignedflag' value node for passing an immediate IR operand which
is 0 for a signed integer type or 1 for an unsigned one. That lets me
write each kind of intrinsic just once and get all its subtypes and
immediate arguments generated automatically.

Also I've tweaked the handling of pointer-typed values in the code
generation part of MveEmitter: they're generated as Address rather
than Value (i.e. including an alignment) so that they can be given to
the ordinary IR load and store operations, but I'd omitted the code to
convert them back to Value when they're going to be used as an
argument to an IR intrinsic.

On the MC side, I've enhanced MVEVectorVTInfo so that it can tell you
not only the full assembly-language suffix for a given vector type
(like 's32' or 'u16') but also the numeric-only one used by store
instructions (just '32' or '16').

Reviewers: dmgreen

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

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69791
2019-11-06 09:01:42 +00:00
Simon Tatham f0c6890f32 [ARM,MVE] Integer-type nitpicks in MVE intrinsics.
A few integer types in the ACLE definitions of MVE intrinsics are
given as 'int' or 'unsigned' instead of <stdint.h> fixed-size types
like uint32_t. Usually these are the ones where the size isn't that
important, such as immediate offsets in loads (which have a range
limited by the instruction encoding) or the carry flag in vadcq which
can only be 0 or 1 anyway.

With this change, <arm_mve.h> follows that exact type naming, so that
the function prototypes look identical to the ones in ACLE, instead of
replacing int and unsigned with int32_t and uint32_t.

Reviewers: dmgreen

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69790
2019-11-06 09:01:42 +00:00
Simon Tatham 26bc7cb05e [clang,MveEmitter] Fix sign/zero extension in range limits.
In the code that generates Sema range checks on constant arguments, I
had a piece of code that checks the bounds specified in the Tablegen
intrinsic description against the range of the integer type being
tested. If the bounds are large enough to permit any value of the
integer type, you can omit the compile-time range check. (This case is
expected to come up in some of the bitwise operation intrinsics.)

But somehow I got my signed/unsigned check backwards (asking for the
signed min/max of an unsigned type and vice versa), and also made a
sign extension error in which a signed negative value gets
zero-extended. Now rewritten more sensibly, and it should get its
first sensible test from the next batch of intrinsics I'm planning to
add in D69791.

Reviewers: dmgreen

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69789
2019-11-06 09:01:42 +00:00
Simon Tatham 38f016520f [ARM MVE] Remove accidental 64-bit vst2/vld2 intrinsics.
ACLE defines no such intrinsic as vst2q_u64, and the MVE instruction
set has no corresponding instruction. But I had accidentally added
them to the fledgling <arm_mve.h> anyway, and if you used them, you'd
get a compiler crash.

Reviewers: dmgreen

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69788
2019-11-06 09:01:42 +00:00
paulhoad f349cc37cc clang-format: Add a fallback style to Emacs mode
Summary:
This allows one to enable `clang-format-buffer` on file save and avoid
reformatting files that are outside of any project with .clang-format style.

Reviewers: djasper, klimek, sammccall, owenpan, mitchell-stellar, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Patch By: dottedmag

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D69752
2019-11-06 09:50:54 +00:00
paulhoad 76ec6b1ef6 [clang-format] [PR35518] C++17 deduction guides are wrongly formatted
Summary:
see https://bugs.llvm.org/show_bug.cgi?id=35518

clang-format removes spaces around deduction guides but not trailing return types, make the consistent

```
template <typename T> S(T)->S<T>;
auto f(int, int) -> double;
```

becomes

```
template <typename T> S(T) -> S<T>;
auto f(int, int) -> double;
```

Reviewers: klimek, mitchell-stellar, owenpan, sammccall, lichray, curdeius, KyrBoh

Reviewed By: curdeius

Subscribers: merge_guards_bot, hans, lichray, cfe-commits

Tags: #clang-format, #clang-tools-extra, #clang

Differential Revision: https://reviews.llvm.org/D69577
2019-11-06 09:34:48 +00:00
Volodymyr Sapsai 39573daa76 Revert "[analyzer] Add test directory for scan-build."
This reverts commit 0aba69eb1a with
subsequent changes to test files.

It caused test failures on GreenDragon, e.g.,
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/
2019-11-05 14:03:36 -08:00
Bill Wendling ee10d934dd Fix typo so that '-O0' is correctly specified 2019-11-05 13:15:55 -08:00
Alexey Bataev dcec2ac4f3 [OPENMP50]Simplify processing of context selector scores.
If the context selector score was not specified, its value must be set
to 0. Simplify the processing of unspecified scores + save memory in
attribute representation.
2019-11-05 15:59:22 -05:00
Mark de Wever 743461090a [Sema] Fixes templated friend member assertion
Fixes PR41792: Clang assertion failure on templated friend member function

Differential Revision: https://reviews.llvm.org/D69481
2019-11-05 21:46:42 +01:00
Michael Liao 0a220de9e9 [HIP] Fix visibility for 'extern' device variables.
Summary:
- Fix a bug which misses the change for a variable to be set with
  target-specific attributes.

Reviewers: yaxunl

Subscribers: jvesely, nhaehnle, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63020
2019-11-05 14:19:32 -05:00
Michael Liao 15140e4bac [hip] Enable pointer argument lowering through coercing type.
Reviewers: tra, rjmccall, yaxunl

Subscribers: jvesely, nhaehnle, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69826
2019-11-05 13:05:05 -05:00
Alexey Bataev 7b710a4294 [OPENMP]Improve diagnostics for unsupported unified addressing.
Improved diagnostics for better user experience.
2019-11-05 10:31:59 -05:00
Alexey Bataev 642916adc9 [OPENMP][DOCS]Fix coloring of the implemented features status, NFC. 2019-11-05 10:13:58 -05:00