Commit Graph

81086 Commits

Author SHA1 Message Date
Sylvestre Ledru 152e83fc59 clang-format: fix a typo introduced by the previous change 2019-11-11 21:52:08 +01:00
Alexey Bataev fde11e9f23 [OPENMP50]Generalize handling of context matching/scoring.
Summary:
Untie context matching/scoring from the attribute for declare variant
directive to simplify future uses in other context-dependent directives.

Reviewers: jdoerfert

Subscribers: guansong, kkwli0, caomhin, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69952
2019-11-11 14:41:10 -05:00
Alexey Bataev f8c12edd1a [OPENMP50]Add support for nested atomic and simd constructs in
simd-based directives.

According to OpenMP 5.0 standard, ordered simd, atomic and simd
directives are allowed as nested directives in the simd-based
directives.
2019-11-11 14:28:28 -05:00
Yitzhak Mandelbaum 489449c28a [libTooling] Further simplify `Stencil` type and introduce `MatchComputation`.
Summary:
This revision introduces a new interface `MatchComputation` which generalizes
the `Stencil` interface and replaces the `std::function` interface of
`MatchConsumer`. With this revision, `Stencil` (as an abstraction) becomes just
one collection of implementations of
`MatchComputation<std::string>`. Correspondingly, we remove the `Stencil` class
entirely in favor of a simple type alias, deprecate `MatchConsumer` and change
all functions that accepted `MatchConsumer<std::string>` to use
`MatchComputation<std::string>` instead.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69802
2019-11-11 12:44:15 -05:00
Sam McCall a81c1a9c56 [Format] Fix clang-format.el unit tests after commit f349cc37cc
Also add a comment that test is not automatically run, and how to run it.

Patch by Philipp Stephani!
2019-11-11 17:55:38 +01:00
Martin Probst 6bcd8d4a18 clang-format: [JS] test declared fields.
Summary:
TypeScript now supports declaring fields:

    class Foo {
      declare field: string;
    }

clang-format happens to already format this fine, so this change just
adds a regression test.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69972
2019-11-11 16:36:00 +01:00
Martin Probst a7638d3849 clang-format: [JS] support null operators.
Summary:
JavaScript / TypeScript is adding two new operators: the null
propagating operator `?.` and the nullish coalescing operator `??`.

    const x = foo ?? 'default';
    const z = foo?.bar?.baz;

This change adds support to lex and format both.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69971
2019-11-11 16:35:35 +01:00
Hans Wennborg b1ac1f0071 Revert cdcf58e5af "[RISCV] enable LTO support, pass some options to linker."
This started passing target-features on the linker line, not just for RISCV but
for all targets, leading to error messages in Chromium Android build:

  '+soft-float-abi' is not a recognized feature for this target (ignoring feature)
  '+soft-float-abi' is not a recognized feature for this target (ignoring feature)

See Phabricator review for details.

Reverting until this can be fixed properly.

> Summary:
> 1. enable LTO need to pass target feature and abi to LTO code generation
>    RISCV backend need the target feature to decide which extension used in
>    code generation.
> 2. move getTargetFeatures to CommonArgs.h and add ForLTOPlugin flag
> 3. add general tools::getTargetABI in CommonArgs.h because different target uses different
>    way to get the target ABI.
>
> Patch by Kuan Hsu Chen (khchen)
>
> Reviewers: lenary, lewis-revill, asb, MaskRay
>
> Reviewed By: lenary
>
> Subscribers: hiraditya, dschuff, aheejin, fedor.sergeev, mehdi_amini, inglorion, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D67409
2019-11-11 10:58:39 +01:00
Duncan P. N. Exon Smith 8e9e433a2a clang/Modules: Remove unused parameter from ModuleManager::removeModules
The other paremeters appear to be sufficient to determine which modules
have just been loaded and need to be removed, so stop collecting and
sending in that set explicitly.
2019-11-10 11:18:33 -08:00
Benjamin Kramer 6c94068da9 [Driver] Remove unused variable. NFC. 2019-11-10 12:53:19 +01:00
Simon Pilgrim c2fca2d9af Fix variable ‘LookedUpGetterSetter’ set but not used warning. NFCI. 2019-11-09 17:40:49 +00:00
Dávid Bolvanský e24e6ae7a0 Fixed dia file 2019-11-09 18:31:17 +01:00
Dávid Bolvanský 5deb289f49 Fixed c-index test 2019-11-09 18:26:21 +01:00
Dávid Bolvanský 5c50109bb5 Fixed more -Wreturn-type tests 2019-11-09 18:13:51 +01:00
Dávid Bolvanský 1da13237a4 [Diagnostics] Try to improve warning message for -Wreturn-type
Summary: I agree with https://easyaspi314.github.io/gcc-vs-clang.html?fbclid=IwAR1VA0qxiWVUusOQUv5z7JESS7ZpeJy-UqAI5mnJscofGLqXcqeErIUB2gU, current warning message is not very good. We should try to improve it..

