Commit Graph

83916 Commits

Author SHA1 Message Date
Arthur Eubanks 48451ee6a7 [MSan] Pass MSan command line options under new pass manager
Summary:
Properly forward TrackOrigins and Recover user options to the MSan pass under the new pass manager.
This makes the number of check-msan failures when ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER is TRUE go from 52 to 2.

Based on https://reviews.llvm.org/D77249.

Reviewers: nemanjai, vitalybuka, leonardchan

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79445
2020-05-07 08:21:35 -07:00
Sander de Smalen 96a581d0f0 [SveEmitter] Add builtins for SVE2 svtbx (extended table lookup)
This patch adds builtins for:
- svtbx
2020-05-07 16:15:57 +01:00
Sander de Smalen e46043bba7 [SveEmitter] Add builtins for SVE2 Optional extensions (AES, SHA3, SM4, BITPERM)
This patch adds various builtins under their corresponding feature macros:

Defined under __ARM_FEATURE_SVE2_AES:
- svaesd
- svaese
- svaesimc
- svaesmc
- svpmullb_pair
- svpmullt_pair

Defined under __ARM_FEATURE_SVE2_SHA3:
- svrax1

Defined under __ARM_FEATURE_SVE2_SM4:
- svsm4e
- svsm4ekey

Defined under __ARM_FEATURE_SVE2_BITPERM:
- svbdep
- svbext
- svbgrp
2020-05-07 16:15:57 +01:00
Sander de Smalen f22cdc3cc3 [SveEmitter] Add builtins for SVE2 Character match instructions
This patch adds builtins for:
- svmatch
- svnmatch
2020-05-07 16:15:57 +01:00
Sander de Smalen ae652241bd [SveEmitter] Add builtins for SVE2 Vector histogram count instructions
This patch adds builtins for:
- svhistcnt
- svhistseg
2020-05-07 16:15:57 +01:00
Sander de Smalen fa0371f4fd [SveEmitter] Add builtins for SVE2 Floating-point integer binary logarithm instructions
This patch adds builtins for:
- svlogb
2020-05-07 16:15:57 +01:00
Sander de Smalen 086722c18e [SveEmitter] Add builtins for SVE2 Floating-point widening multiply-accumulate
This patch adds builtins for:
- svmlalb, svmlalb_lane
- svmlalt, svmlalt_lane
- svmlslb, svmlslb_lane
- svmlslt, svmlslt_lane
2020-05-07 16:15:57 +01:00
Sander de Smalen e76256e7c1 [SveEmitter] Add builtins for SVE2 Complex integer dot product
This patch adds builtins for:
- svcdot, svcdot_lane
2020-05-07 16:09:31 +01:00
Sander de Smalen 867bfae93f [SveEmitter] Add builtins for SVE2 Widening complex integer arithmetic
This patch adds builtins for:
- svaddlbt
- svqdmlalbt
- svqdmlslbt
- svsublbt
- svsubltb
2020-05-07 16:09:31 +01:00
Sander de Smalen f525820755 [SveEmitter] Add builtins for SVE2 Narrowing DSP operations
This patch adds builtins for:
- svaddhnb
- svaddhnt
- svqrshrnb
- svqrshrnt
- svqrshrunb
- svqrshrunt
- svqshrnb
- svqshrnt
- svqshrunb
- svqshrunt
- svqxtnb
- svqxtnt
- svqxtunb
- svqxtunt
- svraddhnb
- svraddhnt
- svrshrnb
- svrshrnt
- svrsubhnb
- svrsubhnt
- svshrnb
- svshrnt
- svsubhnb
- svsubhnt
2020-05-07 16:09:31 +01:00
Sander de Smalen b0b658e7fc [SveEmitter] Add builtins for SVE2 Widening DSP operations
This patch adds builtins for:
- svabalb
- svabalt
- svabdlb
- svabdlt
- svaddlb
- svaddlt
- svaddwb
- svaddwt
- svmlalb, svmlalb_lane
- svmlalt, svmlalt_lane
- svmlslb, svmlslb_lane
- svmlslt, svmlslt_lane
- svmullb, svmullb_lane
- svmullt, svmullt_lane
- svqdmlalb, svqdmlalb_lane
- svqdmlalt, svqdmlalt_lane
- svqdmlslb, svqdmlslb_lane
- svqdmlslt, svqdmlslt_lane
- svqdmullb, svqdmullb_lane
- svqdmullt, svqdmullt_lane
- svshllb
- svshllt
- svsublb
- svsublt
- svsubwb
- svsubwt
2020-05-07 16:09:31 +01:00
Sander de Smalen ce7f50c2ce [SveEmitter] Add builtins for SVE2 Uniform complex integer arithmetic
This patch adds builtins for:
- svcadd
- svqcadd
- svcmla
- svcmla_lane
- svqrdcmlah
- svqrdcmlah_lane
2020-05-07 16:09:31 +01:00
Yaxun (Sam) Liu e85bc0056e Revert "Let clang print registered targets for --version"
This reverts commit 66041187c9.

Will reland it under --print-target.

Differential Revision: https://reviews.llvm.org/D79210
2020-05-07 11:01:42 -04:00
Sander de Smalen 5e9bc21eea [SveEmitter] Add builtins for SVE2 Multiplication by indexed elements
This patch adds builtins for:
- svmla_lane
- svmls_lane
- svmul_lane
2020-05-07 15:21:37 +01:00
Sander de Smalen 60615cfb43 [SveEmitter] Add builtins for SVE2 Large integer arithmetic
This patch adds builtins for:
- svadclb
- svadclt
- svsbclb
- svsbclt
2020-05-07 15:21:37 +01:00
Sander de Smalen 36aab0c055 [SveEmitter] Add builtins for SVE2 Bitwise ternary logical instructions
This patch adds builtins for:
- svbcax
- svbsl
- svbsl1n
- svbsl2n
- sveor3
- svnbsl
- svxar
2020-05-07 15:21:37 +01:00
Sander de Smalen b0348af108 [SveEmitter] Add builtins for SVE2 widening pairwise arithmetic
This patch adds builtins for:
- svadalp
2020-05-07 15:21:37 +01:00
Sander de Smalen 7ff05002d0 [SveEmitter] Add builtins for SVE2 Non-widening pairwise arithmetic
This patch adds builtins for:
- svaddp
- svmaxnmp
- svmaxp
- svminnmp
- svminp
2020-05-07 15:21:37 +01:00
Alexey Bataev 8026394d3c [OPENMP]Consider 'omp_null_allocator' as a predefined allocator.
Summary:
omp.h header file defines omp_null_allocator as a predefined allocator,
need to consider it also as a predefined allocator.

Reviewers: jdoerfert

Subscribers: jholewinski, yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79186
2020-05-07 10:11:06 -04:00
Sander de Smalen 0d22076531 [SveEmitter] Add builtins for SVE2 uniform DSP operations
This patch adds builtins for:
- svqdmulh, svqdmulh_lane
- svqrdmlah, svqrdmlah_lane
- svqrdmlsh, svqrdmlsh_lane
- svqrdmulh, svqrdmulh_lane
2020-05-07 13:31:46 +01:00
Sander de Smalen 5fa0eeec6e [SveEmitter] Add more SVE2 builtins for shift operations
This patch adds builtins for:
- svqshlu
- svrshr
- svrsra
- svsli
- svsra
- svsri
2020-05-07 13:31:46 +01:00
Sander de Smalen dc2986f9dc [SveEmitter] Add builtins for SVE2 saturating shift left and addition
This patch adds builtins for:
- svqrshl
- svqshl
- svsqadd
- svuqadd
2020-05-07 13:31:46 +01:00
Sander de Smalen b32d14c30e [SveEmitter] Add builtins for SVE2 uniform DSP operations
This patch adds builtins for:
- svqadd, svhadd, svrhadd
- svqsub, svhsub, svqusbr, svhsubr
- svqabs
- svqneg
- svrecpe
- svrsqrte
2020-05-07 13:31:46 +01:00
Sander de Smalen 35de496550 [SveEmitter] Add builtins for svqdecp and svqincp
This patch adds builtins for saturating increment/decrement by svcntp,
in scalar and vector forms.
2020-05-07 13:31:46 +01:00
Sander de Smalen cac06263a4 [SveEmitter] Add builtins for svinsr 2020-05-07 13:31:46 +01:00
Calixte Denizet bec223a9bc [profile] Don't crash when forking in several threads
Summary:
When forking in several threads, the counters were written out in using the same global static variables (see GCDAProfiling.c): that leads to crashes.
So when there is a fork, the counters are resetted in the child process and they will be dumped at exit using the interprocess file locking.
When there is an exec, the counters are written out and in case of failures they're resetted.

Reviewers: jfb, vsk, marco-c, serge-sans-paille

Reviewed By: marco-c, serge-sans-paille

Subscribers: llvm-commits, serge-sans-paille, dmajor, cfe-commits, hiraditya, dexonsmith, #sanitizers, marco-c, sylvestre.ledru

Tags: #sanitizers, #clang, #llvm

Differential Revision: https://reviews.llvm.org/D78477
2020-05-07 14:13:11 +02:00
Sergej Jaskiewicz ddfe58822e Revert "[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake"
This reverts commit 67175d8dc5.

https://reviews.llvm.org/D78200 has been reverted, so our bot is red.
Make it green by turning off std::filesystem.
2020-05-07 15:01:39 +03:00
Sander de Smalen 4f94e1a9f7 [SveEmitter] Add builtins for svasrd (zeroing/undef predication)
This patch adds builtins for arithmetic shift right (round towards zero)
instructions for zeroing (_z) and undef (_x) predication.
2020-05-07 12:28:18 +01:00
Sander de Smalen dbc6a07bcc [SveEmitter] Add builtins for address calculations.
This patch adds builtins for:
- svadrb, svadrh, svadrw, svadrd
2020-05-07 12:28:18 +01:00
Sander de Smalen 827c8b06d3 [SveEmitter] Add builtins for svcntp 2020-05-07 12:28:18 +01:00
Sander de Smalen ac894a5181 [SveEmitter] Add builtins for FFR manipulation
This patch adds builtins for:
- svrdffr, svrdffr_z
- svsetffr
- svwrffr
2020-05-07 12:28:18 +01:00
Sander de Smalen 91cb13f90d [SveEmitter] Add builtins for svqadd, svqsub and svdot
This patch adds builtins for saturating add/sub instructions:
- svqadd, svqadd_n
- svqsub, svqsub_n

and builtins for dot product instructions:
- svdot, svdot_lane
2020-05-07 12:28:18 +01:00
Lucas Prates 9d39df03a9 [Clang][Sema] Capturing section type conflicts between #pragma clang section and section attributes
Summary:
Conflicting types for the same section name defined in clang section
pragmas and GNU-style section attributes were not properly captured by
Clang's Sema. The lack of diagnostics was caused by the fact the section
specification coming from attributes was handled by Sema as implicit,
even though explicitly defined by the user.

This patch enables the diagnostics for section type conflicts between
those specifications by making sure sections defined in section
attributes are correctly handled as explicit.

Reviewers: hans, rnk, javed.absar

Reviewed By: rnk

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78573
2020-05-07 11:54:46 +01:00
Lucas Prates 0dac639f28 [Clang][Sema] Capturing section type conflicts on #pragma clang section
Summary:
Section names used in clang section pragmas were not validated against
previously defined sections, causing section type conflicts to be
ignored by Sema.

This patch enables Clang to capture these section type conflicts by
using the existing Sema's UnifySection method to validate section names
from clang section pragmas.

Reviewers: hans, rnk, javed.absar

Reviewed By: rnk

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78572
2020-05-07 11:53:30 +01:00
Sander de Smalen 3cb8b4c193 [SveEmitter] Add builtins for SVE2 Polynomial arithmetic
This patch adds builtins for:
- sveorbt
- sveortb
- svpmul
- svpmullb, svpmullb_pair
- svpmullt, svpmullt_pair

The svpmullb and svpmullt builtins are expressed using the svpmullb_pair
and svpmullt_pair LLVM IR intrinsics, respectively.

