]> granicus.if.org Git - clang/log
clang
5 years ago[libclang] Forward isInline for NamespaceDecl to libclang
Nikolai Kosjar [Fri, 10 May 2019 13:58:34 +0000 (13:58 +0000)]
[libclang] Forward isInline for NamespaceDecl to libclang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360428 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd name comments for bools passed to getObjCEncodingForTypeImpl()
Nico Weber [Fri, 10 May 2019 13:56:56 +0000 (13:56 +0000)]
Add name comments for bools passed to getObjCEncodingForTypeImpl()

No behavior change. Medium term, probably want to use a bitmask instead
of 8 distinct bool parameters, but let's make the call sites easier to
read first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360427 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReplace lit feature keyword 'non-ms-sdk' with 'ms-sdk'; eliminate
Paul Robinson [Fri, 10 May 2019 13:40:17 +0000 (13:40 +0000)]
Replace lit feature keyword 'non-ms-sdk' with 'ms-sdk'; eliminate
'non-ps4-sdk' and use just 'ps4'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360425 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Fri, 10 May 2019 10:36:37 +0000 (10:36 +0000)]
Fix Wdocumentation warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360419 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Preamble] Stop circular inclusion of main file when building preamble
Nikolai Kosjar [Fri, 10 May 2019 10:25:35 +0000 (10:25 +0000)]
[Preamble] Stop circular inclusion of main file when building preamble

If a header file was processed for the second time, we could end up with a
wrong conditional stack and skipped ranges:

In the particular example, if the header guard is evaluated the second time and
it is decided to skip the conditional block, the corresponding "#endif" is
never seen since the preamble does not include it and we end up in the
Tok.is(tok::eof) case with a wrong conditional stack.

Detect the circular inclusion, emit a diagnostic and stop processing the
inclusion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360418 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "Revert "[clang-format] Keep protobuf "package" statement on one line""
Krasimir Georgiev [Fri, 10 May 2019 09:15:11 +0000 (09:15 +0000)]
Revert "Revert "[clang-format] Keep protobuf "package" statement on one line""

Summary:
Top-level "package" and "import" statements should generally be kept on
one line, for all languages.

----

This reverts commit rL356912.
The regression from rL356835 was fixed via rC358275.

Reviewers: krasimir, sammccall, MyDeveloperDay, xinz, dchai, klimek

Reviewed By: krasimir, xinz, dchai

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360411 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDelete write-only HasQualifiers after rC360370
Fangrui Song [Fri, 10 May 2019 06:59:50 +0000 (06:59 +0000)]
Delete write-only HasQualifiers after rC360370

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360408 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdded an assert in `isConstantInitializer`: initializer lists must be in semantic...
Dmitri Gribenko [Fri, 10 May 2019 06:39:20 +0000 (06:39 +0000)]
Added an assert in `isConstantInitializer`: initializer lists must be in semantic form

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360406 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAssume `__cxa_allocate_exception` returns an under-aligned memory on
Akira Hatanaka [Fri, 10 May 2019 02:16:37 +0000 (02:16 +0000)]
Assume `__cxa_allocate_exception` returns an under-aligned memory on
Darwin if the version of libc++abi isn't new enough to include the fix
in r319123

This patch resurrects r264998, which was committed to work around a bug
in libc++abi that was causing _cxa_allocate_exception to return a memory
that wasn't double-word aligned.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160328/154332.html

In addition, this patch makes clang issue a warning if the type of the
thrown object requires an alignment that is larger than the minimum
guaranteed by the target C++ runtime.

rdar://problem/49864414

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360404 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoChange -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED)
Fangrui Song [Fri, 10 May 2019 02:08:21 +0000 (02:08 +0000)]
Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED)

Since July 15, 2015 (binutils-gdb commit
19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas
--compress-debug-sections=zlib (gcc -gz) means zlib-gabi:
SHF_COMPRESSED. Before that it meant zlib-gnu (.zdebug).

clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It
is 2019 now and it is not unreasonable to assume users of the new
feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661).

Change clang's default accordingly to improve standard conformance.
zlib-gnu becomes out of fashion and gets poorer toolchain support.
Its mangled names confuse tools and are more likely to cause problems.

Reviewed By: compnerd

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360403 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemember to decay arrays to pointers before checking whether the
Richard Smith [Thu, 9 May 2019 22:22:48 +0000 (22:22 +0000)]
Remember to decay arrays to pointers before checking whether the
left-hand side of an -> operator is a pointer to class type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360387 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoNFC, make XFAIL work on macOS correctly for test/Driver/XRay/xray-instrument-os.c
Alex Lorenz [Thu, 9 May 2019 20:35:41 +0000 (20:35 +0000)]
NFC, make XFAIL work on macOS correctly for test/Driver/XRay/xray-instrument-os.c