Reviewers: rsmith, aaron.ballman, easyaspi314

Reviewed By: aaron.ballman

Subscribers: arphaman, Quuxplusone, mehdi_amini, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69762
2019-11-09 17:54:58 +01:00
Yonghong Song 9434360401 Revert "[BPF] Add preserve_access_index attribute for record definition"
This reverts commit 4a5aa1a7bf.

There are some other test failures. Investigate them first.
2019-11-09 08:32:44 -08:00
Yonghong Song 4a5aa1a7bf [BPF] Add preserve_access_index attribute for record definition
This patch introduced a new bpf specific attribute which can
be added to struct or union definition. For example,
  struct s { ... } __attribute__((preserve_access_index));
  union u { ... } __attribute__((preserve_access_index));
The goal is to simplify user codes for cases
where preserve access index happens for certain struct/union,
so user does not need to use clang __builtin_preserve_access_index
for every members.

The attribute has no effect if -g is not specified.

When the attribute is specified and -g is specified, any member
access defined by that structure or union, including array subscript
access and inner records, will be preserved through
  __builtin_preserve_{array,struct,union}_access_index()
IR intrinsics, which will enable relocation generation
in bpf backend.

The following is an example to illustrate the usage:
  -bash-4.4$ cat t.c
  #define __reloc__ __attribute__((preserve_access_index))
  struct s1 {
    int c;
  } __reloc__;

  struct s2 {
    union {
      struct s1 b[3];
    };
  } __reloc__;

  struct s3 {
    struct s2 a;
  } __reloc__;

  int test(struct s3 *arg) {
    return arg->a.b[2].c;
  }
  -bash-4.4$ clang -target bpf -g -S -O2 t.c

A relocation with access string "0:0:0:0:2:0" will be generated
representing access offset of arg->a.b[2].c.

forward declaration with attribute is also handled properly such
that the attribute is copied and populated in real record definition.

Differential Revision: https://reviews.llvm.org/D69759
2019-11-09 08:17:12 -08:00
Mark de Wever b9be5ce8f3 [Parser] Warn when ScopeDepthOrObjCQuals overflows
Before when the overflow occured an assertion was triggered. Now check
whether the maximum has been reached and warn properly.

This patch fixes the original submission of PR19607.

Differential Revision: https://reviews.llvm.org/D63975
2019-11-09 15:33:01 +01:00
Richard Smith 56b5eab129 [NFC] Supress GCC "Bitfield too small to hold all values of enum" warning.
Patch by Wang Tianqing!

Differential Revision: https://reviews.llvm.org/D69792
2019-11-09 05:56:51 -08:00
Richard Smith 092577e317 [cxx_status] Update with Belfast motions. 2019-11-09 03:13:21 -08:00
Dávid Bolvanský 312c6f699d [Diagnostics] Fixed crash with non pointer type (PR43950) 2019-11-09 09:02:40 +01:00
Artem Dergachev e4da37e8a0 [analyzer] Fix skipping the call during inlined defensive check suppression.
When bugreporter::trackExpressionValue() is invoked on a DeclRefExpr,
it tries to do most of its computations over the node in which
this DeclRefExpr is computed, rather than on the error node (or whatever node
is stuffed into it). One reason why we can't simply use the error node is
that the binding to that variable might have already disappeared from the state
by the time the bug is found.

In case of the inlined defensive checks visitor, the DeclRefExpr node
is in fact sometimes too *early*: the call in which the inlined defensive check
has happened might have not been entered yet.

Change the visitor to be fine with tracking dead symbols (which it is totally
capable of - the collapse point for the symbol is still well-defined), and fire
it up directly on the error node. Keep using "LVState" to find out which value
should we be tracking, so that there weren't any problems with accidentally
loading an ill-formed value from a dead variable.