Reviewers: SjoerdMeijer, efriedma, rengolin

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D79480
2020-05-07 11:53:04 +01:00
Han Zhu 0c9230dad1 Reland [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON
f8990feb12 enabled installing PIC version of both libclang.a and
libclang.so when LIBCLANG_BUILD_STATIC is ON. But it broke the no-PIC
build when LLVM_ENABLE_PIC=OFF with the following error:

```
CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
    target_compile_definitions called with non-compilable target type
```

This is because as the code loops through ${name} and ${name}_static, it
introduced a side effect, which is adding an empty libclang_static to
targets. Later target_compile_definitions is called on libclang_static.
That function requires that target must have been created by a command
such as add_executable() or add_library(), so it crashed.

The solution is to not naively loop through both libclang and
libclang_static, but only the ones that are actually added by
llvm_add_library(). Here's the library build type to library target name
mapping:

| SHARED only | libclang |
| STATIC only | libclang |
| SHARED and STATIC | libclang and libclang_static |

So only when SHARED and STATIC are both set should we loop through two
targets. Explicitly parse the STATIC argument and set the list
accordingly.

Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D79059
2020-05-06 19:33:58 -07:00
Christopher Tetreault 5a77b958e2 [NFC] Improve doc string to mention that paths in diff are used as-is
Summary:
Add --relative to the suggested git-diff one liner. If the user does not
pass this argument, then git will produce a diff with the path relative
to the repository root. If the user's working directory is not the
repository root, then clang-format will complain that the file is not
found. The --relative argument makes git produce a diff with the files
relative to the working directory.

Add note to doc string to warn users about the fact that filenames
embedded in the diff are used as-is with no attempts to "do what they
mean, not what they say"

Reviewers: djasper, alexfh, efriedma, klimek, thakis

Reviewed By: efriedma

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79054
2020-05-06 15:20:05 -07:00
Craig Topper 16c800b8b7 [X86] Remove support for Y0 constraint as an alias for Yz in inline assembly.
Neither gcc or icc support this. Split out from D79472. I want
to remove more, but it looks like icc does support some things
gcc doesn't and I need to double check our internal test suites.
2020-05-06 14:58:53 -07:00
Artem Belevich 314f99e7d4 [CUDA] Enable existing builtins for PTX7.0 as well.
Differential Revision: https://reviews.llvm.org/D79515
2020-05-06 14:24:21 -07:00
Craig Topper 9bb9ff0957 [X86] Remove incomplete support for 'Y' has an inline assembly constraint by itself.
Y is the start of several 2 letter constraints, but we also had
partial support to recognize it by itself. But it doesn't look
like it can get through clang as a single letter so the backend
support for this was effectively dead.
2020-05-06 14:23:04 -07:00
Melanie Blower e5578013b1 When pragma FENV_ACCESS is ignored do not modify Sema.CurFPFeatures
Bug reported by @uabelho against reviews.llvm.org/D72841

Reviewers: rjmccall

Differential Revision: https://reviews.llvm.org/D79510
2020-05-06 13:18:59 -07:00
Akira Hatanaka dc4e25d4f2 [CodeGen][ObjC] Don't try to retain a __unsafe_unretained ARC pointer
passed to __builtin_os_log_format to extend its lifetime to the end of
its enclosing block

Extend only lifetimes of pointers returned by function calls or message
sends instead. In the long term, we should lifetime-extend pointers in
more complex expressions and non-ARC objects (e.g., C++ temporaries)
too.

rdar://problem/61846261
2020-05-06 12:47:17 -07:00
Daan De Meyer f21c704553 clang-format: Add ControlStatementsExceptForEachMacros option to SpaceBeforeParens
Summary: systemd recently added a clang-format file. One issue I
encountered in using clang-format on systemd is that systemd does
not add a space before the parens of their foreach macros but
clang-format always adds a space. This does not seem to be
configurable in clang-format. This revision adds the
ControlStatementsExceptForEachMacros option to SpaceBeforeParens
which puts a space before all control statement parens except
ForEach macros. This drastically reduces the amount of changes
when running clang-format on systemd's source code.

Reviewers: MyDeveloperDay, krasimir, mitchell-stellar

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D78869
2020-05-06 20:59:24 +02:00
Fangrui Song 57a1c1be53 [Sema] Allow function attribute patchable_function_entry on aarch64_be
Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D79495
2020-05-06 10:10:25 -07:00
Melanie Blower c355bec749 Add support for #pragma clang fp reassociate(on|off)
Reviewers: rjmccall, erichkeane, sepavloff

Differential Revision: https://reviews.llvm.org/D78827
2020-05-06 08:05:44 -07:00
Erich Keane 8a1c999c9b Implement _ExtInt ABI for all ABIs in Clang, enable type for ABIs
This is the result of an audit of all of the ABIs in clang to implement
and enable the type for those targets.

Additionally, this finds an issue with integer-promotion passing for a
few platforms when using _ExtInt of < int, so this also corrects that
resulting in signext/zeroext being on a params of those types in some
platforms.

Differential Revisions: https://reviews.llvm.org/D79118
2020-05-06 06:52:18 -07:00
Alexandre Ganea 3483cdc834 [Sema] Silence warnings when targeting x86 with VS2019 16.5.4
Differential Revision: https://reviews.llvm.org/D79337
2020-05-06 09:11:59 -04:00
Richard Sandiford 69ab8b46b8 [Sema][SVE] Fix handling of initialisers for built-in SVE types
The built-in SVE types are supposed to be treated as opaque types.
This means that for initialisation purposes they should be treated
as a single unit, much like a scalar type.

However, as Eli pointed out, actually using "scalar" in the diagnostics
is likely to cause confusion, given the types are logically vectors.
The patch therefore uses custom diagnostics or generalises existing
ones.  Some of the messages use the word "indivisible" to try to make
it clear(er) that these types can't be initialised elementwise.

I don't think it's possible to trigger warn_braces_around_(scalar_)init
for sizeless types as things stand, since the types can't be used as
members or elements of more complex types.  But it seemed better to be
consistent with ext_many_braces_around_(scalar_)init, so the patch
changes it anyway.

Differential Revision: https://reviews.llvm.org/D76689
2020-05-06 12:24:27 +01:00
Denys Petrov ba8cda989c [analyzer] Stability improvement for IteratorModeling
Summary:
Some function path may lead to crash.
Fixed using local variable outside the scope  through a pointer.
Fixed minor misspellings.
Added regression test.

This patch covers a bug https://bugs.llvm.org/show_bug.cgi?id=41485

Reviewed By: baloghadamsoftware

Differential Revision: https://reviews.llvm.org/D78289
2020-05-06 14:16:39 +03:00
Richard Sandiford e959931092 [Sema] Put existing warning under -Wexcess-initializers
I have a follow-on patch that uses an alternative wording for
ext_excess_initializers in some cases.  This patch puts it and
a couple of related warnings under their own -W option in order
to avoid a regression in Misc/warning-flags.c.

Differential Revision: https://reviews.llvm.org/D79244
2020-05-06 11:28:40 +01:00
Haojian Wu c6e1fd70fb [clang] Fix a crash on invalid auto.
Summary:
The crash is triggered on accessing a null InitExpr.

For group declaration, e.g. `auto c = a, &d = {a};`, what's happening:

1. each VarDecl is built separately during the parsing stage.
2. perform the semantic analysis (Sema::BuildDeclaratorGroup) to check
whether the type of the two VarDecl is the same, if not mark it as invalid.

in step 1, VarDecl c and d are built, both of them are valid (after D77395),
but d is without the InitExpr attached (under -fno-recovery-ast), crash
happens in step 2 when accessing the source range of d's InitExpr.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79473
2020-05-06 11:47:03 +02:00
Richard Sandiford fb4574df52 [docs] Regenerate DiagnosticsReference.rst
It looks like it has been a while since the checked-in version of
DiagnosticsReference.rst was regenerated.  I realise there probably
isn't any expectation that the checked-in version is kept up-to-date,
but now that the project is on github and the rst can be viewed directly
from the repo's web interface, it seemed worth having something a bit
more recent.

Differential Revision: https://reviews.llvm.org/D79236
2020-05-06 10:26:47 +01:00
Benjamin Kramer d5ea89f891 Quiet some -Wdocumentation warnings. 2020-05-06 11:23:13 +02:00
Vitaly Buka 04bd2c37ca [local-bounds] Ignore volatile operations
Summary:
-fsanitize=local-bounds is very similar to ``object-size`` and
should also ignore volatile pointers.
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#volatile

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, hiraditya, llvm-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D78607
2020-05-05 23:08:08 -07:00
Jan Korous 02b303321d [libclang] Remove duplicate dependency on LLVMSupport
Differential Revision: https://reviews.llvm.org/D79451
2020-05-05 21:31:07 -07:00
Craig Topper 0fac1c1912 [X86] Allow Yz inline assembly constraint to choose ymm0 or zmm0 when avx/avx512 are enabled and type is 256 or 512 bits
gcc supports selecting ymm0/zmm0 for the Yz constraint when used with 256 or 512 bit vector types.

Fixes PR45806

Differential Revision: https://reviews.llvm.org/D79448
2020-05-05 21:12:30 -07:00
Azharuddin Mohammed b0eb7cd2be Reapply "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"
This is in response to the recent move to Python 3.

This reverts commit 5f4426e517.
2020-05-05 15:56:23 -07:00
Artem Belevich 844096b996 [CUDA] Make NVVM builtins available with CUDA-11/PTX6.5
Differential Revision: https://reviews.llvm.org/D79449
2020-05-05 15:43:32 -07:00
Sergej Jaskiewicz 67175d8dc5 [cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake
Now that https://reviews.llvm.org/D78200 has landed, there should be
no problem with those tests. If there is, it is OK to revert this.
2020-05-06 01:31:32 +03:00
Artem Belevich bf6a26b066 Revert D77954 -- it breaks Eigen & Tensorflow.
This reverts commit 55bcb96f31.
2020-05-05 14:07:31 -07:00
Michael Liao 9142c0b46b [clang][codegen] Hoist parameter attribute setting in function prolog.
Summary:
- If the coerced type is still a pointer, it should be set with proper
  parameter attributes, such as `noalias`, `nonnull`, and etc. Hoist
  that (pointer) parameter attribute setting so that the coerced pointer
  parameter could be marked properly.

Depends on D79394

Reviewers: rjmccall, kerbowa, yaxunl

Subscribers: jvesely, nhaehnle, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79395
2020-05-05 15:31:51 -04:00
Michael Liao 276c8dde0b [clang][codegen] Refactor argument loading in function prolog. NFC.
Summary:
- Skip copying function arguments and unnecessary casting by using them
  directly.

Reviewers: rjmccall, kerbowa, yaxunl

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79394
2020-05-05 15:31:51 -04:00
Erik Pilkington 86e50af72d [AST] Print fixed enum type regardless of language mode
These are permitted in all language modes, not just C++11.
2020-05-05 15:30:39 -04:00
Erik Pilkington 873e279095 [SemaObjC] Add a warning for dictionary literals with duplicate keys
Duplicate keys in a literal break NSDictionary's invariants. rdar://50454461A

Differential revision: https://reviews.llvm.org/D78660
2020-05-05 15:30:39 -04:00
Nico Weber 8fc7a907b9 Let normalize() for posix style convert backslash to slash unconditionally.
Currently, normalize() for posix replaces backslashes to slashes, except
that two backslashes in sequence are kept as-is.

clang calls normalize() to convert \ to / is microsoft compat mode. This
generally works well, but a path like "c:\\foo\\bar.h" with two
backslashes doesn't work due to the exception in normalize().

These paths happen naturally on Windows hosts with e.g.
`#include __FILE__`, and them not working on other hosts makes it
more difficult to write tests for this case.

The special case has been around without justification since this code
was added in r203611 (since then moved around in r215241 r215243).  No
integration tests fail if I remove it.

Try removing the special case.

Differential Revision: https://reviews.llvm.org/D79265
2020-05-05 13:54:55 -04:00
Hans Wennborg 55b9b11fea Don't assert about missing profile info in createProfileWeightsForLoop
The compiler shouldn't crash if the profile info is slightly off. We hit
this in Chromium.

Differential revision: https://reviews.llvm.org/D79417
2020-05-05 18:59:00 +02:00
Francesco Petrogalli 4fa13a3dac [clang][OpenMP] Fix getNDSWDS for aarch64.
Summary:
This change fixes an aarch64-specific bug in the generation of the NDS and WDS values used to compute the signature of the vector functions out of OpenMP directives like `declare simd`. When the directive is used in conjunction with the `linear` clause, the size of the pointee must be used instead of the size of the pointer to compute NDS and WDS.

The code-fix is strictly related to the behavior for `linear`, but given that the only way we have to test the NDS and WDS values is to check the resulting `<vlen>` token in the mangled name of the vector function, the tests have been extended to cover all the possible values of WDS and NDS as defined in the ABI at https://github.com/ARM-software/abi-aa/tree/master/vfabia64.

Reviewers: ABataev, jdoerfert, andwar

Reviewed By: jdoerfert

Subscribers: yaxunl, kristof.beyls, guansong, danielkiss, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78969
2020-05-05 16:27:20 +00:00
Matt Arsenault 684dc1bebe Elaborate more on --rocm-path flag.
I'm not sure what the conventions are for this documentation. The
format seems limiting. I don't see how to refer to other flags, or
mark flags as deprecated. The rst I believe these generate seems to be
in source, and out of date.
2020-05-05 09:33:18 -04:00
Jonathan Coe 047898c9aa [clang-format] C# always regards && as a binary operator
Reviewers: krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D79414
2020-05-05 14:05:00 +01:00
Sander de Smalen 5ba329059f [SveEmitter] Add builtins for svreinterpret
The reinterpret builtins are generated separately because they
need the cross product of all types, 121 functions in total,
which is inconvenient to specify in the arm_sve.td file.

Reviewers: SjoerdMeijer, efriedma, ctetreau, rengolin

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78756
2020-05-05 13:04:44 +01:00
Sander de Smalen aed6bd6f42 Reland D78750: [SveEmitter] Add builtins for svdupq and svdupq_lane
Edit: Changed a few CHECK lines into CHECK-DAG lines.

This reverts commit 90f3f62cb0.
2020-05-05 10:42:11 +01:00
Haojian Wu 4f8d9722b4 [clang] Fix an uint32_t overflow in large preamble.
Summary:
I was surprised to see the LocalOffset can exceed uint32_t, but it
does happen and lead to crashes in one of our internal huge TU with a large
preamble.

with this patch, the crash is gone.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79397
2020-05-05 10:36:34 +02:00
Yaxun (Sam) Liu d75a6e93ae [CUDA][HIP] Fix empty ctor/dtor check for union
union ctor does not call ctors of its data members. union dtor does not call dtors of its data members.
Also union does not have base class.

Currently when clang checks whether union has an empty ctor/dtor, it checks the ctors/dtors of its
data members. This causes incorrectly diagnose device side global variables and shared variables as
having non-empty ctors/dtors.

This patch fixes that.

Differential Revision: https://reviews.llvm.org/D79367
2020-05-04 21:52:04 -04:00
Sander de Smalen 90f3f62cb0 Revert "[SveEmitter] Add builtins for svdupq and svdupq_lane"
It seems this patch broke some buildbots, so reverting until I
have had a chance to investigate.

This reverts commit 6b90a6887d.
2020-05-04 21:31:55 +01:00
Erich Keane 9fbf9989a2 Reject operations between vectors and enum types.
There are some lookup oddities with these as reported in PR45780, and
GCC doesn't support these behaviors at all.  To be more consistent with
GCC and prevent the crashes caused by our lookup issues, nip the problem
in the bud and prohibit enums here.
2020-05-04 13:11:24 -07:00
Sander de Smalen 6b90a6887d [SveEmitter] Add builtins for svdupq and svdupq_lane
* svdupq builtins that duplicate scalars to every quadword of a vector
  are defined using builtins for svld1rq (load and replicate quadword).
* svdupq builtins that duplicate boolean values to fill a predicate vector
  are defined using `svcmpne`.

Reviewers: SjoerdMeijer, efriedma, ctetreau

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78750
2020-05-04 20:38:47 +01:00
Sander de Smalen 54fa46aa0a [SveEmitter] Add builtins for Int & FP reductions
This patch adds integer builtins for:
- svaddv, svandv, sveorv,
  svmaxv, svminv, svorv.

And FP builtins for:
- svadda, svaddv, svmaxv, svmaxnmv,
  svminv, svminnmv
2020-05-04 19:50:16 +01:00
Denys Petrov f01ac8c657 A test commit as a new contributor to verify commit access is OK. 2020-05-04 21:36:18 +03:00
Zarko cb78376433 Test commit. Modified comment to add a period at the end. 2020-05-04 13:06:21 -04:00
Yaxun (Sam) Liu 66041187c9 Let clang print registered targets for --version
We need a way to know supported targets by clang since
people may use clang as assembler and they want to
choose the clang which supports their target.

This patch let clang print registered targets when
--version option is passed to clang.

Differential Revision: https://reviews.llvm.org/D79210
2020-05-04 12:26:18 -04:00
Melanie Blower 7cbb495ab4 Fix LABEL match for test case for D72841 #pragma float_control 2020-05-04 07:27:40 -07:00
Raul Tambre 0863e94ebd [AArch64] Add NVIDIA Carmel support
Summary:
NVIDIA's Carmel ARM64 cores are used in Tegra194 chips found in Jetson AGX Xavier, DRIVE AGX Xavier and DRIVE AGX Pegasus.

References:
* https://devblogs.nvidia.com/nvidia-jetson-agx-xavier-32-teraops-ai-robotics/#h.huq9xtg75a5e
* NVIDIA Xavier Series System-on-Chip Technical Reference Manual 1.3 (https://developer.nvidia.com/embedded/downloads#?search=Xavier%20Series%20SoC%20Technical%20Reference%20Manual)

Reviewers: sdesmalen, paquette

Reviewed By: sdesmalen

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

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D77940
2020-05-04 13:52:30 +01:00
Melanie Blower f5360d4bb3 Reapply "Add support for #pragma float_control" with buildbot fixes
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

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

This reverts commit fce82c0ed3.
2020-05-04 05:51:25 -07:00
Milian Wolff 08e1812643 [libclang]: visit C++17 if init statements
This makes the previously unaccessible AST nodes for C++17 "if with
init statements" accessible to consumers of libclang.

Differential Revision: https://reviews.llvm.org/D78214
2020-05-02 22:18:36 +02:00
Milian Wolff 4597e3bd47 [libclang]: visit BindingDecl in DecompositionDecl
This makes the BindingDecl accessible to consumers of libclang
as CXCursor_UnexposedDecl where previously these AST nodes were
not visited at all from the libclang API.

Differential Revision: https://reviews.llvm.org/D78213
2020-05-02 22:18:31 +02:00
mydeveloperday 9e194a3b93 [sema] NFC Unable to build Sema library with MSVC Debug target due to missing /bigobj
Summary:
Unable to build sema library on MSVC with Debug target

```
C:\clang\llvm-project\clang\lib\Sema\SemaOpenMP.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
```

Reviewed By: aaron.ballman

Subscribers: mgorny, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79292
2020-05-02 19:34:58 +01:00
Benjamin Kramer c0f210d636 Don't stash types that aren't copyable or moveable into a SmallVector
This seems to be working by accident.
2020-05-02 19:13:06 +02:00
Benjamin Kramer cc1c516558 Use realloc for NestedNameSpecifierLocBuilder
These allocations are so tiny that the buffer can be grown in-place most
of the time.
2020-05-02 17:12:44 +02:00
mydeveloperday ece7e95f02 [clang-format] NFC - clang-format the FormatTests
Summary:
Ensure the clang-format unit tests are themselves clang-formatted

Having areas of the llvm code which are clang-format clean, give us more areas to run new clang-format binaries on ensuring we haven't broken anything.

It seems to me we SHOULD have this clang-formatted at a minimum, otherwise how can we expect others to use clang-format if we "don't eat our own dogfood", also if the tests are dependent on the formatting of the code then that would also be bad!

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79204
2020-05-02 15:42:20 +01:00
Sam McCall d10c995b4d std::isspace -> llvm::isSpace (where locale should be ignored)
I've left out some cases where I wasn't totally sure this was right or
whether the include was ok (compiler-rt) or idiomatic (flang).
2020-05-02 15:36:04 +02:00
Michael Liao f3a3db8627 Add the missing '='. NFC. 2020-05-02 01:07:44 -04:00
Thomas Lively e0f52842c8 [WebAssembly] Renumber SIMD opcodes
Summary:
As described in https://github.com/WebAssembly/simd/pull/209. This is
the final reorganization of the SIMD opcode space before
standardization. It has been landed in concert with corresponding
changes in other projects in the WebAssembly SIMD ecosystem.

Reviewers: aheejin

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79224
2020-05-01 17:20:49 -07:00
Sander de Smalen 334931f54b [SveEmitter] Add builtins for shifts.
This patch adds builtins for:
- svasrd
- svlsl
- svlsr
2020-05-01 22:27:24 +01:00
Francesco Petrogalli 7585ba208e [clang][OpenMP] Fix mangling of linear parameters.
Summary:
The linear parameter token in the mangling function must be multiplied
by the pointee size in bytes when the parameter is a pointer.

Reviewers: ABataev, andwar, jdoerfert

Subscribers: yaxunl, guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78965
2020-05-01 21:19:00 +00:00
Michał Górny cac8cd0a16 [clang] [unittest/AST] Fix linking to LLVMTestingSupport
Link to LLVMTestingSupport via target_link_libraries() instead of
clang_target_link_libraries().  The latter is ineffective if tests
are linked to libclang.so.  This solution is consistent with what other
tests do.
2020-05-01 21:22:51 +02:00
Nico Weber b9d50bdff2 Fix pr31836 on Windows too, and correctly handle repeated separators.
The approach in D30000 assumes that the '/' returned by path::begin()
is the first element for absolute paths, but that's not true on
Windows.

Also, on Windows backslashes in include lines often end up escaped
so that there are two of them. Having backslashes in include lines
is undefined behavior in most cases and implementation-defined
behavior in C++20, but since clang treats it as normal repeated
path separators, the diagnostic should too.

Unbreaks -Wnonportable-include-path for absolute paths on Windows,
and unbreaks it on non-Windows in the case of absolute paths with
repeated directory separators.

This affects e.g. the `#include __FILE__` technique if the file
passed to clang has the wrong case for the drive letter. Before:

C:\src\llvm-project>bin\clang-cl.exe c:\src\llvm-project\test.cc
c:\\src\\llvm-project\\test.cc(4,10): warning: non-portable path to file
    '"c\\srccllvm-projectctest.cc.'; specified path differs in case from
    file name on disk [-Wnonportable-include-path]
         ^

Now:

C:\src\llvm-project> out\gn\bin\clang-cl c:\src\llvm-project\test.cc
c:\\src\\llvm-project\\test.cc(4,10): warning: non-portable path to file
    '"C:\\src\\llvm-project\\test.cc"'; specified path differs in case from
    file name on disk [-Wnonportable-include-path]
         ^

Differential Revision: https://reviews.llvm.org/D79223
2020-05-01 14:17:01 -04:00
Melanie Blower fce82c0ed3 Revert "Reapply "Add support for #pragma float_control" with improvements to"
This reverts commit 69aacaf699.
2020-05-01 10:31:09 -07:00
Melanie Blower 69aacaf699 Reapply "Add support for #pragma float_control" with improvements to
test cases
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

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

This reverts commit 85dc033cac, and makes
corrections to the test cases that failed on buildbots.
2020-05-01 10:03:30 -07:00
Sander de Smalen 1a720d49dc [SveEmitter] Add builtins for various FP operations
Unary:
- svexpa, svtmad, svtsmul, svtssel,
  svscale, svrecpe, svrecps, svrsqrte,
  svrsqrts,

Binary:
- svabd, svadd, svdiv, svdivr,
  svmin, svmax, svminnm, svmaxnm,
  svmul, svmulx, svsub, svsubr,
  svmul_lane

Complex:
- svcadd, svcmla
2020-05-01 17:37:43 +01:00
Alexey Bataev 8c2f4e0e85 [OPENMP50]Codegen for reduction clauses with 'task' modifier.
Summary:
Added codegen for reduction clause with task modifier.
```
  #pragma omp ... reduction(task, +: a)
  {
  #pragma omp ... in_reduction(+: a)
  }
```
is translated into something like this:
```
  #pragma omp ... reduction(+:a)
  {
    struct red_input_t {
      void *reduce_shar;
      void *reduce_orig;
      size_t reduce_size;
      void *reduce_init;
      void *reduce_fini;
      void *reduce_comb;
      unsigned flags;
    } r_var;
    r_var.reduce_shar = &a;
    r_var.reduce_orig = &original a;
    r_var.reduce_size = sizeof(a);
    r_var.reduce_init = [](void* l,void*){return *(int*)l=0;};
    r_var.reduce_fini = nullptr;
    r_var.reduce_comb = [](void* l,void* r){return *(int*)l += *(int)r;};
    void *tg = __kmpc_taskred_modifier_init(<loc_addr>,<gtid>,
      <flag - 0 for parallel, 1 for worksharing>,
      <1 - number of reduction elements>,
      &r_var);
    {
    #pragma omp ... in_reduction(+: a) firstprivate(tg)
    ...
    }
    __kmpc_task_reduction_modifier_fini(<loc_addr>,<gtid>,
      <flag - 0 for parallel, 1 for worksharing>);
  }
```

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, jfb, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79034
2020-05-01 11:40:27 -04:00
Melanie Blower 85dc033cac Revert "Add support for #pragma float_control"
This reverts commit 4f1e9a17e9.
due to fail on buildbot, sorry for the noise
2020-05-01 06:36:58 -07:00
Melanie Blower 4f1e9a17e9 Add support for #pragma float_control
Reviewers: rjmccall, erichkeane, sepavloff

Differential Revision: https://reviews.llvm.org/D72841
2020-05-01 06:14:24 -07:00
Samuel Thibault 68e89c5b96 [Gnu toolchain] Move GCC multilib/multiarch paths support from Linux to Gnu
Add missing files

Summary: The current code for GNU/Linux is actually completely generic, and can be moved to Gnu, so it can benefit GNU/Hurd and GNU/kFreeBSD

Reviewers: kristina, sammccall, lebedev.ri, MaskRay, arsenm, phosek

Reviewed By: MaskRay, phosek

Subscribers: wdng, ormris, emaste, arichardson, krytarowski, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73845
2020-05-01 12:37:12 +02:00
Samuel Thibault c298e5a022 [Gnu toolchain] Move GCC multilib/multiarch paths support from Linux to Gnu
Summary: The current code for GNU/Linux is actually completely generic, and can be moved to Gnu, so it can benefit GNU/Hurd and GNU/kFreeBSD

Reviewers: kristina, sammccall, lebedev.ri, MaskRay, arsenm, phosek

Reviewed By: MaskRay, phosek

Subscribers: wdng, ormris, emaste, arichardson, krytarowski, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73845
2020-05-01 12:12:27 +02:00
Craig Topper af28e02e74 [clang] Add vendor identity for Hygon Dhyana processor to cpuid.h
The vendor id is used to determine whether the processor
supports hardware CRC32 in the Scudo code. The previous
discussion about the patch is in [1], and more information
about Hygon Dhyana processor is in[2].

[1]: https://reviews.llvm.org/D62368
[2]: https://git.kernel.org/torvalds/c/c9661c1e80b609cd038db7c908e061f0535804ef

Patch by fanjinke (Jinke Fan)

Differential Revision: https://reviews.llvm.org/D78874
2020-04-30 18:17:01 -07:00
Douglas Yung 046130490f Add header guards for header files that should not be included on the PS4 platform.
Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79194
2020-04-30 16:17:34 -07:00
Nikita Popov afc287e0ab Fix clang test after D76886 2020-04-30 23:42:38 +02:00
Michael Liao d1c43615ed [clang-format] Add the missing default argument. 2020-04-30 17:36:43 -04:00
mydeveloperday 511868dcf3 [clang-format] [PR45626] SpacesInAngles does not insert or preserve leading space before :: operator
Summary:
See https://bugs.llvm.org/show_bug.cgi?id=45626

Ensure space between < and ::

(void)static_cast<::std::uint32_t >(1);

Reviewers: krasimir, mitchell-stellar

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79172
2020-04-30 21:47:19 +01:00
Alexey Bataev b5be1c5419 [OPENMP50]Basic support for uses_allocators clause.
Summary: Added parsing/sema/serialization supoprt for uses_allocators clause.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, arphaman, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78577
2020-04-30 16:24:36 -04:00
Sylvain Audi 226489715c [clang] Disable check for system sanitizer blacklists files if -fno-sanitizer-blacklist was specified
This is to avoid checking for the validity of a file that is not used.
This also contains a minor fix for the test, as the cfi sanitizer requires -flto and -fvisibility= arguments.

Differential Revision: https://reviews.llvm.org/D79043
2020-04-30 16:04:50 -04:00
Alexey Bataev b737b814fe [OPENMP]Allow cancellation constructs in target parallel regions.
Summary:
omp cancellation point parallel and omp cancel parallel directives are
allowed in target paralle regions.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, caomhin, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78941
2020-04-30 15:10:52 -04:00
Alexey Bataev 1c1d9d9d7f [OPENMP50]Support 'task' modifier in reduction clauses.
Summary:
Added basic support for 'task' modifier in the reduction clauses in
non-simd parallel and worksharing constructs.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78738
2020-04-30 14:43:01 -04:00
Aaron Smith 4eabd00612 [Windows SEH] Fix abnormal-exits in _try
Summary:
Per Windows SEH Spec, except _leave, all other early exits of a _try (goto/return/continue/break) are considered abnormal exits.  In those cases, the first parameter passes to its _finally funclet should be TRUE to indicate an abnormal-termination.

One way to implement abnormal exits in _try is to invoke Windows runtime _local_unwind() (MSVC approach) that will invoke _dtor funclet where abnormal-termination flag is always TRUE when calling _finally.  Obviously this approach is less optimal and is complicated to implement in Clang.

Clang today has a NormalCleanupDestSlot mechanism to dispatch multiple exits at the end of _try.  Since  _leave (or try-end fall-through) is always Indexed with 0 in that NormalCleanupDestSlot,  this fix takes the advantage of that mechanism and just passes NormalCleanupDest ID as 1st Arg to _finally.

Reviewers: rnk, eli.friedman, JosephTremoulet, asmith, efriedma

Reviewed By: efriedma

Subscribers: efriedma, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77936
2020-04-30 09:38:19 -07:00
Aaron Smith 292058a5d6 [clang-format] Fix Microsoft style for enums
Summary:
Before this change enums were formatted incorrectly for the Microsoft style.

[C++ Example]

    enum {
      one,
      two
    } three, four;

[Incorrectly Formatted]

    enum
    {
      one,
      two
    } three,
        four;

[Correct Format with Patch]

    enum
    {
      one,
      two
    } three, four;

Reviewers: jbcoe, MyDeveloperDay, rnk

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D78982
2020-04-30 09:11:54 -07:00
jasonliu e0c356582d [NFC][clang] Replace raw new/delete with unique_ptr to store ABIInfo in TargetCodeGenInfo
Use unique_ptr to manage the lifetime of ABIInfo member inside TargetCodeGenInfo.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D79033
2020-04-30 12:31:50 +00:00
mydeveloperday a8b8bd0f8d [clang-format] Fix a bug causing BeforeLambdaBody to affect brace initialiser formatting
Summary: The condition added with the new setting checked whether the character was an l-brace, not specifically a lambda l-brace, when deciding whether it was possible to break before it or not. This caused the l-brace of some initialiser lists to break onto the next line with the first argument of the initialiser list when the setting was enabled.

Reviewed By: MyDeveloperDay, Wawha

Patch By: duncan-llvm

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79022
2020-04-30 11:11:34 +01:00
mydeveloperday 573322694a [clang-format] Correct the AfterControlStatement configuration option output style
Summary:
Due to the order in which the enum cases were defined the old options which were retained for backwards compatibility were being preferred over the new options when printing with the --dump-config option.

Reviewers: MyDeveloperDay

Reviewed By: MyDeveloperDay

Patch By:  duncan-llvm

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79020
2020-04-30 11:05:02 +01:00
mydeveloperday 14198ccfb3 [clang-format] Fix lambda with ellipsis in return type
Summary:
BTW my actual code that hit this issue is like

```
[a, b = std::move(b)](auto &&... c) mutable -> std::invoke_result_t<decltype(b), decltype(c)...> { /* omitted */ }
```

where this explicit return type is required for SFINAE.

Reviewed By: krasimir, MyDeveloperDay

Patch By: johnchen902

Subscribers: krasimir, dexonsmith, cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D78694
2020-04-30 11:02:42 +01:00
mydeveloperday b01dca5008 [clang-format] [PR45357] Fix issue found with operator spacing
Summary:
This is a tentative fix for https://bugs.llvm.org/show_bug.cgi?id=45357

Spaces seem to be introduced between * and * due to changes brought in for {D69573}

Reviewers: sylvestre.ledru, mitchell-stellar, sammccall, Abpostelnicu, krasimir, jbcoe

Reviewed By: Abpostelnicu

Subscribers: tstellar, hans, Abpostelnicu, cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D78879
2020-04-30 10:55:59 +01:00
mydeveloperday 0fa7e4adca [clang-format] NFC Correct clang-format headers file so documentation can be once again autogenerated
Summary:
`ClangFormatStyleOptions.rst` should ALWAYS be autogenerated from Format.h using `clang/docs/tools/dump_format_style.py` if not its liable to get removed leaving options undocumented.

This revision reworks the documentation for {D73354} {D73768} to ensure we can continue to regenerated

Fix other minor changes that ensure the documentation remains consistent (Format.h obviously got re clang-formatted after the rst had been regenerated previously)

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79095
2020-04-30 10:50:29 +01:00
Erich Keane 5b862b6aa7 Fix ext-int Sema test that didn't specify a triple.
I added a limit to make sure that _ExtInt isn't exposed on systems that
haven't considered it in their ABI.  The ext-int.cpp Sema test didn't
have a triple, so on non x86/x86_64 it would fail with this new error.

This patch adds said triple to make sure this passes.
2020-04-29 14:34:53 -07:00
Erich Keane 911add149a Disable _ExtInt by default
Since the _ExtInt type got into the repo, we've discovered that the ABI
implications weren't completely understood. The other architectures are
going to be audited (see D79118), however downstream targets aren't
going to benefit from this audit.

This patch disables the _ExtInt type by default and makes the
target-info an opt-in.  As it is audited, I'll re-enable these for all
of our default targets.
2020-04-29 13:48:12 -07:00
Erich Keane b5a4deec6a [NFC] Split ext-int calling convention tests into their own file.
I'm currently auditing all of the calling convention implications of
_ExtInt for all platforms, so splitting them up into their own test will
make this a much easier task to organize.
2020-04-29 12:20:21 -07:00
Erich Keane 5a1d9c0f5a Fix x86/x86_64 calling convention for _ExtInt
After speaking with Craig Topper about some recent defects, he pointed
out that _ExtInts should be passed indirectly if larger than the largest
int register, and like ints when smaller than that.  This patch
implements that.

Note that this changed the way vaargs worked quite a bit, but they still
work.

Differential Revision: https://reviews.llvm.org/D78785
2020-04-29 11:04:25 -07:00
Martin Storsjö a0e53de472 [clang] [MinGW] Add the compiler rt libdirs to the search path
This matches what is done for MSVC in
b8000c0ce8. Since that commit, compiler
rt sanitizer libraries aren't linked to with absolute path on windows,
but using their basenames, requiring the libdirs to be passed to
the linker.

This fixes undefined behaviour sanitizer on MinGW after
b8000c0ce8.

Differential Revision: https://reviews.llvm.org/D79076
2020-04-29 20:35:50 +03:00
David Zarzycki e717e8744d [libclang] Shared libraries require PIC unless WIN32 2020-04-29 11:25:45 -04:00
Aaron Ballman e00071db08 Fixing typo (singed -> signed); NFC 2020-04-29 10:33:21 -04:00
Hans Wennborg 209ab6d883 Revert 6654719 "[CMake] Fix logic error: NOT LIBCLANG_BUILD_STATIC does not imply PIC"
It broke building libclang.dll in Windows builds configured with
LLVM_ENABLE_PIC=OFF. See discussion on the cfe-commits thread.
2020-04-29 15:12:43 +02:00
Sander de Smalen a4dac6d4e0 [SveEmitter] Add builtins for svmov_b and svnot_b.
These are custom expanded in CGBuiltin:

  svmov_b_z(pg, op) <=> svand_b_z(pg, op, op)
  svnot_b_z(pg, op) <=> sveor_b_z(pg, op, pg)

Reviewers: SjoerdMeijer, efriedma, ctetreau, rengolin

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D79039
2020-04-29 13:33:18 +01:00
Valeriy Savchenko 23f4edf1fe [analyzer] Fix build error. NFC.
Move DenseMapInfo specialization to llvm namespace
2020-04-29 15:24:10 +03:00
Simon Pilgrim db97a12454 Fix Wparentheses gcc warning. NFC.
It should be either a float(32) or an int(32).
2020-04-29 12:21:05 +01:00
Sander de Smalen 42a56bf63f [SveEmitter] Add builtins for gather prefetches
Patch by Andrzej Warzynski

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78677
2020-04-29 11:52:49 +01:00
Valeriy Savchenko 239c53b72b [analyzer] Track runtime types represented by Obj-C Class objects
Summary:
Objective-C Class objects can be used to do a dynamic dispatch on
class methods. The analyzer had a few places where we tried to overcome
the dynamic nature of it and still guess the actual function that
is being called. That was done mostly using some simple heuristics
covering the most widespread cases (e.g. [[self class] classmethod]).
This solution introduces a way to track types represented by Class
objects and work with that instead of direct AST matching.

rdar://problem/50739539

Differential Revision: https://reviews.llvm.org/D78286
2020-04-29 13:35:53 +03:00
Richard Smith 20df6038ee Make -fno-char8_t disable the char8_t keyword, even in C++20.
This fixes a regression introduced in r354736, and makes our behavior
compatible with that of Clang 8 and GCC.
2020-04-28 23:49:35 -07:00
David Blaikie 628829254d SymbolManager::SymbolDependencies: Use unique_ptr to simplify memory management 2020-04-28 22:31:17 -07:00
David Blaikie e265f92b6e AnalysisDeclContext::ManagedAnalyses: Use unique_ptr to simplify memory management 2020-04-28 22:31:16 -07:00
David Blaikie 9b77242c9a CodeGenTypes::CGRecordLayouts: Use unique_ptr to simplify memory management 2020-04-28 22:31:16 -07:00
David Blaikie fcee80737c ASTContext::OMPTraitInfoVector: Use unique_ptr to simplify memory management 2020-04-28 22:31:16 -07:00
David Blaikie cbae0d8221 BugReporter::StrBugTypes: Use unique_ptr to simplify memory management 2020-04-28 22:31:16 -07:00
David Blaikie 4bd5fbec4b PragmaNamespace::Handlers: Use unique_ptr to simplify memory management
The API actually passes and returns ownership too, but the usage uis
complicated enough that I'm not going to unique_ptr-ify those add/remove
calls.
2020-04-28 22:31:15 -07:00
Richard Smith 0a088ead85 Improve diagnostics for missing import / #include of module.
Fix a few bugs where we would fail to properly determine header to
module correspondence when determining whether to suggest a #include or
import, and suggest a #include more often in language modes where there
is no import syntax. Generally, if the target is in a header with
include guards or #pragma once, we should suggest either #including or
importing that header, and not importing a module that happens to
textually include it.

In passing, improve the notes we attach to the corresponding
diagnostics: calling an entity that we couldn't see "previous" is
confusing.
2020-04-28 18:41:14 -07:00
Saleem Abdulrasool 216833b32b Revert "Temporarily revert "build: use `find_package(Python3)` if available""
This reverts commit 35edd704e0.

Revert the revert and extend the patch further to account for the use of
the `PYTHONINTERP_FOUND`.
2020-04-29 01:38:08 +00:00
David Blaikie 409df3987c ASTWriter::FileDeclIDs: Use unique_ptr to simplify memory management 2020-04-28 18:05:28 -07:00
David Blaikie d9485dfbc1 ASTUnit::FileDecls: Use unique_ptr to simplify memory management 2020-04-28 17:59:45 -07:00
David Blaikie c98a7e9bcc AllocatedCXCodeCompleteResults::DiagnosticWrappers: use unique_ptr to simplify memory management 2020-04-28 17:45:07 -07:00
Eric Christopher 35edd704e0 Temporarily revert "build: use `find_package(Python3)` if available"
as it seems to be causing multiple people problems with running tests
and building.

This reverts commit c4c3883b00.
2020-04-28 16:41:22 -07:00
Jessica Clarke 5fee6936b8 [AST] Use PrintingPolicy for format string diagnosis
Summary:
This is a small improvement for OpenCL diagnostics, but is also useful
for our CHERI fork, as our __capability qualifier is suppressed from
diagnostics when all pointers are capabilities, only being used when pointers
need to be explicitly opted-in to being capabilities.

Reviewers: rsmith, Anastasia, aaron.ballman

Reviewed By: Anastasia, aaron.ballman

Subscribers: aaron.ballman, arichardson, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78777
2020-04-28 23:43:48 +01:00
Casey Carter 68b30bc02b [NFC] Correct spelling of "ambiguous" 2020-04-28 14:51:37 -07:00
Reid Kleckner b8000c0ce8 [Windows] Autolink with basenames and add libdir to libpath
Prior to this change, for a few compiler-rt libraries such as ubsan and
the profile library, Clang would embed "-defaultlib:path/to/rt-arch.lib"
into the .drective section of every object compiled with
-finstr-profile-generate or -fsanitize=ubsan as appropriate.

These paths assume that the link step will run from the same working
directory as the compile step. There is also evidence that sometimes the
paths become absolute, such as when clang is run from a different drive
letter from the current working directory. This is fragile, and I'd like
to get away from having paths embedded in the object if possible. Long
ago it was suggested that we use this for ASan, and apparently I felt
the same way back then:
https://reviews.llvm.org/D4428#56536

This is also consistent with how all other autolinking usage works for
PS4, Mac, and Windows: they all use basenames, not paths.

To keep things working for people using the standard GCC driver
workflow, the driver now adds the resource directory to the linker
library search path when it calls the linker. This is enough to make
check-ubsan pass, and seems like a generally good thing.

Users that invoke the linker directly (most clang-cl users) will have to
add clang's resource library directory to their linker search path in
their build system. I'm not sure where I can document this. Ideally I'd
also do it in the MSBuild files, but I can't figure out where they go.
I'd like to start with this for now.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D65543
2020-04-28 11:36:21 -07:00
Christopher Tetreault ef3678cfee [SVE] Update EmitSVEPredicateCast to take a ScalableVectorType
Summary:
Removes usage of VectorType::getNumElements identified by test located
at CodeGen/aarch64-sve-intrinsics/acle_sve_abs.c. Since the type is an
SVE predicate vector, it makes sense to specialize the code for scalable
vectors only.

Reviewers: rengolin, efriedma

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, rkruppe, psnobl, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78958
2020-04-28 11:22:20 -07:00
Erik Pilkington 2bb686b4b6 [AST] Fix a crash on a dependent vector_size attribute
Looks like this was just a copy & paste mistake from
getDependentSizedExtVectorType. rdar://60092165

Differential revision: https://reviews.llvm.org/D79012
2020-04-28 12:54:49 -04:00
Ulrich Weigand 095ccf4455 [SystemZ] Avoid __INTPTR_TYPE__ conversions in vecintrin.h
Some intrinsics in vecintrin.h are currently implemented by
performing address arithmetic in __INTPTR_TYPE__ and converting
the result to some pointer type.  While this works correctly,
it leads to suboptimal code generation since many optimizers
cannot trace the provenance of the resulting pointers.

Fixed by using "char *" pointer arithmetic instead.
2020-04-28 18:49:49 +02:00
Ulrich Weigand c90e09b13c [SystemZ] Use reserved keywords in vecintrin.h
System headers should avoid using the "vector" and "bool" keywords
since those might be redefined by user code.  For example, using
<stdbool.h> before <vecintrin.h> will currently lead to compiler
errors.

Fixed by using the reserved "__vector" and "__bool" keywords
instead.  NFC otherwise.
2020-04-28 18:49:48 +02:00
Jonathan Coe 85ee97fd89 Revert "[clang-format] C# property formatting can be controlled by config options"
Committed in error without approval https://reviews.llvm.org/D79000

This reverts commit 015bca3e67.
2020-04-28 17:41:17 +01:00
Jonathan Coe 015bca3e67 [clang-format] C# property formatting can be controlled by config options
Summary:
Allow brace wrapping in C# property accessors to be controlled by configuration options.

Add new tests and revert old test results for MS style to their old state (as intended).

`FormatStyle.BraceWrapping.AfterFunction = true;` will change automatic property formatting from

```
Type MyType { get; set }
```

to

```
Type MyType
{ get; set }
```

Reviewers: krasimir, MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D79000
2020-04-28 17:35:33 +01:00
Jonathan Coe 7443f86eab [clang-format] insert space after C# keyword var in var (key, value)
Reviewers: krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D79008
2020-04-28 17:31:40 +01:00
Saleem Abdulrasool c4c3883b00 build: use `find_package(Python3)` if available
This is primarily motivated by the desire to move from Python2 to
Python3.  `PYTHON_EXECUTABLE` is ambiguous.  This explicitly identifies
the python interpreter in use.  Since the LLVM build seems to be able to
completed successfully with python3, use that across the build.  The old
path aliases `PYTHON_EXECUTABLE` to be treated as Python3.
2020-04-28 09:24:27 -07:00
Momchil Velikov 102b4105e3 [CMSE] Clear padding bits of struct/unions/fp16 passed by value
When passing a value of a struct/union type from secure to non-secure
state (that is returning from a CMSE entry function or passing an
argument to CMSE-non-secure call), there is a potential sensitive
information leak via the padding bits in the structure. It is not
possible in the general case to ensure those bits are cleared by using
Standard C/C++.

This patch makes the compiler emit code to clear such padding
bits. Since type information is lost in LLVM IR, the code generation
is done by Clang.

For each interesting record type, we build a bitmask, in which all the
bits, corresponding to user declared members, are set. Values of
record types are returned by coercing them to an integer. After the
coercion, the coerced value is masked (with bitwise AND) and then
returned by the function. In a similar manner, values of record types
are passed as arguments by coercing them to an array of integers, and
the coerced values themselves are masked.

For union types, we effectively clear only bits, which aren't part of
any member, since we don't know which is the currently active one.
The compiler will issue a warning, whenever a union is passed to
non-secure state.

Values of half-precision floating-point types are passed in the least
significant bits of a 32-bit register (GPR or FPR) with the most
significant bits unspecified. Since this is also a potential leak of
sensitive information, this patch also clears those unspecified bits.

Differential Revision: https://reviews.llvm.org/D76369
2020-04-28 17:05:58 +01:00
Francis Visoiu Mistrih e770153865 [AArch64] Add support for -ffixed-x30
Add support for reserving LR in:

* the driver through `-ffixed-x30`
* cc1 through `-target-feature +reserve-x30`
* the backend through `-mattr=+reserve-x30`
* a subtarget feature `reserve-x30`

the same way we're doing for the other registers.
2020-04-28 08:48:28 -07:00
Sander de Smalen 43d1d52ad2 [SveEmitter] Add builtins for logical and predicate operations.
This patch adds builtins for logical ops:
- svand, svbic, sveor, svorr, svcnot, svnot

and builtins for predicate operations:
- svand_b_z, svbic_b_z, sveor_b_z, svnand_b_z, svnor_b_z, svorn_b_z, svorr_b_z
- svbrka_b_z, svbrkb_b_z, svbrkpa_b_z, svbrkpb_b_z, svbrkn_b_z
- svpfirst_b
- svpnext
- svptest_any
- svptest_first
- svptest_last
2020-04-28 16:37:17 +01:00
Yaxun (Sam) Liu 55bcb96f31 recommit c77a4078e0 with fix
https://reviews.llvm.org/D77954 caused a regression about ambiguity of new operator
in file scope.

This patch recovered the previous behavior for comparison without a caller.

This is a workaround. For real fix we need D71227

https://reviews.llvm.org/D78970
2020-04-28 09:14:13 -04:00
Jonathan Coe 44ad58b991 [clang-format] Improved parser for C# properties
Summary:
Added some examples of properties from Microsoft documentation as test cases.

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties

Configuration support will be added in a follow up patch to address whether automatic properties are formatted as

```
Type MyType { get; set }
```

or

```
Type MyType
{ get; set }
```

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D78915
2020-04-28 14:11:09 +01:00
Sander de Smalen 476ba8127b [SveEmitter] Add builtins for zero/sign extension and bit/byte reversal.
This patch adds builtins for predicated unary builtins
svext[bhw] and svrev[bhw] and svrbit.
2020-04-28 14:06:51 +01:00
Sander de Smalen c57720125f [SveEmitter] Add builtins for bitcount operations
This patch adds builtins for svcls, svclz and svcnt.

For merging (_m), zeroing (_z) and don't-care (_x) predication.
2020-04-28 13:53:54 +01:00
Sander de Smalen 6f588c6ef3 [SveEmitter] Add builtins for permutations and selection
This patch adds builtins for:
- svlasta and svlastb
- svclasta and svclastb
- svunpkhi and svunpklo
- svuzp1 and svuzp2
- svzip1 and svzip2
- svrev
- svsel
- svcompact
- svsplice
- svtbl
2020-04-28 13:43:11 +01:00
Anastasia Stulova fe667e8522 [OpenCL] Fixed test for the cast operators.
The test had unused variable because it missed to cover
case with __constant address space. This change now
completes the testing fully.
2020-04-28 12:46:36 +01:00
Sander de Smalen e1932ffbd9 [SveEmitter] Add builtins for ternary ops (fmla, fmad, etc)
This patch adds builtins for:
- svmad, svmla, svmls, svmsb
  svnmad, svnmla, svnmls, svnmsb
  svmla_lane, svmls_lane

These builtins come in several flavours:
- Merge into first source vector (`_m`)
- False lanes are undef (`_x`)
- False lanes are zeroed (`_z`)

And can also have `_n` to indicate the last operand is a scalar.

For example:

  svint32_t svmla[_n_s32]_z(svbool_t pg, svint32_t op1, svint32_t op2, int32_t op3)

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D78960
2020-04-28 10:59:38 +01:00
Hans Wennborg f03b505ee7 Revert f8990feb12 "[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON"
This broke builds configured with

$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release '-DLLVM_ENABLE_PROJECTS=clang' '-DLLVM_TARGETS_TO_BUILD=X86' -DLLVM_ENABLE_PIC=OFF ../llvm

CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
    target_compile_definitions called with non-compilable target type

This reverts commit f8990feb12.
2020-04-28 10:10:33 +02:00
Gabor Marton 62e747f617 [analyzer] StdLibraryFunctionsChecker: Associate summaries to FunctionDecls
Summary:
Currently we map function summaries to names (i.e. strings). We can
associate more summaries with different signatures to one name, this way
we support overloading. During a call event we check whether the
signature of the summary matches the signature of the callee and we
apply the summary only in that case.

In this patch we change this mapping to associate a summary to a
FunctionDecl. We do lookup operations when the summary map is
initialized. We lookup the given name and we match the signature of the
given summary against the lookup results. If the summary matches the
FunctionDecl (got from the lookup result) then we add that to the
summary map. During a call event we compare FunctionDecl pointers.
Advantages of this new refactor:
- Cleaner mapping and structure for the checker.
- Possibly way more efficient handling of call events.
- A summary is added only if that is relevant for the given TU.
- We can get the concrete FunctionDecl by the time when we create the
  summary, this opens up possibilities of further sanity checks
  regarding the summary cases and argument constraints.
- Opens up to future work when we'd like to store summaries from IR to a
  FunctionDecl (or from the Attributor results of the given
  FunctionDecl).

Note, we cannot support old C functions without prototypes.

Reviewers: NoQ, Szelethus, balazske, jdoerfert, sstefan1, uenoku

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, uenoku, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77641
2020-04-28 10:00:50 +02:00
Craig Topper a58b62b4a2 [IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().
This method has been commented as deprecated for a while. Remove
it and replace all uses with the equivalent getCalledOperand().

I also made a few cleanups in here. For example, to removes use
of getElementType on a pointer when we could just use getFunctionType
from the call.

Differential Revision: https://reviews.llvm.org/D78882
2020-04-27 22:17:03 -07:00
Saleem Abdulrasool be884b7935 Revert "build: use `find_package(Python3)` if available"
This reverts commit cd84bfb814.  Although
this passed the CI in phabricator, some of the bots are missing python3
packages, revert it temporarily.
2020-04-27 20:03:32 -07:00
Saleem Abdulrasool cd84bfb814 build: use `find_package(Python3)` if available
This is primarily motivated by the desire to move from Python2 to
Python3.  `PYTHON_EXECUTABLE` is ambiguous.  This explicitly identifies
the python interpreter in use.  Since the LLVM build seems to be able to
completed successfully with python3, use that across the build.  The old
path aliases `PYTHON_EXECUTABLE` to be treated as Python3.
2020-04-28 01:33:10 +00:00
Christopher Tetreault da8918f27e [SVE][NFC] Use ScalableVectorType in CGBuiltin
Summary: * Upgrade some usages of VectorType to use ScalableVectorType

Reviewers: efriedma, david-arm, fpetrogalli, kmclaughlin

Reviewed By: efriedma

Subscribers: tschuett, rkruppe, psnobl, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78842
2020-04-27 16:29:45 -07:00
Zola Bridges c750847e0c [libcxx][docs][dfsan] Fix rst rendering related typos
* Fix the code block disappearance problem by adding a new line
* Fix the typo where I forgot a space

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D78953
2020-04-27 15:07:11 -07:00
Michael Liao 612720db87 [hip] Remove test using `hip_pinned_shadow` attribute. NFC. 2020-04-27 16:44:59 -04:00
Han Zhu f8990feb12 [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON
When LIBCLANG_BUILD_STATIC=ON and LLVM_ENABLE_PIC=ON, PIC version of
libclang.a and libclang.so are built as expected. However libclang.a is
not installed. Looking at the macro llvm_add_library(), when both SHARED
and STATIC are set, it renames the static library to ${name}_static and
then adds it to targets. But when add_clang_library() calls install, it
only checks if ${name} is in targets.

To work around this issue, loop through both ${name} and ${name}_static
and install both of them if they're in targets. This is still correct if
only shared or static library is built. In those cases, only ${name} is
added to targets and cmake install will generate the right install
script depending on the library's type.

Test Plan:
cmake with LIBCLANG_BUILD_STATIC=ON and then ninja install, from master
and this diff. Compare the result directory trees. Confirm that only
difference is the added libclang.a.

Differential Revision: https://reviews.llvm.org/D78534
2020-04-27 13:37:07 -07:00
Sander de Smalen e4872d7f08 [SveEmitter] Add builtins for svlen
The svlen builtins return the number of elements in a vector
and are implemented using `llvm.vscale`.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D78755
2020-04-27 21:27:32 +01:00
Aaron Puchert ce7eb72a3c Thread safety analysis: Reword warning after D72635
We allow arbitrary names for capabilities now, and the name didn't play
a role for this anyway.
2020-04-27 22:23:52 +02:00
mydeveloperday f594e3d2ab [clang-format] NFC clang-format the clang-format sources
Summary: In recent patches the clang-format code has become un-formatted, correct this before making additional changes

Reviewers: mitchell-stellar, sylvestre.ledru, Abpostelnicu, Wawha, jbcoe

Reviewed By: sylvestre.ledru, Abpostelnicu, jbcoe

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D78909
2020-04-27 20:41:37 +01:00
Luboš Luňák 5c8c9905c2 make sure to not warn about unused macros from -D
If a PCH is used for compilation, SourceManager::isInMainFile()
returns true even for the "<built-in>" predefines area. Using -D
only for the TU compilation may trigger -Wunused-macros for it.
It is admitedly a bit fishy to set a macro only for a TU and not
for the PCH, but this works fine if the PCH does not use the macro
(I couldn't find a statement on this for Clang, but GCC explicitly
allows this in the docs).

Differential Revision: https://reviews.llvm.org/D73846
2020-04-27 21:26:13 +02:00
Arthur Eubanks dab1326a5a Strip -showIncludes in getClangStripDependencyFileAdjuster()
Summary:
Follow-up to https://reviews.llvm.org/D78836.

Also consolidate some test cases.

Reviewers: thakis

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78939
2020-04-27 11:20:08 -07:00
Matt Arsenault 580a9f2c30 Fix test without built AMDGPU 2020-04-27 13:32:00 -04:00
Fangrui Song 0852babc30 Fix test/Misc/warning-flags.c after 5c03beefa7 2020-04-27 10:18:48 -07:00
Florian Hahn 7363ffe95f [Matrix] Add draft specification for matrix support in Clang.
This patch documents the planned matrix support in Clang, based on the
draft specification discussed on cfe-dev in the 'Matrix Support in
Clang' thread.

Latest draft spec sent to cfe-dev: http://lists.llvm.org/pipermail/cfe-dev/2020-February/064742.html
Discussion thread January: http://lists.llvm.org/pipermail/cfe-dev/2020-January/064206.html
Discussion thread March: http://lists.llvm.org/pipermail/cfe-dev/2020-March/064834.html

Reviewers: rsmith, anemet, Bigcheese, dexonsmith, rjmccall

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D76612
2020-04-27 18:00:23 +01:00
Matt Arsenault 5c03beefa7 clang: Allow backend unsupported warnings
Currently this asserts on anything other than errors. In one
workaround scenario, AMDGPU emits DiagnosticInfoUnsupported as a
warning for functions that can't be correctly codegened, but should
never be executed.
2020-04-27 12:14:51 -04:00
Momchil Velikov 334ac81054 Fix the check for regparm in FunctionType::ExtInfo
`getHasRegParm()` was working under the assumption that the RegParm
bits are the last field, which is no longer true, after adding the
`NoCfCheck` and `CmseNSCall` fields.

This causes a spurious "regparm 0" attribute to appear when a function
type is declared with either `__attribute__((nocf_check))` or
`__attribute__((cmse_nonsecure_call))`.

Differential Revision: https://reviews.llvm.org/D77270
2020-04-27 16:01:07 +01:00
Dmitri Gribenko 8c8aae852b Revert "recommit c77a4078e01033aa2206c31a579d217c8a07569b"
This reverts commit b46b1a916d. It broke
overload resolution for operator 'new' -- see reproducer in
https://reviews.llvm.org/D77954.
2020-04-27 16:41:35 +02:00
Dmitri Gribenko 96717125e8 Revert "[analyzer] On-demand parsing capability for CTU"
This reverts commit 811c0c9eb4. It broke
multiple buildbots.
2020-04-27 14:27:04 +02:00
Matthias Gehre 145dcef8bd [clang-tidy] modernize-use-using: Fix broken fixit with InjectedClassName
Summary:
Before this PR, `modernize-use-using` would transform the typedef in
```
template <int A>
struct InjectedClassName {
  typedef InjectedClassName b;
};
```
into `using b = InjectedClassName<A>;` and
```
template <int>
struct InjectedClassNameWithUnnamedArgument {
  typedef InjectedClassNameWithUnnamedArgument b;
};
```
into `using b = InjectedClassNameWithUnnamedArgument<>;`.
The first fixit is surprising because its different than the code
before, but the second fixit doesn't even compile.

This PR adds an option to the TypePrinter to print InjectedClassNameType without
template parameters (i.e. as written).

Reviewers: aaron.ballman, alexfh, hokein, njames93

Subscribers: xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77979
2020-04-27 14:23:23 +02:00
Raphael Isemann f181f1b7f7 [clang] Remove NFC overload in ASTImporterTest
This overload is just an artifact from the original version of the patch, but
doesn't have any functional purpose.
2020-04-27 14:10:43 +02:00
Raphael Isemann 9f1e81f1c0 [ASTImporter] Also import overwritten file buffers
Summary:
Overwritten file buffers are at the moment ignored when importing and
instead only the underlying file buffer is imported.

This patch fixes this by not going to the underlying file entry if the file has
an overwritten buffer.

Reviewers: martong, a.sidorin, shafik

Reviewed By: martong, shafik

Subscribers: rnkovacs

Differential Revision: https://reviews.llvm.org/D78086
2020-04-27 13:16:08 +02:00
Sander de Smalen 03f419f3eb [SveEmitter] IsInsertOp1SVALL and builtins for svqdec[bhwd] and svqinc[bhwd]
Some ACLE builtins leave out the argument to specify the predicate
pattern, which is expected to be expanded to an SV_ALL pattern.

This patch adds the flag IsInsertOp1SVALL to insert SV_ALL as the
second operand.

Reviewers: efriedma, SjoerdMeijer

Reviewed By: SjoerdMeijer

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78401
2020-04-27 11:45:10 +01:00
Balázs Kéri 3b9b3d56ef [Analyzer] Include typedef statements in CFG build.
Summary:
Array size expressions in typedef statements with a VLA
(variable-length array) are handled from now as in plain
(non-typedef) VLA declarations.
Type-aliases with VLA are handled too
(but main focus is on C code).

Reviewers: Szelethus, aaron.ballman, NoQ, xazax.hun

Reviewed By: aaron.ballman, xazax.hun

Subscribers: rnkovacs, NoQ, efriedma, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77809
2020-04-27 12:36:26 +02:00
Endre Fülöp 811c0c9eb4 [analyzer] On-demand parsing capability for CTU
Summary:
Add an option to enable on-demand parsing of needed ASTs during CTU analysis.
Two options are introduced. CTUOnDemandParsing enables the feature, and
CTUOnDemandParsingDatabase specifies the path to a compilation database, which
has all the necessary information to generate the ASTs.

Reviewers: martong, balazske, Szelethus, xazax.hun

Subscribers: ormris, mgorny, whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, steakhal, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75665
2020-04-27 11:20:35 +02:00
Haojian Wu 1a0d466081 [AST] Preserve the invalid initializer for auto VarDecl.
Fixes https://github.com/clangd/clangd/issues/330

Reviewers: sammccall

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78365
2020-04-27 10:25:36 +02:00
Dmitri Gribenko 0d69e412c4 Explicitly tell Clang to output to stdout in a test that runs FileCheck 2020-04-27 10:13:28 +02:00
Saiyedul Islam 06bdffb2bb [AMDGPU] Expose llvm fence instruction as clang intrinsic
Expose llvm fence instruction as clang builtin for AMDGPU target

__builtin_amdgcn_fence(unsigned int memoryOrdering, const char *syncScope)

The first argument of this builtin is one of the memory-ordering specifiers
__ATOMIC_ACQUIRE, __ATOMIC_RELEASE, __ATOMIC_ACQ_REL, or __ATOMIC_SEQ_CST
following C++11 memory model semantics. This is mapped to corresponding
LLVM atomic memory ordering for the fence instruction using LLVM atomic C
ABI. The second argument is an AMDGPU-specific synchronization scope
defined as string.

Reviewed By: sameerds

Differential Revision: https://reviews.llvm.org/D75917
2020-04-27 09:39:03 +05:30
Arthur Eubanks 8000d506af [clangd] Strip /showIncludes in clangd compile commands
In command lines with /showIncludes, clangd would output includes to stdout, breaking clients.

Summary: Fixes https://github.com/clangd/clangd/issues/322.

Reviewers: sammccall, kadircet

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

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78836
2020-04-26 18:57:39 -07:00
Sander de Smalen 3817ca7dbf [SveEmitter] Add IsAppendSVALL and builtins for svptrue and svcnt[bhwd]
Some ACLE builtins leave out the argument to specify the predicate
pattern, which is expected to be expanded to an SV_ALL pattern.

This patch adds the flag IsAppendSVALL to append SV_ALL as the final
operand.

Reviewers: SjoerdMeijer, efriedma, rovka, rengolin

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77597
2020-04-26 12:44:26 +01:00
David Zarzycki 665471907a [CMake] Fix logic error: NOT LIBCLANG_BUILD_STATIC does not imply PIC 2020-04-26 07:16:42 -04:00
Chris Lattner 919dcc7f68 [SourceMgr] Tidy up the SourceMgr header file to include less stuff.
Summary:
Specifically make some simple refactorings to get PointerUnion.h and
Twine.h out of the public includes.  While here, trim out a lot of
transitive includes as well.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78870
2020-04-25 21:18:59 -07:00
Ayke van Laethem ceba881aea
[AVR][NFC] Move preprocessor tests to Preprocessor directory
These tests were placed in the CodeGen directory while they really
should have been placed in the Preprocessor directory.

Differential Revision: https://reviews.llvm.org/D78163
2020-04-26 01:29:25 +02:00
Fangrui Song 2cb48d620f [TableGen] Drop deprecated leading # operation (NOP) and replace ## with # 2020-04-25 16:26:45 -07:00
Cristian Adam 6fb80d9383 libclang: Add static build support for Windows
Differential Revision: https://reviews.llvm.org/D75068
2020-04-25 20:19:17 +03:00
Volodymyr Sapsai 65f58878e7 [ObjC generics] Fix not inheriting type bounds in categories/extensions.
When a category/extension doesn't repeat a type bound, corresponding
type parameter is substituted with `id` when used as a type argument. As
a result, in the added test case it was causing errors like

> type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T'

We are already checking that type parameters should be consistent
everywhere (see `checkTypeParamListConsistency`) and update
`ObjCTypeParamDecl` to have correct underlying type. And when we use the
type parameter as a method return type or a method parameter type, it is
substituted to the bounded type. But when we use the type parameter as a
type argument, we check `ObjCTypeParamType` that wasn't updated and
remains `id`.

Fix by updating not only `ObjCTypeParamDecl` UnderlyingType but also
TypeForDecl as we use the underlying type to create a canonical type for
`ObjCTypeParamType` (see `ASTContext::getObjCTypeParamType`).

This is a different approach to fixing the issue. The previous one was
02c2ab3d88 which was reverted in
4c539e8da1. The problem with the previous
approach was that `ObjCTypeParamType::desugar` was returning underlying
type for `ObjCTypeParamDecl` without applying any protocols stored in
`ObjCTypeParamType`. It caused inconsistencies in comparing types before
and after desugaring.

Re-applying after fixing intermittent test failures.

rdar://problem/54329242

Reviewed By: erik.pilkington

Differential Revision: https://reviews.llvm.org/D72872
2020-04-24 16:32:28 -07:00
Yaxun (Sam) Liu b46b1a916d recommit c77a4078e0 2020-04-24 16:53:18 -04:00
Petr Hosek 063128f979 [Fuchsia] Build compiler-rt builtins for 32-bit x86
While we don't support 32-bit architectures in Fuchsia, these are needed
in the early boot phase on x86, so we build just these to satisfy that
use case.

Differential Revision: https://reviews.llvm.org/D78687
2020-04-24 12:18:30 -07:00
Yaxun (Sam) Liu 7eae00477f Revert "[CUDA][HIP] Fix host/device based overload resolution"
This reverts commit c77a4078e0.
2020-04-24 14:57:10 -04:00
Yaxun (Sam) Liu c77a4078e0 [CUDA][HIP] Fix host/device based overload resolution
Currently clang fails to compile the following CUDA program in device compilation:

__host__ int foo(int x) {
     return 1;
}

template<class T>
__device__ __host__ int foo(T x) {
    return 2;
}

__device__ __host__ int bar() {
    return foo(1);
}

__global__ void test(int *a) {
    *a = bar();
}

This is due to foo is resolved to the __host__ foo instead of __device__ __host__ foo.
This seems to be a bug since __device__ __host__ foo is a viable callee for foo whereas
clang is unable to choose it.

This patch fixes that.

Differential Revision: https://reviews.llvm.org/D77954
2020-04-24 14:55:18 -04:00
Craig Topper 0ed5b0d517 [X86] Don't use types when getting the intrinsic declaration for x86_avx512_mask_vcvtph2ps_512.
This intrinsic isn't overloaded so we should query with types.
Doing so causes the backend to miss the intrinsic and not codegen it.
This eventually leads to a linker error.
2020-04-24 11:01:22 -07:00
Samuel Thibault 6395980370 [Driver] Move GCC multilib/multiarch paths support from Linux.cpp to Gnu.cpp
The current code for GNU/Linux is actually completely generic, and can be moved to ToolChains/Gnu.cpp,
so that it can benefit GNU/Hurd and GNU/kFreeBSD.

Reviewed By: MaskRay, phosek

Differential Revision: https://reviews.llvm.org/D73845
2020-04-24 09:33:19 -07:00
Luke Geeson 740a1dd050 [ARM] Armv8.6-a Matrix Mul cmd line support
This patch upstreams support for the Armv8.6-a Matrix Multiplication
Extension. A summary of the features can be found here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

This patch includes:

- Command line options to enable these features with +i8mm, +f32mm, or f64mm

Note: +f32mm and +f64mm are optional and so are not enabled by default

This is part of a patch series, starting with BFloat16 support and
the other components in the armv8.6a extension (in previous patches
linked in phabricator)

Based on work by:
- Luke Geeson
- Oliver Stannard
- Luke Cheeseman

Reviewers: t.p.northover, DavidSpickett

Reviewed By: DavidSpickett

Subscribers: DavidSpickett, ostannard, kristof.beyls, danielkiss,
cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77875
2020-04-24 15:54:06 +01:00
Luke Geeson 7da1905125 [AArch32] Armv8.6-a Matrix Mult Assembly + Intrinsics
This patch upstreams support for the Armv8.6-a Matrix Multiplication
Extension. A summary of the features can be found here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

This patch includes:

- Assembly support for AArch32
- Intrinsics Support for AArch32 Neon Intrinsics for Matrix
  Multiplication

Note: these extensions are optional in the 8.6a architecture and so have
to be enabled by default

No additional IR types or C Types are needed for this extension.

This is part of a patch series, starting with BFloat16 support and
the other components in the armv8.6a extension (in previous patches
linked in phabricator)

Based on work by:
- Luke Geeson
- Oliver Stannard
- Luke Cheeseman

Reviewers: t.p.northover, miyuki

Reviewed By: miyuki

Subscribers: miyuki, ostannard, kristof.beyls, hiraditya, danielkiss,
cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77872
2020-04-24 15:54:06 +01:00
Luke Geeson 832cd74913 [AArch64] Armv8.6-a Matrix Mult Assembly + Intrinsics
This patch upstreams support for the Armv8.6-a Matrix Multiplication
Extension. A summary of the features can be found here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

This patch includes:

- Assembly support for AArch64 only (no SVE or Neon)
- Intrinsics Support for AArch64 Armv8.6a Matrix Multiplication Instructions (No bfloat16 matrix multiplication)

No IR types or C Types are needed for this extension.

This is part of a patch series, starting with BFloat16 support and
the other components in the armv8.6a extension (in previous patches
linked in phabricator)

Based on work by:
- Luke Geeson
- Oliver Stannard
- Luke Cheeseman

Reviewers: ostannard, t.p.northover, rengolin, kmclaughlin

Reviewed By: kmclaughlin

Subscribers: kmclaughlin, kristof.beyls, hiraditya, danielkiss,
cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77871
2020-04-24 15:54:06 +01:00
Alexey Bataev e9bfa1dd38 [OPENMP]Use new interface for task reduction.
Summary:
Patch forces codegen to use the new runtime functions for task reductions where
the issue with passing the address of the original variables to the UDR
initializers is fixed. Also, this patch is required for upcoming
support of task modifier inreduction clause.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78733
2020-04-24 09:41:48 -04:00
Sander de Smalen 0ddb2034c1 [SveEmitter] Add builtins for compares and ReverseCompare flag.
The IsReverseCompare flag tells CGBuiltin to swap the operands,
so that a LT/LE intrinsics can be expressed in terms of GE/GT
intrinsics.

This patch also adds builtins for the wide-variants of the compares.

Reviewers: SjoerdMeijer, efriedma, ctetreau

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78747
2020-04-24 14:33:47 +01:00
Yaxun (Sam) Liu 2da89df4e8 Fix minor bug in CommonArgs.cpp
Change-Id: Ibe87b1633cc7516479bb08bf51b6860a1585a94f
2020-04-24 08:46:33 -04:00
Sander de Smalen 823e2a670a [SveEmitter] Add builtins for contiguous prefetches
This patch also adds the enum `sv_prfop` for the prefetch operation specifier
and checks to ensure the passed enum values are valid.

Reviewers: SjoerdMeijer, efriedma, ctetreau

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78674
2020-04-24 11:35:59 +01:00
Sander de Smalen db7997472b [SveEmitter] Add builtins for svld1rq
Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78748
2020-04-24 11:10:28 +01:00
Sander de Smalen c84e1305c4 [SveEmitter] Add builtins for scatter stores
D77735 only added scatters for the non-temporal variants.

Reviewers: SjoerdMeijer, efriedma, andwar

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78751
2020-04-24 10:57:43 +01:00
serge-sans-paille 8f766e382b Update compiler extension integration into the build system
The approach here is to create a new (empty) component, `Extensions', where all
statically compiled extensions dynamically register their dependencies. That way
we're more natively compatible with LLVMBuild and llvm-config.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=44870

Differential Revision: https://reviews.llvm.org/D78192
2020-04-24 09:40:14 +02:00
Fangrui Song 2c3ee8812c [Sema][test] Fix implicit-int-float-conversion.c on Windows 2020-04-23 18:52:04 -07:00
Fangrui Song 14aaf4457c [Sema] Split off warn_impcast_integer_float_precision_constant into -Wimplicit-const-int-float-conversion
Currently, both `warn_impcast_integer_float_precision_constant` and
`warn_impcast_integer_float_precision` are covered by
-Wimplicit-int-float-conversion, but only the ..._constant warning is on
by default.

`warn_impcast_integer_float_precision_constant` likely flags real problems
while `warn_impcast_integer_float_precision` may flag legitimate use
cases (for example, `int` used with limited range supported by `float`).

If -Wno-implicit-int-float-conversion is used, currently there is no way
to restore the ..._constant warning. This patch adds
-Wimplicit-const-int-float-conversion to address the issue. (Similar to
the reasoning in https://reviews.llvm.org/D64666#1598194)

Adapted from a patch by Brooks Moses.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D78661
2020-04-23 18:26:06 -07:00
Reid Kleckner bd6942eb21 Re-land "[MS] Fix assert handling enum forward decls in hasVisibleDefinition"
This reverts commit 9b2ab41037 and
reinstates e62dc1f625 with changes.

This fix is speculative, since I don't have access to a crashing test
case for the old code, and fixing the crash bug on Windows when C++20 is
enabled seems more important than running it down.
2020-04-23 16:22:01 -07:00
shafik def7c7f602 [ASTImporter] Fix handling of not defined FromRecord in ImportContext(...)
In ImportContext(…) we may call into CompleteDecl(…) which if FromRecrord is not
defined will start the definition of a ToRecord but from what I can tell at least
one of the paths though here don't ensure we complete the definition.
For a RecordDecl this can be problematic since this means we won’t import base
classes and we won’t have any of the methods or types we inherit from these bases.

Differential Revision: https://reviews.llvm.org/D78000
2020-04-23 15:18:48 -07:00
Jian Cai fcbc613ad8 Make "#pragma clang attribute" support uninitialized attribute.
Summary:
When using -ftrivial-auto-var-init=* options to initiate automatic
variables in a file, to disable initialization on some variables,
currently we have to manually annotate the variables with uninitialized
attribute, such as

int dont_initialize_me __attribute((uninitialized));

Making pragma clang attribute to support this attribute would make
annotating variables much easier, and could be particular useful for
bisection efforts, e.g.

void use(void*);

void buggy() {
    int arr[256];
    int boom;
    float bam;
    struct { int oops; } oops;
    union { int oof; float aaaaa; } oof;

    use(&arr);
    use(&boom);
    use(&bam);
    use(&oops);
    use(&oof);
}

Reviewers: jfb, rjmccall, aaron.ballman

Reviewed By: jfb, aaron.ballman

Subscribers: aaron.ballman, george.burgess.iv, dexonsmith, MaskRay, phosek, hubert.reinterpretcast, gbiv, manojgupta, llozano, srhines, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78693
2020-04-23 14:25:13 -07:00
Puyan Lotfi 9721fbf85b [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.
This is a code clean up of the PropertyAttributeKind and
ObjCPropertyAttributeKind enums in ObjCPropertyDecl and ObjCDeclSpec that are
exactly identical. This non-functional change consolidates these enums
into one. The changes are to many files across clang (and comments in LLVM) so
that everything refers to the new consolidated enum in DeclObjCCommon.h.

2nd Landing Attempt...

Differential Revision: https://reviews.llvm.org/D77233
2020-04-23 17:21:25 -04:00
Vedant Kumar cfb4f8c5fb [DirectoryWatcher] Do not use FSEvents on non-macOS platforms
The FSEvents APIs are available on iOS6+: however, the DirectoryWatcher
code isn't wired up to really use FSEvents on embedded platforms.

I've duplicated code from DirectoryWatcher-not-implemented.cpp here and
used TargetConditionals instead of adding cmakery to check try_compile;
I couldn't get that to work properly.
2020-04-23 10:22:28 -07:00
Valeriy Savchenko a88025672f [analyzer] Consider array subscripts to be interesting lvalues.
Static analyzer has a mechanism of clearing redundant nodes when
analysis hits a certain threshold with a number of nodes in exploded
graph (default is 1000). It is similar to GC and aims removing nodes
not useful for analysis. Unfortunately nodes corresponding to array
subscript expressions (that actively participate in data propagation)
get removed during the cleanup. This might prevent the analyzer from
generating useful notes about where it thinks the data came from.

This fix is pretty much consistent with the way analysis works
already. Lvalue "interestingness" stands for the analyzer's
possibility of tracking values through them.

Differential Revision: https://reviews.llvm.org/D78638
2020-04-23 19:52:45 +03:00
Xing GUO b0a1c0b72c [doc] Fix broken link. NFC. 2020-04-23 22:47:39 +08:00
Sander de Smalen 7003a1da37 [SveEmitter] Use llvm.aarch64.sve.ld1/st1 for contiguous load/store builtins
This patch changes the codegen of the builtins for contiguous loads
to map onto the SVE specific IR intrinsics llvm.aarch64.sve.ld1/st1.

Reviewers: SjoerdMeijer, efriedma, kmclaughlin, rengolin

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78673
2020-04-23 15:15:41 +01:00
Kumar Harsh 3a5380618e Add extension links for VSCode
The clang-format docs were missing mention or links for the VSCode extension, which have been added.
2020-04-23 14:56:36 +02:00
Jonathan Coe 2f9fc8d971 [clang-format] Handle C# property accessors when parsing lines
Summary:
Improve C# `{ get; set; } = default;` formatting by handling it in the UnwrappedLineParser rather than trying to merge lines later.

Remove old logic to merge lines.

Update tests as formatting output has changed (as intended).

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D78642
2020-04-23 13:25:10 +01:00
Sander de Smalen a5e0389b2a [AArch64] Define ACLE FP conversion intrinsics with more specific predicate.
This patch changes the FP conversion intrinsics to take a predicate
that matches the number of lanes for the vector with the widest element
type as opposed to using <vscale x 16 x i1>.

For example:
```<vscale x 4 x float> @llvm.aarch64.sve.fcvt.f32f16(<vscale x 4 x float>, <vscale x 4 x i1>, <vscale x 8 x half>)```
now uses <vscale x 4 x i1> instead of <vscale x 16 x i1>

And similar for:
```<vscale x 4 x float> @llvm.aarch64.sve.fcvt.f32f64(<vscale x 4 x float>, <vscale x 2 x i1>, <vscale x 2 x double>)```
where the predicate now matches the wider type, so <vscale x 2 x i1>.

Reviewers: efriedma, SjoerdMeijer, paulwalker-arm, rengolin

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78402
2020-04-23 10:53:23 +01:00
Sander de Smalen 002164461b [SveEmitter] Add builtins for FP conversions
This adds the flag IsOverloadCvt which tells CGBulitin to use
the result type and the type of the last operand as the
overloaded types for the LLVM IR intrinsic.

This also adds the flag IsFPConvert, which is needed to avoid
converting the predicate of the operation from svbool_t to
a predicate with fewer lanes, as the LLVM IR intrinsics use
the <vscale x 16 x i1> as the predicate.

Reviewers: SjoerdMeijer, efriedma

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78239
2020-04-23 10:49:06 +01:00
Haojian Wu 47ef09e484 Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e, 5daa25fd7a

The clang-format test (FormatTest.ConfigurableUseOfTab) is failing in the buildbot:

http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/31811/steps/ninja%20check%201/logs/stdio
2020-04-23 09:25:01 +02:00
Puyan Lotfi bbf386f02b Revert "[NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec."
This reverts commit 2aa044ed08.

Reverting due to bot failure in lldb.
2020-04-23 00:05:08 -04:00
Puyan Lotfi 2aa044ed08 [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.
This is a code clean up of the PropertyAttributeKind and
ObjCPropertyAttributeKind enums in ObjCPropertyDecl and ObjCDeclSpec that are
exactly identical. This non-functional change consolidates these enums
into one. The changes are to many files across clang (and comments in LLVM) so
that everything refers to the new consolidated enum in DeclObjCCommon.h.

Differential Revision: https://reviews.llvm.org/D77233
2020-04-22 23:27:06 -04:00
Aaron Puchert 391c15fccd [NFC] Correct typo in comment after D76038 2020-04-23 02:26:02 +02:00
Sergej Jaskiewicz 2899103108 [TimeProfiler] Emit clock synchronization point
Time profiler emits relative timestamps for events (the number of
microseconds passed since the start of the current process).

This patch allows combining events from different processes while
preserving their relative timing by emitting a new attribute
"beginningOfTime". This attribute contains the system time that
corresponds to the zero timestamp of the time profiler.

This has at least two use cases:

- Build systems can use this to merge time traces from multiple compiler
  invocations and generate statistics for the whole build. Tools like
  ClangBuildAnalyzer could also leverage this feature.

- Compilers that use LLVM as their backend by invoking llc/opt in
  a child process. If such a compiler supports generating time traces
  of its own events, it could merge those events with LLVM-specific
  events received from llc/opt, and produce a more complete time trace.

A proof-of-concept script that merges multiple logs that
contain a synchronization point into one log:
https://github.com/broadwaylamb/merge_trace_events

Differential Revision: https://reviews.llvm.org/D78030
2020-04-23 01:09:31 +03:00
Sergej Jaskiewicz a5bf02815d [TimeProfiler] Emit real process ID and thread names
Differential Revision: https://reviews.llvm.org/D78027
2020-04-23 00:12:51 +03:00
Sander de Smalen 2d1baf606a [SveEmitter] Add builtins for svwhilerw/svwhilewr
This also adds the IsOverloadWhileRW flag which tells CGBuiltin to use
the result predicate type and the first pointer type as the
overloaded types for the LLVM IR intrinsic.

Reviewers: SjoerdMeijer, efriedma

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78238
2020-04-22 21:49:18 +01:00
Sander de Smalen 1559485e60 [SveEmitter] Add builtins for svwhile
This also adds the IsOverloadWhile flag which tells CGBuiltin to use
both the default type (predicate) and the type of the second operand
(scalar) as the overloaded types for the LLMV IR intrinsic.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77595
2020-04-22 21:47:47 +01:00
Aaron Puchert f43859a099 PR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers
Summary:
We extend the behavior for local functions and methods of local classes
to lambdas in variable initializers. The initializer is not a separate
scope, but we treat it as such.

We also remove the (faulty) instantiation of default arguments in
TreeTransform::TransformLambdaExpr, because it doesn't do proper
initialization, and if it did, we would do it twice (and thus also emit
eventual errors twice).

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D76038
2020-04-22 22:37:21 +02:00
Kadir Cetinkaya 411a254af3
[clang] Make sure argument expansion locations are correct in presence of predefined buffer
Summary:
Macro argument expansion logic relies on skipping file IDs that created
as a result of an include. Unfortunately it fails to do that for
predefined buffer since it doesn't have a valid insertion location.

As a result of that any file ID created for an include inside the
predefined buffers breaks the traversal logic in
SourceManager::computeMacroArgsCache.

To fix this issue we first record number of created FIDs for predefined
buffer, and then skip them explicitly in source manager.

Another solution would be to just give predefined buffers a valid source
location, but it is unclear where that should be..

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78649
2020-04-22 21:01:52 +02:00
Aaron Ballman 1b3f1f4436 Rename warning identifiers from cxx2a to cxx20; NFC. 2020-04-22 14:31:13 -04:00
Mikhail Maltsev 089fbe6919 [Docs] Fixed formatting in release notes, NFC 2020-04-22 18:25:22 +01:00
David Green eecba95067 [ARM] Replace arm vendor with none. NFC 2020-04-22 18:19:35 +01:00
Sander de Smalen 662cbaf647 [SveEmitter] Add IsOverloadNone flag and builtins for svpfalse and svcnt[bhwd]_pat
Add the IsOverloadNone flag to tell CGBuiltin that it does not have
an overloaded type. This is used for e.g. svpfalse which does
not take any arguments and always returns a svbool_t.

This patch also adds builtins for svcntb_pat, svcnth_pat, svcntw_pat
and svcntd_pat, as those don't require custom codegen.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: efriedma

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77596
2020-04-22 16:42:08 +01:00