The test 'test/Driver/XRay/xray-instrument-os.c' is supposed to XFAIL on -darwin triples.
However, LLVM can be configured to be built with a -macos triple instead, which is equivalent
to -darwin. This commit updates the XFAIL condition to also XFAIL with a -macos host triple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360374 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDR1872: don't allow any calls to virtual functions in constant
Richard Smith [Thu, 9 May 2019 19:45:49 +0000 (19:45 +0000)]
DR1872: don't allow any calls to virtual functions in constant
evaluation.

Not even in cases where we would not actually perform virtual dispatch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360370 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSimplify tracking of end of consumed decl-specifier sequence.
Richard Smith [Thu, 9 May 2019 19:45:46 +0000 (19:45 +0000)]
Simplify tracking of end of consumed decl-specifier sequence.

Patch by Tyker!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360369 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with default(none).
Alexey Bataev [Thu, 9 May 2019 18:44:53 +0000 (18:44 +0000)]
[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with default(none).

If the combined directive has default(none) clause and has clauses for
inner directive that reference some variables, for which data-sharing
attributes are not specified, the error messages should be emitted for
such variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360365 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSpecify target triple to fix the tests I committed in r360359 that are
Akira Hatanaka [Thu, 9 May 2019 18:32:16 +0000 (18:32 +0000)]
Specify target triple to fix the tests I committed in r360359 that are
still failing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360363 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix PR41768: check DSA for globals with default(none) clauses.
Alexey Bataev [Thu, 9 May 2019 18:14:57 +0000 (18:14 +0000)]
[OPENMP]Fix PR41768: check DSA for globals with default(none) clauses.

If the default(none) was specified for the construct, we might miss
diagnostic for the globals without explicitly specified data-sharing
attributes. Patch fixes this problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360362 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSpecify ObjC runtime to fix the tests I committed in r360359 that are
Akira Hatanaka [Thu, 9 May 2019 18:05:17 +0000 (18:05 +0000)]
Specify ObjC runtime to fix the tests I committed in r360359 that are
failing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360361 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make
Akira Hatanaka [Thu, 9 May 2019 17:43:52 +0000 (17:43 +0000)]
[CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make
private symbols in the __DATA segment internal.

This prevents the linker from removing the symbol names. Keeping the
symbols visible enables tools to collect various information about the
symbols, for example, tools that discover whether or not a symbol gets
dirtied.

rdar://problem/48887111

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360359 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Make global ctor init function a kernel
Anastasia Stulova [Thu, 9 May 2019 13:55:44 +0000 (13:55 +0000)]
[OpenCL] Make global ctor init function a kernel

We need to be able to enqueue internal function that initializes
global constructors on the host side. Therefore it has to be
converted to a kernel.

This change factors out common logic for adding kernel metadata
and moves it from CodeGenFunction to CodeGenModule in order to
make it accessible for the extra use case.

Differential revision: https://reviews.llvm.org/D61488

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360342 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix gcc compilation warning in an assert [NFC]
Mikael Holmen [Thu, 9 May 2019 12:11:57 +0000 (12:11 +0000)]
Fix gcc compilation warning in an assert [NFC]

Without this, gcc (7.4) complains with

../tools/clang/lib/Parse/ParseDecl.cpp:3937:63: error: suggest parentheses around '&&' within '||' [-Werror=parentheses]
     assert(!isAlreadyConsumed || RangeEnd != SourceLocation() &&
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                      "both or neither of isAlreadyConsumed and "
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      "RangeEnd needs to be set");
                                      ~

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360333 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Switched CXX mode to be derived from C++17
Anastasia Stulova [Thu, 9 May 2019 11:55:24 +0000 (11:55 +0000)]
[OpenCL] Switched CXX mode to be derived from C++17

Differential revision: https://reviews.llvm.org/D61506

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360330 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[FIX] Change test to read file instead
Diogo N. Sampaio [Thu, 9 May 2019 11:23:00 +0000 (11:23 +0000)]
[FIX] Change test to read file instead

This should fix the test file failing in
windows by reading the file it self instead
of stdin, from 543913c3b41f

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360329 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses."
Roman Lebedev [Thu, 9 May 2019 10:48:13 +0000 (10:48 +0000)]
Revert "[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses."

This has introduced (exposed?) a crash in clang sema,
that does not happen without this patch.
I'll followup in the original bugreport and commit with reproducer.

This reverts commit r360061.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360327 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with default(none)."
Roman Lebedev [Thu, 9 May 2019 10:47:45 +0000 (10:47 +0000)]
Revert "[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with default(none)."

This implementation isn't sound as per the standard.
It erroneously diagnoses e.g. the following case:
```
$ cat test.cpp
void f(int n) {
 #pragma omp parallel default(none) if(n)
    ;
}
```
```
$ ./bin/clang -fopenmp test.cpp
test.cpp:2:40: error: variable 'n' must have explicitly specified data sharing attributes
 #pragma omp parallel default(none) if(n)
                                       ^
test.cpp:2:31: note: explicit data sharing attribute requested here
 #pragma omp parallel default(none) if(n)
                              ^
1 error generated.
```

As per OpenMP Application Programming Interface Version 5.0 November 2018:
* 2.19.4.1default Clause
  The default clause explicitly determines the data-sharing attributes of
  variables that are referenced *in a parallel, teams, or task generating
  construct and would otherwise be implicitly determined
  (see Section 2.19.1.1 on page 270).
* 2.6.1 Determining the Number of Threads for a parallel Region
  Using a variable in an if or num_threads clause expression of a parallel
  construct causes an implicit reference to the variable in all enclosing
  constructs. The if clause expression and the num_threads clause expression
  are evaluated in the context outside of the parallel construct,

This reverts commit r360073.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360326 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SPIR] Simplified target checking.
Anastasia Stulova [Thu, 9 May 2019 10:25:45 +0000 (10:25 +0000)]
[SPIR] Simplified target checking.

Switched to Triple::isSPIR() helper to simplify code.

Patch by kpet (Kevin Petit)!

Differential revision: https://reviews.llvm.org/D61639

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360325 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Fix the extensions implied by a cpu name
Diogo N. Sampaio [Thu, 9 May 2019 10:24:36 +0000 (10:24 +0000)]
[ARM] Fix the extensions implied by a cpu name

Summary:
When using `clang -mcpu=CPUNAME+FEATURELIST`,
the implied features defined by CPUNAME are
not obtained, as the entire string is passed.
This fixes that by spiting the cpuname
string in the first `+`, if any.

For example, when using
```clang -### --target=arm-arm-none-eabi -march=armv7-a -mcpu=cortex-a8+nocrc```
the intrinsic
```"target-feature" "+dsp"```
implied by `cortex-a8` is missing.

Reviewers: keith.walker.arm, DavidSpickett, carwil

Reviewed By: DavidSpickett

Subscribers: javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360324 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NewPM] Setup Passes for KASan and KMSan
Petr Hosek [Thu, 9 May 2019 06:09:35 +0000 (06:09 +0000)]
[NewPM] Setup Passes for KASan and KMSan