Differential Revision: https://reviews.llvm.org/D67932
2019-11-08 18:27:14 -08:00
Artem Dergachev 57adc37fe5 [analyzer] Nullability: Don't infer nullable when passing as nullable parameter.
You can't really infer anything from that.
2019-11-08 18:27:14 -08:00
Puyan Lotfi 1257146eb4 [clang][IFS][test] Fixing buildbot test fails for clang-ifs.
Checking for the exact triple fails on many bots. Leaving the triple
check blank.
2019-11-08 21:06:23 -05:00
Puyan Lotfi 79e345fbcc [clang][IFS] Adds support for more decl types in clang interface stubs.
Adding support for processing the following Decls: NonTypeTemplateParmDecl,
CXXConversionDecl, UnresolvedUsingValueDecl, UsingDecl, UsingShadowDecl,
TypeAliasTemplateDecl, TypeAliasDecl, VarTemplateDecl,
VarTemplateSpecializationDecl, UsingDirectiveDecl, TemplateTemplateParmDecl,
ClassTemplatePartialSpecializationDecl, IndirectFieldDecl.

Also, this allows for processing NamedDecls that don't have an identifier and
skips over VarDecls that are dependent on template types.

Differential Revision: https://reviews.llvm.org/D69995
2019-11-08 20:27:25 -05:00
Adrian Prantl 901cc4a4bc Debug Info: Nest Objective-C property function decls inside their container.
This has the nice side-effect of also fixing a crash in Clang.

Starting with DWARF 5 we are emitting ObjC method declarations as
children of their containing entity. This worked for interfaces, but
didn't consider the case of synthessized properties. When a property
of a protocol is synthesized in an interface implementation the
ObjCMethodDecl that was passed to CGF::StartFunction was the property
*declaration* which obviously couldn't have a containing
interface. This patch passes the containing interface all the way
through to CGDebugInfo, so the function declaration can be created
with the correct parent (= the class implementing the protocol).

rdar://problem/53782400