While ASan and MSan passes were already ported to new PM, the kernel
variants weren't setup in the pipeline which makes the KASan and KMSan
tests in Clang fail.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360313 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[c++20] Add support for explicit(bool), as described in P0892R2.
Richard Smith [Thu, 9 May 2019 03:59:21 +0000 (03:59 +0000)]
[c++20] Add support for explicit(bool), as described in P0892R2.

Patch by Tyker!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360311 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cxx_status] Mark support for std::is_constant_evaluated as done.
Richard Smith [Thu, 9 May 2019 03:49:47 +0000 (03:49 +0000)]
[cxx_status] Mark support for std::is_constant_evaluated as done.

Eric implemented this in r359067.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360310 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cxx_dr_status] Update links to use wg21.link, and list "extension"
Richard Smith [Thu, 9 May 2019 03:45:57 +0000 (03:45 +0000)]
[cxx_dr_status] Update links to use wg21.link, and list "extension"
issues as "extension" rather than "not resolved".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360309 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whose
Richard Smith [Thu, 9 May 2019 03:31:27 +0000 (03:31 +0000)]
[c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whose
template name is not visible to unqualified lookup.

In order to support this without a severe degradation in our ability to
diagnose typos in template names, this change significantly restructures
the way we handle template-id-shaped syntax for which lookup of the
template name finds nothing.

Instead of eagerly diagnosing an undeclared template name, we now form a
placeholder template-name representing a name that is known to not find
any templates. When the parser sees such a name, it attempts to
disambiguate whether we have a less-than comparison or a template-id.
Any diagnostics or typo-correction for the name are delayed until its
point of use.

The upshot should be a small improvement of our diagostic quality
overall: we now take more syntactic context into account when trying to
resolve an undeclared identifier on the left hand side of a '<'. In
fact, this works well enough that the backwards-compatible portion (for
an undeclared identifier rather than a lookup that finds functions but
no function templates) is enabled in all language modes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360308 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoWhen typo-correcting a function name, consider correcting to a type name
Richard Smith [Thu, 9 May 2019 00:57:24 +0000 (00:57 +0000)]
When typo-correcting a function name, consider correcting to a type name
for a function-style cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360302 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTry to restore some clang test headers lost in r360291
Reid Kleckner [Wed, 8 May 2019 22:30:46 +0000 (22:30 +0000)]
Try to restore some clang test headers lost in r360291

I'm not sure why 'git llvm revert' removed them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360297 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert Include corecrt.h in stddef.h and vcruntime.h in stdarg.h to improve MS compat...
Reid Kleckner [Wed, 8 May 2019 22:01:20 +0000 (22:01 +0000)]
Revert Include corecrt.h in stddef.h and vcruntime.h in stdarg.h to improve MS compatibility.

This reverts r360271 (git commit a0933bd8ec1515167ea653f7ee788b8bbde27d51)

There are concerns on the review that this breaks EFI builds and that
the transitive includes (sal.h) are actually heavy enough that we might
care.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360291 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoInclude corecrt.h in stddef.h and vcruntime.h in stdarg.h to improve MS
Mike Rice [Wed, 8 May 2019 17:15:21 +0000 (17:15 +0000)]
Include corecrt.h in stddef.h and vcruntime.h in stdarg.h to improve MS
compatibility.  This allows some applications developed with MSVC to
compile with clang without any extra changes.

Fixes: llvm.org/PR40789
Differential Revision: https://reviews.llvm.org/D61646

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360271 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenMP][Clang] Support for target math functions
Gheorghe-Teodor Bercea [Wed, 8 May 2019 15:52:33 +0000 (15:52 +0000)]
[OpenMP][Clang] Support for target math functions

Summary:
In this patch we propose a temporary solution to resolving math functions for the NVPTX toolchain, temporary until OpenMP variant is supported by Clang.

We intercept the inclusion of math.h and cmath headers and if we are in the OpenMP-NVPTX case, we re-use CUDA's math function resolution mechanism.

Authors:
@gtbercea
@jdoerfert

Reviewers: hfinkel, caomhin, ABataev, tra

Reviewed By: hfinkel, ABataev, tra

Subscribers: JDevlieghere, mgorny, guansong, cfe-commits, jdoerfert

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360265 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter] Fix inequivalence of unresolved exception spec
Gabor Marton [Wed, 8 May 2019 15:23:48 +0000 (15:23 +0000)]
[ASTImporter] Fix inequivalence of unresolved exception spec

Summary:
Structural equivalence of methods can falsely report false when the
exception specifier is unresolved (i.e unevaluated or not instantiated).

(This caused one assertion during bitcoin ctu-analysis.)

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360261 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema][OpenCL] Make address space conversions a bit stricter.
Anastasia Stulova [Wed, 8 May 2019 14:23:49 +0000 (14:23 +0000)]
[Sema][OpenCL] Make address space conversions a bit stricter.

The semantics for converting nested pointers between address
spaces are not very well defined. Some conversions which do not
really carry any meaning only produce warnings, and in some cases
warnings hide invalid conversions, such as 'global int*' to
'local float*'!

This patch changes the logic in checkPointerTypesForAssignment
and checkAddressSpaceCast to fail properly on implicit conversions
that should definitely not be permitted. We also dig deeper into the
pointer types and warn on explicit conversions where the address
space in a nested pointer changes, regardless of whether the address
space is compatible with the corresponding pointer nesting level
on the destination type.

Fixes PR39674!

Patch by ebevhan (Bevin Hansson)!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360258 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] Fix the crash when formatting unsupported encodings
Owen Pan [Wed, 8 May 2019 14:11:12 +0000 (14:11 +0000)]
[clang-format] Fix the crash when formatting unsupported encodings

Fixes PR33946

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360257 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] Fix a bug that reports UTF32 (LE) files as UTF16 (LE) ones
Owen Pan [Wed, 8 May 2019 13:49:17 +0000 (13:49 +0000)]
[clang] Fix a bug that reports UTF32 (LE) files as UTF16 (LE) ones

Also fix a typo for the SCSU byte order mark.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360256 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAllow test to pass after 2030.
Aaron Ballman [Wed, 8 May 2019 13:42:44 +0000 (13:42 +0000)]
Allow test to pass after 2030.

Patch by Bernhard M. Wiedemann.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360254 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAllow 'static' storage specifier on an out-of-line class member template declaration...
Aaron Ballman [Wed, 8 May 2019 13:24:36 +0000 (13:24 +0000)]
Allow 'static' storage specifier on an out-of-line class member template declaration in MSVCCompat mode.

Patch by Soumi Manna.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360250 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libclang] PR41649: Remove pointless duplicate flag. NFC.
Nikolai Kosjar [Wed, 8 May 2019 13:19:29 +0000 (13:19 +0000)]
[libclang] PR41649: Remove pointless duplicate flag. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360249 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix for the greendragon bots.
Leonard Chan [Wed, 8 May 2019 05:59:25 +0000 (05:59 +0000)]
Fix for the greendragon bots.

Adds extra checks for ObjC GC and Ownership.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360225 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema] Correct typos in return statements so the return types of 'auto' functions...
Sam McCall [Wed, 8 May 2019 05:49:42 +0000 (05:49 +0000)]
[Sema] Correct typos in return statements so the return types of 'auto' functions are always deduced.

Summary:
e.g.
  auto foo() {
    return no_such_thing; // Return value is a TypoExpr
  }
  using T = decltype(foo()); // Uh-oh, undeduced auto.

Reviewers: rsmith

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360224 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix buildbot break after r360195
Nemanja Ivanovic [Wed, 8 May 2019 02:03:32 +0000 (02:03 +0000)]
Fix buildbot break after r360195

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360220 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSplit ActOnCallExpr into an ActOnCallExpr to be called by the parser,
Richard Smith [Wed, 8 May 2019 01:36:36 +0000 (01:36 +0000)]
Split ActOnCallExpr into an ActOnCallExpr to be called by the parser,
and a BuildCallExpr to be called internally within Sema to build /
rebuild calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360217 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[hip] Fix ambiguity from `>>>` of CUDA.
Michael Liao [Wed, 8 May 2019 00:52:33 +0000 (00:52 +0000)]
[hip] Fix ambiguity from `>>>` of CUDA.