Differential Revision: https://reviews.llvm.org/D66121
2019-11-08 15:14:00 -08:00
Stephan T. Lavavej 3a7a22445e [www] More HTTPS and outdated link fixes.
Resolves D69981.
2019-11-08 14:41:27 -08:00
Sylvestre Ledru 3a3255a223 clang-format: refresh the list of options 2019-11-08 23:40:16 +01:00
Jan Korous d52cff8836 Revert "Reland "[clang] Report sanitizer blacklist as a dependency in cc1""
This reverts commit cae4a28864.
2019-11-08 14:28:30 -08:00
Sylvestre Ledru 4c44fd3de3 clang-format: Add to the release notes the new --dry-run/-n option 2019-11-08 23:26:44 +01:00
Melanie Blower d0b3e73175 Revert "Reapply "Fix crash on switch conditions of non-integer types in templates""
This reverts commit 759948467e.
There were build bot failures in clang-tidy
2019-11-08 14:18:15 -08:00
Alex Suhan b314414570 Basic: fix FileManager invalidation issue for file redirect
Insertion into SeenFileEntries can invalidate iterators, we need to do
another lookup on the re-intern path.
2019-11-08 17:02:44 -05:00
Jan Korous 555c6be041 [clang] Fix -fsanitize-system-blacklist processing in cc1 2019-11-08 13:57:33 -08:00
Jan Korous cae4a28864 Reland "[clang] Report sanitizer blacklist as a dependency in cc1"
This reverts commit 3182027282.
2019-11-08 13:55:00 -08:00
Jan Korous 6d28588cc0 Reland "[clang] Report sanitizer blacklist as a dependency in cc1"
This reverts commit 9b8413ac6e.
2019-11-08 13:54:28 -08:00
paul_hoad 860ee4f3eb [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst
Summary:
Format.h is used to generate ClangFormatStyleOptions.rst, the layout of the comments is critical to the rst file. Accidentally clang-formatting Format.h can lead to the .rst changing.

This revision simply add // clang-format off/on statement around the areas who formatting needs to be maintained, mainly around the options that are related to what happens when the line breaks due to `ColumnLimit` (which is what is happening to the comment)

This allows Format.h to be clang-formatted without causing a change in the documentation when dump_format_style.py is rerun, which is also part of the revision.

Reviewers: mitchell-stellar, klimek, sammccall, owenpan

Reviewed By: mitchell-stellar

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D69951
2019-11-08 21:14:29 +00:00
Jan Korous 590f279c45 [clang] Add VFS support for sanitizers' blacklists
Differential Revision: https://reviews.llvm.org/D69648
2019-11-08 10:58:50 -08:00
Melanie Blower 759948467e Reapply "Fix crash on switch conditions of non-integer types in templates"
This patch reapplies commit 76945821b9. The first version broke
buildbots due to clang-tidy test fails. The fails are because some
errors in templates are now diagnosed earlier (does not wait till
instantiation). I have modified the tests to add checks for these
diagnostics/prevent these diagnostics. There are no additional code
changes.

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.

Reviewers: rnk, gribozavr2

Patch by: Elizabeth Andrews (eandrews)

Differential revision: https://reviews.llvm.org/D69950
2019-11-08 10:17:06 -08:00
Nick Desaulniers 51adeae1c9 remove redundant LLVM version from version string when setting CLANG_VENDOR
Summary:
When downstream LLVM distributions (like AOSP) set the CLANG_VENDOR
cmake variable, the version string printed by the clang driver looks
like:

$ clang --version
[CLANG_VENDOR] clang version X.X.X ([CLANG_REPOSITORY_STRING] sha) (based on LLVM X.X.X)

Rather than the more standard:
$ clang --version
clang version X.X.X ([CLANG_REPOSITORY_STRING] sha)

Based on feedback the the version string is a little long, the trailing
"(based on LLVM X.X.X)" is redundant and makes less sense after moving
LLVM to the monorepo. And it is only added should vendors set the cmake
variable CLANG_VENDOR. Let's remove it.

Reviewers: jyknight, eli.friedman, rsmith, rjmccall, efriedma

Reviewed By: efriedma

Subscribers: arphaman, efriedma, cfe-commits, srhines

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69925
2019-11-08 09:24:17 -08:00
Adrian Prantl 9e48a946b7 Fix two typos in one test name, three days before its 10th birthday! (NFC) 2019-11-08 09:03:46 -08:00
Adrian Prantl 2073dd2da7 Redeclare Objective-C property accessors inside the ObjCImplDecl in which they are synthesized.
This patch is motivated by (and factored out from)
https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting
with DWARF 5 all Objective-C methods are nested inside their
containing type, and that patch implements this for synthesized
Objective-C properties.

1. SemaObjCProperty populates a list of synthesized accessors that may
   need to inserted into an ObjCImplDecl.

2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all
   accessors for which no override was provided into their
   ObjCImplDecl. This patch does *not* synthesize AST function
   *bodies*. Moving that code from the static analyzer into Sema may
   be a good idea though.

3. Places that expect all methods to have bodies have been updated.

I did not update the static analyzer's inliner for synthesized
properties to point back to the property declaration (see
test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which
I believed to be more bug than a feature.

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

rdar://problem/53782400
2019-11-08 08:23:22 -08:00
paul_hoad eb00839c6e [clang-format] Ensure dump_format_style.py can generate ClangFormatStyleOptions.rst without manual intervention
Summary:
This revision is the last in a series of revisions to return `clang/doc/tools/dump_format_style.py` to be being able to parse Format.h without needing to manually merge the ClangFormatStyleOptions.rst file.

The final modification to dump_format_style.py is needed following the addition of a  nested enumeration inside a nested structure following the introduction of {D68296}

Prior  related revisions will allow for a fully clang-formatted `clang/include/clang/Format/Format.h` to once again be used at the source.
{D69951}
{D69433}
{D69404}

Reviewers: mitchell-stellar, klimek, sammccall, owenpan

Reviewed By: mitchell-stellar

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D70003
2019-11-08 14:40:36 +00:00
paulhoad 6bf9e88ae4 [clang-format] update comments in clang-format.py for python3 compatibility
Summary:
D23319 introduced python3 compatibility to clang-format.py, this is however not reflected by the documentation in the comments at the beginning of the file, which show how to use the script with python2 in .vimrc. While the actual mapping a user might want to use may well differ from my suggestion, I think it's nice to show the python2 and python3 version, such that a user can pick from the suggestions instead of googeling the python3 replacement for `:pyf` which they might not be familiar with.

EDIT: picking reviewers according to https://llvm.org/docs/Phabricator.html#finding-potential-reviewers

Reviewers: klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: ilya-biryukov, cfe-commits, llvm-commits, ychen

Patch By: pseyfert

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

Differential Revision: https://reviews.llvm.org/D38446
2019-11-08 13:17:04 +00:00
Abel Kocsis c0a77329d4 Revert "test commit"
This reverts commit b0a03f29d9.
2019-11-08 14:09:09 +01:00
Abel Kocsis 9fcf2a38c2 Revert "test commit"
This reverts commit 3ffce13f8c.
2019-11-08 14:08:46 +01:00
Abel Kocsis 9b8413ac6e Revert "Revert "Revert "[clang] Report sanitizer blacklist as a dependency in cc1"""
This reverts commit 3182027282.
2019-11-08 14:08:15 +01:00
Abel Kocsis 3182027282 Revert "Revert "[clang] Report sanitizer blacklist as a dependency in cc1""
This reverts commit 6b45e1bc11.
2019-11-08 14:00:44 +01:00
Abel Kocsis 3ffce13f8c test commit 2019-11-08 13:37:24 +01:00
Abel Kocsis b0a03f29d9 test commit 2019-11-08 13:35:49 +01:00
Jeremy Morse 6b45e1bc11 Revert "[clang] Report sanitizer blacklist as a dependency in cc1"
This reverts commit 03b84e4f6d.

This breaks dfsan tests with a linking failure, in for example this build:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24312

Reverting this patch locally makes those tests succeed.
2019-11-08 12:07:42 +00:00
Adam Balogh 0f88caeef8 [Analyzer] Checker for Debugging Iterator Checkers
For white-box testing correct container and iterator modelling it is essential
to access the internal data structures stored for container and iterators. This
patch introduces a simple debug checkers called debug.IteratorDebugging to
achieve this.

Differential Revision: https://reviews.llvm.org/D67156
2019-11-08 08:59:50 +01:00
Nemanja Ivanovic e0407f5496 [PowerPC][Altivec] Fix offsets for vec_xl and vec_xst
As we currently have it implemented in altivec.h, the offsets for these two
intrinsics are element offsets. The documentation in the ABI (as well as the
implementation in both XL and GCC) states that these should be byte offsets.

Differential revision: https://reviews.llvm.org/D63636
2019-11-07 20:58:11 -06:00
Nemanja Ivanovic 070e4027b0 [PowerPC][Altivec] Emit correct builtin for single precision vec_all_ne
We currently emit a double precision comparison instruction for this, whereas we
need to emit the single precision version.

Differential revision: https://reviews.llvm.org/D64024
2019-11-07 20:40:32 -06:00
Artem Belevich 7215b7ef53 [creduce] Fixed a typo in the error message we're looking for. 2019-11-07 17:16:51 -08:00
Artem Dergachev 5e0fb64842 [analyzer] Add test cases for the unsupported C++ constructor modeling.
Namely, for the following items:
- Handle constructors within new[];
- Handle constructors for default arguments.

Update the open projects page with a link to the newly added tests
and more hints for potential contributors.

Patch by Daniel Krupp!

Differential Revision: https://reviews.llvm.org/D69308
2019-11-07 17:15:53 -08:00
Artem Dergachev acac540422 [analyzer] PR41729: CStringChecker: Improve strlcat and strlcpy modeling.
- Fix false positive reports of strlcat.
- The return value of strlcat and strlcpy is now correctly calculated.
- The resulting string length of strlcat and strlcpy is now correctly
  calculated.

Patch by Daniel Krupp!

Differential Revision: https://reviews.llvm.org/D66049
2019-11-07 17:15:53 -08:00
Reid Kleckner 7177ce978e [SEH] Defer checking filter expression types until instantiaton
While here, wordsmith the error a bit. Now clang says:
  error: filter expression has non-integral type 'Foo'

Fixes PR43779

Reviewers: amccarth

Differential Revision: https://reviews.llvm.org/D69969
2019-11-07 14:52:04 -08:00
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
Jonas Paulsson 9376714314 [Clang FE] Recognize -mnop-mcount CL option (SystemZ only).
Recognize -mnop-mcount from the command line and add a function attribute
"mnop-mcount"="true" when passed.

When this option is used, a nop is added instead of a call to fentry. This
is used when building the Linux Kernel.

If this option is passed for any other target than SystemZ, an error is
generated.

Review: Ulrich Weigand
https://reviews.llvm.org/D67763
2019-11-05 12:12:36 +01:00
Sven van Haastregt 0e56b0f94b [OpenCL] Group builtin functions by prototype
The TableGen-generated file containing the function definitions can be
reorganized to save some memory in the Clang binary.  Functions having
the same prototype(s) will point to a shared list of prototype(s).

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D63557
2019-11-05 10:26:47 +00:00
Sven van Haastregt 9a8d477a0e [OpenCL] Add builtin function attribute handling
Add handling for the "pure", "const" and "convergent" function
attributes for OpenCL builtin functions.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D64319
2019-11-05 10:26:47 +00:00
Simon Atanasyan 0d14656b9d [mips] Set __OCTEON__ macros 2019-11-05 12:10:58 +03:00
Simon Atanasyan e578d0fd29 [mips] Fix `__mips_isa_rev` macros value for Octeon CPU 2019-11-05 12:10:58 +03:00
Devin Coughlin abc04ff401 [analyzer] Require darwin for scan-build tests
Let's at least get some coverage from these tests. We can generalize to
other platforms later.
2019-11-04 21:17:55 -08:00
Devin Coughlin 48223d92a9 [analyzer] Fixup scan-build tests for non-Darwin platforms.
This is a fix to 0aba69eb1a to
address failing bots.
2019-11-04 21:12:11 -08:00
Devin Coughlin 0aba69eb1a [analyzer] Add test directory for scan-build.
The static analyzer's scan-build script is critical infrastructure but
is not well tested. To start to address this, add a new test directory under
tests/Analysis for scan-build lit tests and seed it with several tests. The
goal is that future scan-build changes will be accompanied by corresponding
tests.

Differential Revision: https://reviews.llvm.org/D69781
2019-11-04 20:26:35 -08:00
Yaxun (Sam) Liu 4264e7bbfd [CUDA][HIP] Disable emitting llvm.linker.options in device compilation
The linker options (e.g. pragma detect_mismatch) are intended for host
compilation only, therefore disable it for device compilation.

Differential Revision: https://reviews.llvm.org/D57829
2019-11-04 23:21:39 -05:00
Vedant Kumar a5c8ec4baa [CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood
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-04 15:14:24 -08:00
Mark de Wever 403739b2fd [AST][NFC] Fixes a comment typo
Also a test for commit access.
2019-11-04 22:32:56 +01:00
Alexey Bataev 3eecd601ed [OPENMP][DOCS]Update list of implemented features, NFC. 2019-11-04 16:29:26 -05:00
James Y Knight d11a9018b7 Add release notes for commit ccc4d83cda.
(Which was "[ObjC] Diagnose implicit type coercion from ObjC 'Class'
to object pointer types.")
2019-11-04 16:26:53 -05:00
Alexey Bataev 8bbf2e3716 [OPENMP50]Support for imperfectly nested loops.
Added support for imperfectly nested loops introduced in OpenMP 5.0.
2019-11-04 16:09:25 -05:00
Duncan P. N. Exon Smith 8112a423a8 clang/Modules: Bring back optimization lost in 31e14f41a2
31e14f41a2 accidentally dropped caching of
failed module loads.  This brings it back by making
ModuleMap::getCachedModuleLoad return an Optional.
2019-11-04 11:40:03 -08:00
Craig Topper b2b6a54f84 [X86] Add support for -mvzeroupper and -mno-vzeroupper to match gcc
-mvzeroupper will force the vzeroupper insertion pass to run on
CPUs that normally wouldn't. -mno-vzeroupper disables it on CPUs
where it normally runs.

To support this with the default feature handling in clang, we
need a vzeroupper feature flag in X86.td. Since this flag has
the opposite polarity of the fast-partial-ymm-or-zmm-write we
used to use to disable the pass, we now need to add this new
flag to every CPU except KNL/KNM and BTVER2 to keep identical
behavior.

Remove -fast-partial-ymm-or-zmm-write which is no longer used.

Differential Revision: https://reviews.llvm.org/D69786
2019-11-04 11:03:54 -08:00
Eric Astor be6ac471f6 [ms] Fix Microsoft compatibility handling of commas in nested macro expansions.
In Microsoft-compatibility mode, single commas from nested macro expansions
should not be considered as argument separators; we already emulated this by
marking them to be ignored. However, in MSVC's preprocessor, subsequent
expansions DO treat these commas as argument separators... so we now ignore
each comma at most once.

Includes a small unit test that validates we match MSVC's behavior as shown
in https://gcc.godbolt.org/z/y0twaq

Fixes PR43282

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69626
2019-11-04 12:49:19 -05:00
Amy Huang ab76cfdd20 Recommit "[CodeView] Add option to disable inline line tables."
This reverts commit 004ed2b0d1.
Original commit hash 6d03890384

Summary:
This adds a clang option to disable inline line tables. When it is used,
the inliner uses the call site as the location of the inlined function instead of
marking it as an inline location with the function location.

https://reviews.llvm.org/D67723
2019-11-04 09:15:26 -08:00
Ilya Biryukov 9ba16615fa [Sema] Make helper in TreeTransform.h 'inline' instead of 'static'. NFC
Summary:
There seems to be no evidence that having internal linkage for the function
was intentional. Since 'static' functions are normally used only in .cpp
files, using 'inline' in the header file is more appropriate.

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69242
2019-11-04 17:07:53 +01:00
Dávid Bolvanský 55507110b9 [Diagnostics] Improve some error messages related to bad use of dynamic_cast 2019-11-04 16:26:43 +01:00
Simon Pilgrim a0324e9113 SanitizerMask::bitPosToMask - fix operator precedence warnings. NFCI.
Fix static analyzer operator precedence warnings with suitable bracketing. Pull out the mask generation code so clang-format doesn't make such a mess of it.
2019-11-04 15:12:01 +00:00
Sven van Haastregt 6c5827975c [OpenCL] Fix FileCheck pattern
For this test, FileCheck is not run with the CHECK prefix; it seems
COMMON was intended here.
2019-11-04 15:08:53 +00:00
Michael Liao d142ec6fef Fix compilation warning. NFC. 2019-11-04 10:01:50 -05:00
Sven van Haastregt 82888b78d4 [OpenCL] Fix address space for const method call from nonconst (PR43145)
Patch by Anastasia Stulova and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D68781
2019-11-04 13:12:17 +00:00
David Spickett 91167e22ec [hwasan] Remove lazy thread-initialisation
This was an experiment made possible by a non-standard feature of the
Android dynamic loader.

It required introducing a flag to tell the compiler which ABI was being
targeted.
This flag is no longer needed, since the generated code now works for
both ABI's.

We leave that flag untouched for backwards compatibility. This also
means that if we need to distinguish between targeted ABI's again
we can do that without disturbing any existing workflows.

We leave a comment in the source code and mention in the help text to
explain this for any confused person reading the code in the future.

Patch by Matthew Malcomson

Differential Revision: https://reviews.llvm.org/D69574
2019-11-04 10:58:46 +00:00
Duncan P. N. Exon Smith 31e14f41a2 clang/Modules: Sink CompilerInstance::KnownModules into ModuleMap
Avoid use-after-frees when FrontendAction::BeginSourceFile is called
twice on the same CompilerInstance by sinking
CompilerInstance::KnownModules into ModuleMap.  On the way, rename the
map to CachedModuleLoads.  I considered (but rejected) merging this with
ModuleMap::Modules, since that only has top-level modules and this map
includes submodules.

This is an alternative to https://reviews.llvm.org/D58497.  Thanks to
nemanjai for the detailed analysis of the problem!
2019-11-03 19:57:33 -08:00
Craig Topper 910718bd03 [opaque pointer types] Add element type argument to IRBuilder CreatePreserveStructAccessIndex and CreatePreserveArrayAccessIndex
Summary:
These were the only remaining users of the GetElementPtrInst::getGEPReturnType
method that gets the element type from the pointer type.

Remove that method since its now dead.

Reviewers: jyknight, t.p.northover, arsenm

Reviewed By: arsenm

Subscribers: wdng, arsenm, arphaman, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69756
2019-11-03 10:27:18 -08:00
Aaron Puchert c96428d218 Drop spurious self-include [NFC]
This was introduced in D61357, probably by accident.
2019-11-03 14:29:59 +01:00
Simon Pilgrim 0b4c2ee381 ModuleMap::findHeader - fix null dereference warning. NFCI.
We were checking M for a null value after we'd already dereferenced it multiple times.
2019-11-03 11:33:57 +00:00
Fangrui Song e0b3a8c991 [CodeGenCXX][test] Use -fno-experimental-new-pass-manager for CodeGenCXX/union-tbaa2.cpp after D68593/llvmorg-10-init-8907-gcecc0d27ad5
It fails with -DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=0 builds. Temporarily use -fno-experimental-new-pass-manager while we are investigating the root cause.
2019-11-02 15:58:54 -07:00
Simon Pilgrim d0f3c82216 Fix uninitialized variable warnings. NFCI. 2019-11-02 18:03:21 +00:00
Luboš Luňák 4f2104c5ad make -ftime-trace also trace time spent creating debug info
Differential Revision: https://reviews.llvm.org/D69750
2019-11-02 18:12:51 +01:00
Pengfei Wang af3a7de20c [X86] add mayRaiseFPException flag and FPCW registers for X87 instructions
Summary:
This patch adds flag "mayRaiseFPException"  , FPCW and FPSW for X87 instructions which could raise
float exception.

Reviewers: pengfei, RKSimon, andrew.w.kaylor, uweigand, kpn, spatel, cameron.mcinally, craig.topper

Reviewed By: craig.topper

Subscribers: thakis, hiraditya, llvm-commits

Patch by LiuChen.

Differential Revision: https://reviews.llvm.org/D68854
2019-11-01 21:12:43 -07:00
David Blaikie 1de2a05701 DebugInfo: Accept -gdwarf even in clang-cl
Fixes regression introduced by llvmorg-10-init-8908-g098d901bd1b
2019-11-01 15:36:15 -07:00
David Blaikie 098d901bd1 DebugInfo: Let -gdwarf use the toolchain default DWARF version, instead of hardcoded/aliased to -gdwarf-4 2019-11-01 15:17:51 -07:00
David Blaikie 42465f406b DebugInfo: (NFC) Refactor DWARF version calculation to make a future change (-fdebug-default-version) easier 2019-11-01 14:56:43 -07:00
Sourabh Singh Tomar 52ea308f70 [NFC]: Removed an implicit capture argument from lambda. 2019-11-02 01:37:46 +05:30
Vladimir Vereschaka a264e85dd9 [CMake] Add cross Windows to ARM Linux toolchain CMake cache file.
This cache file can be used to build a cross Windows to ARM Linux
toolchain.

Differential Revision: https://reviews.llvm.org/D69651
2019-11-01 12:40:25 -07:00
Thomas Lively 935c84c3c2 [WebAssembly] Add experimental SIMD dot product instruction
Summary:
This instruction is not merged to the spec proposal, but we need it to
be implemented in the toolchain to experiment with it. It is available
only on an opt-in basis through a clang builtin.

Defined in https://github.com/WebAssembly/simd/pull/127.

Depends on D69696.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69697
2019-11-01 10:45:48 -07:00
Yitzhak Mandelbaum 6e759daf2e [libTooling] Add Stencil constructor.
Summary:
Adds a constructor that takes a vector with which to initialize the `Parts`
field and a corresponding free function that forwards to the constructor. These
definitions are needed to assist in transitioning away from `Stencil` as a class
to defining it as a type alias.

Reviewers: ilya-biryukov

Subscribers: cfe-commits, gribozavr

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69632
2019-11-01 11:53:14 -04:00
Sven van Haastregt 0aed36d261 [OpenCL] Support -fdeclare-opencl-builtins in C++ mode
Support for C++ mode was accidentally lacking due to not checking the
OpenCLCPlusPlus LangOpts version.

Differential Revision: https://reviews.llvm.org/D69233
2019-11-01 13:56:43 +00:00
Thomas Lively a07019a275 [WebAssembly] SIMD integer min and max instructions
Summary:
Introduces a clang builtins and LLVM intrinsics representing integer
min/max instructions. These instructions have not been merged to the
SIMD spec proposal yet, so they are currently opt-in only via builtins
and not produced by general pattern matching. If these instructions
are accepted into the spec proposal the builtins and intrinsics will
be replaced with normal pattern matching.

Defined in https://github.com/WebAssembly/simd/pull/27.

Reviewers: aheejin

Reviewed By: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69696
2019-10-31 20:22:11 -07:00
Matt Arsenault c6da9ec0e9 clang: Fix assert on void pointer arithmetic with address_space
This attempted to always use the default address space void pointer
type instead of preserving the source address space.
2019-10-31 20:07:23 -07:00