Summary:
- For template arguments ending with `>>>`, we should cease lookahead
  and treat it as type-id firstly, so that deduction could work
  properly.

Reviewers: tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360214 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[COFF] Use COFF stubs for extern_weak functions
Reid Kleckner [Tue, 7 May 2019 23:06:21 +0000 (23:06 +0000)]
[COFF] Use COFF stubs for extern_weak functions

Summary:
A COFF stub indirects the reference to a symbol through memory. A
.refptr.$sym global variable pointer is created to refer to $sym.
Typically mingw uses these for external global variable declarations,
but we can use them for weak function declarations as well.

Updates the dso_local classification to add a special case for
extern_weak symbols on COFF in both clang and LLVM.

Fixes PR37598

Reviewers: smeenai, mstorsjo

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360207 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Fix a crash when doing RVO from within blocks.
Artem Dergachev [Tue, 7 May 2019 22:33:13 +0000 (22:33 +0000)]
[analyzer] Fix a crash when doing RVO from within blocks.

When looking for the location context of the call site, unwrap block invocation
contexts because they are attached to the current AnalysisDeclContext
while what we need is the previous AnalysisDeclContext.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360202 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago-frewrite-imports: Add support for wildcard rules in umbrella modules with
David Blaikie [Tue, 7 May 2019 21:38:51 +0000 (21:38 +0000)]
-frewrite-imports: Add support for wildcard rules in umbrella modules with

This trips over a few other limitations, but in the interests of incremental development I'm starting here & I'll look at the issues with -verify and filesystem checks (the fact that the behavior depends on the existence of a 'foo' directory even though it shouldn't need it), etc.

Reviewers: rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360195 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[OpenMP][Clang] Support for target math functions"
Jonas Devlieghere [Tue, 7 May 2019 21:08:15 +0000 (21:08 +0000)]
Revert "[OpenMP][Clang] Support for target math functions"

This commit appears to be breaking stage-2 builds on GreenDragon. The
OpenMP wrappers for cmath and math.h are copied into the root of the
resource directory and cause a cyclic dependency in module 'Darwin':
Darwin -> std -> Darwin. This blows up when CMake is testing for modules
support and breaks all stage 2 module builds, including the ThinLTO bot
and all LLDB bots.

CMake Error at cmake/modules/HandleLLVMOptions.cmake:497 (message):
  LLVM_ENABLE_MODULES is not supported by this compiler

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360192 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter] Corrected type of integer constant in a test.
Balazs Keri [Tue, 7 May 2019 14:53:04 +0000 (14:53 +0000)]
[ASTImporter] Corrected type of integer constant in a test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360156 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd an explicit triple to this test to hopefully appease the build bots.
Aaron Ballman [Tue, 7 May 2019 14:40:37 +0000 (14:40 +0000)]
Add an explicit triple to this test to hopefully appease the build bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360155 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tooling] Add -x flags when inferring compile commands for files with no/invalid...
Sam McCall [Tue, 7 May 2019 14:34:06 +0000 (14:34 +0000)]
[Tooling] Add -x flags when inferring compile commands for files with no/invalid extension.

Summary: We treat them as headers, as the motivating case is C++ standard library.

Reviewers: kadircet

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360153 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Prevent mangling kernel functions.
Anastasia Stulova [Tue, 7 May 2019 14:22:34 +0000 (14:22 +0000)]
[OpenCL] Prevent mangling kernel functions.

Kernel function names have to be preserved as in the original
source to be able to access them from the host API side.

This commit also adds restriction to kernels that prevents them
from being used in overloading, templates, etc.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360152 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAllow field offset lookups in types with incomplete arrays within libclang.
Aaron Ballman [Tue, 7 May 2019 14:00:49 +0000 (14:00 +0000)]
Allow field offset lookups in types with incomplete arrays within libclang.

Patch thanks to Jorn Vernee

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360147 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter] Import TemplateParameterLists in function templates.
Balazs Keri [Tue, 7 May 2019 10:55:11 +0000 (10:55 +0000)]
[ASTImporter] Import TemplateParameterLists in function templates.

Summary: Correct missing import of TemplateParameterList in function decl.

Reviewers: martong, a.sidorin, shafik

Reviewed By: martong

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360132 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tooling] Don't mmap the JSONCompilationDatabase, it's not correct for long-lived...
Sam McCall [Tue, 7 May 2019 09:05:15 +0000 (09:05 +0000)]
[Tooling] Don't mmap the JSONCompilationDatabase, it's not correct for long-lived processes.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360122 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema] Add missing VisitMacroQualifiedTypeLoc to TypeSpecLocFiller
Leonard Chan [Tue, 7 May 2019 08:12:28 +0000 (08:12 +0000)]
[Sema] Add missing VisitMacroQualifiedTypeLoc to TypeSpecLocFiller

To hopefully fix greenbot failures

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360120 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImprove function / variable disambiguation.
Richard Smith [Tue, 7 May 2019 07:36:07 +0000 (07:36 +0000)]
Improve function / variable disambiguation.

Keep looking for decl-specifiers after an unknown identifier. Don't
issue diagnostics about an error type specifier conflicting with later
type specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360117 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRecommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute...
Leonard Chan [Tue, 7 May 2019 03:20:17 +0000 (03:20 +0000)]
Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"

Updated with fix for read of uninitialized memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360109 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix typo in risc-v register aliases.
Eric Christopher [Tue, 7 May 2019 00:45:47 +0000 (00:45 +0000)]
Fix typo in risc-v register aliases.

Patch by John.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360104 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Clang][NewPM] Don't bail out if the target machine is empty
Petr Hosek [Mon, 6 May 2019 23:24:17 +0000 (23:24 +0000)]
[Clang][NewPM] Don't bail out if the target machine is empty

This matches the behavior of the old pass manager. There are some
targets that don't have target machine at all (e.g. le32, spir) which
whose tests would never run with new pass manager. Similarly, we would
need to disable tests for targets that are disabled.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360100 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema] Fix for P41774 where `ExpectNoDerefChunk` is assigned twice
Leonard Chan [Mon, 6 May 2019 22:09:12 +0000 (22:09 +0000)]
[Sema] Fix for P41774 where `ExpectNoDerefChunk` is assigned twice

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360089 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Jordan Rupprecht [Mon, 6 May 2019 21:55:05 +0000 (21:55 +0000)]
Revert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This reverts r357452 (git commit 21eb771dcb5c11d7500fa6ad551c97a921997f05).

This was causing strange optimization-related test failures on an internal test. Will followup with more details offline.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360086 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPR41183: Don't emit strict-prototypes warning for an implicit function
James Y Knight [Mon, 6 May 2019 21:37:59 +0000 (21:37 +0000)]
PR41183: Don't emit strict-prototypes warning for an implicit function
declaration.

It should emit _only_ an implicit-function-declaration warning, not
both of them.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360084 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Add __builtin_sponentry, for calling setjmp in MinGW
Martin Storsjo [Mon, 6 May 2019 21:19:07 +0000 (21:19 +0000)]
[AArch64] Add __builtin_sponentry, for calling setjmp in MinGW

In MinGW, setjmp isn't expanded as a builtin in the compiler (like it
is for MSVC), but manually hooked up as calls to the right underlying
functions in headers. Using the actual CRT's real setjmp/longjmp
functions requires this intrinsic. (Currently this is worked around by
using MinGW specific reimplementations of setjmp/longjmp on aarch64.)

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360082 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MinGW] Use SEH by default on AArch64
Martin Storsjo [Mon, 6 May 2019 21:19:01 +0000 (21:19 +0000)]
[MinGW] Use SEH by default on AArch64

The implementation of SEH is pretty mature at this point.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360081 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with
Alexey Bataev [Mon, 6 May 2019 20:07:20 +0000 (20:07 +0000)]
[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with
default(none).

If the combined directive has default(none) clause and has clauses for
inner directive that reference some variables, for which data-sharing
attributes are not specified, the error messages should be emitted for
such variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360073 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenMP][Clang] Support for target math functions
Gheorghe-Teodor Bercea [Mon, 6 May 2019 18:19:15 +0000 (18:19 +0000)]
[OpenMP][Clang] Support for target math functions

Summary:
In this patch we propose a temporary solution to resolving math functions for the NVPTX toolchain, temporary until OpenMP variant is supported by Clang.

We intercept the inclusion of math.h and cmath headers and if we are in the OpenMP-NVPTX case, we re-use CUDA's math function resolution mechanism.

Authors:
@gtbercea
@jdoerfert

Reviewers: hfinkel, caomhin, ABataev, tra

Reviewed By: hfinkel, ABataev, tra

Subscribers: mgorny, guansong, cfe-commits, jdoerfert

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360063 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses.
Alexey Bataev [Mon, 6 May 2019 17:49:22 +0000 (17:49 +0000)]
[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses.

If the `default(none)` was specified for the construct, we might miss
diagnostic for the globals without explicitly specified data-sharing
attributes. Patch fixes this problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360061 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeComplete] Update python tests after r360042
Ilya Biryukov [Mon, 6 May 2019 14:56:24 +0000 (14:56 +0000)]
[CodeComplete] Update python tests after r360042

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360048 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeComplete] Add a trailing semicolons to some pattern completions
Ilya Biryukov [Mon, 6 May 2019 13:18:00 +0000 (13:18 +0000)]
[CodeComplete] Add a trailing semicolons to some pattern completions

Summary:
Where semicolon is required in any case. Here's a list of completions
that now have a semicolon:
  - namespace <name> = <target>;
  - using namespace <name>;
  - using <qualifier>::<name>;
  - continue;
  - break;
  - goto <label>;
  - return;
  - return <expression>;

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360042 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r359949 "[clang] adding explicit(bool) from c++2a"
Hans Wennborg [Mon, 6 May 2019 09:51:10 +0000 (09:51 +0000)]
Revert r359949 "[clang] adding explicit(bool) from c++2a"

This caused Clang to start erroring on the following:

  struct S {
    template <typename = int> explicit S();
  };

  struct T : S {};

  struct U : T {
    U();
  };
  U::U() {}

  $ clang -c /tmp/x.cc
  /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T'
  U::U() {}
     ^
  /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted
    because base class 'S' has no default constructor
  struct T : S {};
             ^
  1 error generated.

See discussion on the cfe-commits email thread.

This also reverts the follow-ups r359966 and r359968.

> this patch adds support for the explicit bool specifier.
>
> Changes:
> - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
> - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
> - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
> - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
> - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
> - Test for Semantic and Serialization were added.
>
> This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
> Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.
>
> Patch by Tyker
>
> Differential Revision: https://reviews.llvm.org/D60934

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360024 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Move files to correct directories after D60552
Fangrui Song [Mon, 6 May 2019 09:24:36 +0000 (09:24 +0000)]
[X86] Move files to correct directories after D60552

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360022 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoEnable intrinsics of AVX512_BF16, which are supported for BFLOAT16 in Cooper Lake
Luo, Yuanke [Mon, 6 May 2019 08:25:11 +0000 (08:25 +0000)]
Enable intrinsics of AVX512_BF16, which are supported for BFLOAT16 in Cooper Lake

Summary:
1. Enable infrastructure of AVX512_BF16, which is supported for BFLOAT16 in Cooper Lake;
2. Enable intrinsics for VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS instructions, which are Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
For more details about BF16 intrinsic, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Patch by LiuTianle

Reviewers: craig.topper, smaslov, LuoYuanke, wxiao3, annita.zhang, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: mgorny, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360018 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoP1286R2: Remove restriction that the exception specification of a
Richard Smith [Mon, 6 May 2019 05:04:56 +0000 (05:04 +0000)]
P1286R2: Remove restriction that the exception specification of a
defaulted special member matches the implicit exception specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360011 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Richard Smith [Mon, 6 May 2019 04:14:01 +0000 (04:14 +0000)]
Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.

This reverts r359984 (which reverted r359962). The bug in clang-tidy's
test suite exposed by the original commit was fixed in r360009.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360010 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[c++20] Implement P1009R2: allow omitting the array bound in an array
Richard Smith [Mon, 6 May 2019 03:47:15 +0000 (03:47 +0000)]
[c++20] Implement P1009R2: allow omitting the array bound in an array
new expression.

This was voted into C++20 as a defect report resolution, so we
retroactively apply it to all prior language modes (though it can never
actually be used before C++11 mode).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360006 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoThe 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets...
Galina Kistanova [Mon, 6 May 2019 03:30:09 +0000 (03:30 +0000)]
The 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets only (as example ARM-only) with the following error:

error: unable to create target: 'No available targets are compatible with triple "< ... any 64-bit target triple ... >"'

I didn't find any 64-bit dependencies for the test and I think removing '-m64' option should fix the problem and allow this test for any target specified by LLVM_DEFAULT_TARGET_TRIPLE.

Patch by Vlad Vereschaka.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360005 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.
Kristof Umann [Sun, 5 May 2019 19:42:33 +0000 (19:42 +0000)]
[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.

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

Pretty much the same as D61246 and D61106, this time for __complex__ types. Upon
further investigation, I realized that we should regard all types
Type::isScalarType returns true for as primitive, so I merged
isMemberPointerType(), isBlockPointerType() and isAnyComplexType()` into that
instead.

I also stumbled across yet another bug,
https://bugs.llvm.org/show_bug.cgi?id=41753, but it seems to be unrelated to
this checker.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359998 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert rL359962 : Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Simon Pilgrim [Sun, 5 May 2019 17:10:05 +0000 (17:10 +0000)]
Revert rL359962 : Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.
........
Try to fix buildbots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359984 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] fixing -ast-print for variadic parameter pack in lambda capture
Nicolas Lesser [Sun, 5 May 2019 12:35:12 +0000 (12:35 +0000)]
[clang] fixing -ast-print for variadic parameter pack in lambda capture

Summary:
currently for:
```
 template<typename ... T>
void f(T... t) {
  auto l = [t...]{};
}
```
`clang -ast-print file.cpp`
outputs:

```
template <typename ...T> void f(T ...t) {
    auto l = [t]         {
        }
;
}
```
notice that there is not `...` in the capture list of the lambda. this patch fixes this issue. and add test for it.

Patch by Tyker

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359980 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[C++] Interpret unknown identifier in parameter clause as unknown type
Nicolas Lesser [Sun, 5 May 2019 12:15:17 +0000 (12:15 +0000)]
[C++] Interpret unknown identifier in parameter clause as unknown type

instead of as parameter name without a type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359979 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Add parentheses to avoid -Wparentheses.
Nicolas Lesser [Sat, 4 May 2019 11:28:11 +0000 (11:28 +0000)]
[NFC] Add parentheses to avoid -Wparentheses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359968 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas
Hamza Sood [Sat, 4 May 2019 10:49:46 +0000 (10:49 +0000)]
[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359967 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[c++20] Implement tweaked __VA_OPT__ rules from P1042R1:
Richard Smith [Sat, 4 May 2019 06:46:18 +0000 (06:46 +0000)]
[c++20] Implement tweaked __VA_OPT__ rules from P1042R1:

 * __VA_OPT__ is expanded if the *expanded* __VA_ARGS__ is non-empty,
   not if the original argument contained no tokens.
 * Placemarkers at the start and end of __VA_OPT__ are retained just
   long enough to paste them with adjacent ## operators. We never paste
   "across" a discarded placemarker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359964 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Richard Smith [Sat, 4 May 2019 05:20:14 +0000 (05:20 +0000)]
Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359962 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReduce amount of work ODR hashing does.
Richard Trieu [Sat, 4 May 2019 04:22:33 +0000 (04:22 +0000)]
Reduce amount of work ODR hashing does.

When a FunctionProtoType is in the original type in a DecayedType, the decayed
type is a PointerType which points back the original FunctionProtoType.  The
visitor for ODRHashing will attempt to process both Type's, doing double work.
By chaining together multiple DecayedType's and FunctionProtoType's, this would
result in 2^N Type's visited only N DecayedType's and N FunctionProtoType's
exsit.  Another bug where VisitDecayedType and VisitAdjustedType did
redundant work doubled the work at each level, giving 4^N Type's visited.  This
patch removed the double work and detects when a FunctionProtoType decays to
itself to only check the Type once.  This lowers the exponential runtime to
linear runtime.  Fixes https://bugs.llvm.org/show_bug.cgi?id=41625

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359960 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDisallow the operand of __builtin_constant_p from modifying enclosing
Richard Smith [Sat, 4 May 2019 04:00:45 +0000 (04:00 +0000)]
Disallow the operand of __builtin_constant_p from modifying enclosing
state when it's encountered while evaluating a constexpr function.

We attempt to follow GCC trunk's behavior here, but it is somewhat
inscrutible, so our behavior is only approximately the same for now.
Specifically, we only permit modification of objects whose lifetime
began within the operand of the __builtin_constant_p. GCC appears to
have effectively the same restriction, but also some unknown restriction
based on where and how the local state of the constexpr function is
mentioned within the operand (see added testcases).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359958 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Driver] Create non-existent directory for -fcrash-diagnostics-dir
Petr Hosek [Sat, 4 May 2019 00:55:14 +0000 (00:55 +0000)]
[Driver] Create non-existent directory for -fcrash-diagnostics-dir

When user specifies non-existent directory to -fcrash-diagnostics-dir,
create it rather than failing with an error as would be the case before.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359954 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
Richard Smith [Sat, 4 May 2019 00:27:21 +0000 (00:27 +0000)]
[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
support; those turn on different modules modes. The real C++ modules
support is behind -std=c++2a like the rest of C++20.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359953 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.
Richard Smith [Sat, 4 May 2019 00:23:18 +0000 (00:23 +0000)]
[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.

Also: use the "svn" color for "explicit(bool)" rather than the "full" color.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359951 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] adding explicit(bool) from c++2a
Nicolas Lesser [Sat, 4 May 2019 00:09:00 +0000 (00:09 +0000)]
[clang] adding explicit(bool) from c++2a

this patch adds support for the explicit bool specifier.

Changes:
- The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
- The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
- Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
- Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
- The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
- Test for Semantic and Serialization were added.

This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.

Patch by Tyker

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359949 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCWG issue 727: Fix numerous bugs in support for class-scope explicit
Richard Smith [Fri, 3 May 2019 23:51:38 +0000 (23:51 +0000)]
CWG issue 727: Fix numerous bugs in support for class-scope explicit
specializations for variable templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359947 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] Fix bug in block comment reflow that joins * and /
Owen Pan [Fri, 3 May 2019 23:15:40 +0000 (23:15 +0000)]
[clang-format] Fix bug in block comment reflow that joins * and /

Fixes PR41213

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359943 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[COFF, ARM64] Fix ABI implementation of struct returns
Mandeep Singh Grang [Fri, 3 May 2019 21:12:24 +0000 (21:12 +0000)]
[COFF, ARM64] Fix ABI implementation of struct returns

Summary:
Related llvm patch: D60348.
Patch co-authored by Sanjin Sijaric.

Reviewers: rnk, efriedma, TomTan, ssijaric, ostannard

Reviewed By: efriedma

Subscribers: dmajor, richard.townsend.arm, ostannard, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359932 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoEnsure there is stack usage in stack size warning test
Matt Arsenault [Fri, 3 May 2019 19:04:14 +0000 (19:04 +0000)]
Ensure there is stack usage in stack size warning test

r359906 broke this because the only stack usage was from a spill which
can be avoided since the only block is a return.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359918 91177308-0d34-0410-b5e6-96231b3b80d8