]> granicus.if.org Git - clang/log
clang
5 years ago[DirectoryWatcher] Fix asserts Mac builds
Shoaib Meenai [Tue, 6 Aug 2019 07:13:53 +0000 (07:13 +0000)]
[DirectoryWatcher] Fix asserts Mac builds

Add a missing semicolon after an assert. Remove the period from the
assert message while I'm here, because we don't usually have those.

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

5 years ago[Driver] Introduce -stdlib++-isystem
Shoaib Meenai [Tue, 6 Aug 2019 06:48:43 +0000 (06:48 +0000)]
[Driver] Introduce -stdlib++-isystem

There are times when we wish to explicitly control the C++ standard
library search paths used by the driver. For example, when we're
building against the Android NDK, we might want to use the NDK's C++
headers (which have a custom inline namespace) even if we have C++
headers installed next to the driver. We might also be building against
a non-standard directory layout and wanting to specify the C++ standard
library include directories explicitly.

We could accomplish this by passing -nostdinc++ and adding an explicit
-isystem for our custom search directories. However, users of our
toolchain may themselves want to use -nostdinc++ and a custom C++ search
path (libc++'s build does this, for example), and our added -isystem
won't respect the -nostdinc++, leading to multiple C++ header
directories on the search path, which causes build failures.

Add a new driver option -stdlib++-isystem to support this use case.
Passing this option suppresses adding the default C++ library include
paths in the driver, and it also respects -nostdinc++ to allow users to
still override the C++ library paths themselves.

It's a bit unfortunate that we end up with both -stdlib++-isystem and
-cxx-isystem, but their semantics differ significantly. -cxx-isystem is
unaffected by -nostdinc++ and is added to the end of the search path
(which is not appropriate for C++ standard library headers, since they
often #include_next into other system headers), while -stdlib++-isystem
respects -nostdinc++, is added to the beginning of the search path, and
suppresses the default C++ library include paths.

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

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

5 years ago[Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl
Fangrui Song [Tue, 6 Aug 2019 06:25:32 +0000 (06:25 +0000)]
[Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl

On a musl-based Linux distribution, stdalign.h stdarg.h stdbool.h stddef.h stdint.h stdnoreturn.h are expected to be provided by musl (/usr/include), instead of RESOURCE_DIR/include.
Reorder RESOURCE_DIR/include to fix the search order problem.
(Currently musl doesn't provide stdatomic.h. stdatomic.h is still found in RESOURCE_DIR/include.)

gcc on musl has a similar search order:

```
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/x86_64-alpine-linux-musl
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/backward
 /usr/local/include
 /usr/include/fortify
 /usr/include
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/include
```

This is different from a glibc-based distribution where RESOURCE_DIR/include is placed before SYSROOT/usr/include.

According to the maintainer of musl:

> musl does not support use/mixing of compiler-provided std headers with its headers, and intentionally has no mechanism for communicating with such headers as to which types have already been defined or still need to be defined. If the current include order, with clang's headers before the libc ones, works in some situations, it's only by accident.

Reviewed by: phosek

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

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

5 years ago[clang][DirectoryWatcher] Adding llvm::Expected error handling to create.
Puyan Lotfi [Tue, 6 Aug 2019 05:12:23 +0000 (05:12 +0000)]
[clang][DirectoryWatcher] Adding llvm::Expected error handling to create.

Prior to this patch Unix style errno error reporting from the inotify layer was
used by DirectoryWatcher::create to simply return a nullptr on error. This
would generally be ok, except that in LLVM we have much more robust error
reporting through the facilities of llvm::Expected.

The other critical thing I stumbled across was that the unit tests for
DirectoryWatcher were not failing abruptly when inotify_init() was reporting an
error, but would continue with the testing and eventually hit a deadlock in a
pathological machine state (ie in the unit test, the return nullptr on ::create
was ignored).

Generally this pathological state never happens on any build bot, so it is
totally understandable that it was overlooked, but on a Linux desktop running
a dubious desktop environment (which I will not name) there is a chance that
said desktop environment could use up enough inotify instances to exceed the
user's limit. These are the conditions that led me to hit the deadlock I am
addressing in this patch with more robust error handling.

With the new llvm::Expected error handling when your system runs out of inotify
instances for your user, the unit test will be forced to handle the error or
crash and report the issue to the user instead of weirdly deadlocking on a
condition variable wait.

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

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

5 years agoBuiltins: Start adding half versions of math builtins
Matt Arsenault [Tue, 6 Aug 2019 03:28:37 +0000 (03:28 +0000)]
Builtins: Start adding half versions of math builtins

The implementation of the OpenCL builtin currently library uses 2
different hacks to get to the corresponding IR intrinsics from the
source. This will allow removal of those.

This is the set that is currently used (minus a few vector ones).

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

5 years ago[NFC][DirectoryWatchedTests] Unlocks mutexes before signaling condition variable
Puyan Lotfi [Tue, 6 Aug 2019 01:26:46 +0000 (01:26 +0000)]
[NFC][DirectoryWatchedTests] Unlocks mutexes before signaling condition variable

This should not affect actual behavior, but should pessimize the threading less
by avoiding the situation where:

  * mutex is still locked
  * T1 notifies on condition variable
  * T2 wakes to check mutex
  * T2 sees mutex is still locked
  * T2 waits
  * T1 unlocks mutex
  * T2 tries again, acquires mutex.

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

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

5 years ago[Sema] attempt to appease buildbots after r367940
George Burgess IV [Mon, 5 Aug 2019 23:19:15 +0000 (23:19 +0000)]
[Sema] attempt to appease buildbots after r367940

A buildbot got angry about this new test, with error messages like:

warn-nullchar-nullptr.c Line 16: use of undeclared identifier 'u'

It looks like this `u'c'` syntax was introduced in C11; I'm guessing
some bots may default to something before that. Let's see if explicitly
specifying the standard version makes it happy...

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

5 years ago[Sema] Add -Wpointer-compare
George Burgess IV [Mon, 5 Aug 2019 22:15:40 +0000 (22:15 +0000)]
[Sema] Add -Wpointer-compare

This patch adds a warning that diagnoses comparisons of pointers to
'\0'. This is often indicative of a bug (e.g. the user might've
forgotten to dereference the pointer).

Patch by Elaina Guan!

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

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

5 years ago[docs] don't use :option: for Wall Wextra
JF Bastien [Mon, 5 Aug 2019 19:59:07 +0000 (19:59 +0000)]
[docs] don't use :option: for Wall Wextra

The bots are sad that they're not documented.

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

5 years ago[docs] don't use :option: for C++ compat
JF Bastien [Mon, 5 Aug 2019 19:45:23 +0000 (19:45 +0000)]
[docs] don't use :option: for C++ compat

The bots are sad that they're not documented.

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

5 years agoFix another uninit read found by msan after r367829
Nico Weber [Mon, 5 Aug 2019 19:35:59 +0000 (19:35 +0000)]
Fix another uninit read found by msan after r367829

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

5 years ago[DirectoryWatcher][linux] Fix build for older kernels
Jan Korous [Mon, 5 Aug 2019 18:44:07 +0000 (18:44 +0000)]
[DirectoryWatcher][linux] Fix build for older kernels

Apparently kernel support for IN_EXCL_UNLINK in inotify_add_watch() doesn't imply it's defined in sys/inotify.h.

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

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

5 years ago[OpenMP 5.0] Codegen support for user-defined mappers.
Michael Kruse [Mon, 5 Aug 2019 18:43:21 +0000 (18:43 +0000)]
[OpenMP 5.0] Codegen support for user-defined mappers.

This patch implements the code generation for OpenMP 5.0 declare mapper
(user-defined mapper) constructs. For each declare mapper, a mapper
function is generated. These mapper functions will be called by the
runtime and/or other mapper functions to achieve user defined mapping.

The design slides can be found at
https://github.com/lingda-li/public-sharing/blob/master/mapper_runtime_design.pptx

Re-commit after revert in r367773 because r367755 changed the LLVM-IR
output such that a CHECK line failed.

Patch by Lingda Li <lildmh@gmail.com>

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

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

5 years ago[AST] Fix buildbot failure because of raw string inside macro from 367839.
Johan Vikstrom [Mon, 5 Aug 2019 17:14:46 +0000 (17:14 +0000)]
[AST] Fix buildbot failure because of raw string inside macro from 367839.

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

5 years ago[docs] document -Weveything more betterer
JF Bastien [Mon, 5 Aug 2019 16:53:45 +0000 (16:53 +0000)]
[docs] document -Weveything more betterer

Reviewers: aaron.ballman

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[AST] Fix RecursiveASTVisitorTest multiline string literal. NFC
David Green [Mon, 5 Aug 2019 16:27:36 +0000 (16:27 +0000)]
[AST] Fix RecursiveASTVisitorTest multiline string literal. NFC

Some compiler, notably older gccs (< 8) can have trouble with multiline raw
string literals inside macros. This just moves the code outsize the macro, to
attempt to appease the bots.

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

5 years agoUndo what looks like an unintentional change in r367829
Nico Weber [Mon, 5 Aug 2019 15:23:10 +0000 (15:23 +0000)]
Undo what looks like an unintentional change in r367829

The MSan bot was (rightfully) complaining that NumASTLoaded was
unitialized, so put the initialization removed in r367829 back in.

While here, remove two needless semicolons added in that change.

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

5 years ago[Driver] Properly use values-X[ca].o, values-xpg[46].o on Solaris
Rainer Orth [Mon, 5 Aug 2019 14:06:16 +0000 (14:06 +0000)]
[Driver] Properly use values-X[ca].o, values-xpg[46].o on Solaris

Builtins-*-sunos :: compiler_rt_logbf_test.c currently FAILs on Solaris, both SPARC and
x86, 32 and 64-bit.

It turned out that this is due to different behaviour of logb depending on the C
standard compiled for, as documented on logb(3M):

  RETURN VALUES
         Upon successful completion, these functions return the exponent of x.

         If x is subnormal:

             o      For SUSv3-conforming applications compiled with the c99 com-
                    piler  driver  (see standards(7)), the exponent of x as if x
                    were normalized is returned.

             o      Otherwise, if compiled with the cc compiler  driver,  -1022,
                    -126,  and  -16382  are  returned  for  logb(), logbf(), and
                    logbl(), respectively.

Studio c99 and gcc control this by linking with the appropriate version of values-xpg[46].o, but clang uses neither of those.

The following patch fixes this by following what gcc does, as corrected some time ago in

  Fix use of Solaris values-Xc.o (PR target/40411)
  https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02350.html and
  https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02384.html.

Tested on x86_64-pc-solaris2.11, sparcv9-sun-solaris2.11, and x86_64-pc-linux-gnu.

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

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

5 years agoMove LangStandard*, InputKind::Language to Basic
Rainer Orth [Mon, 5 Aug 2019 13:59:26 +0000 (13:59 +0000)]
Move LangStandard*, InputKind::Language to Basic

This patch is a prerequisite for using LangStandard from Driver in
https://reviews.llvm.org/D64793.

It moves LangStandard* and InputKind::Language to Basic.  It is mostly
mechanical, with only a few changes of note:

- enum Language has been changed into enum class Language : uint8_t to
  avoid a clash between OpenCL in enum Language and OpenCL in enum
  LangFeatures and not to increase the size of class InputKind.

- Now that getLangStandardForName, which is currently unused, also checks
  both canonical and alias names, I've introduced a helper getLangKind
  which factors out a code pattern already used 3 times.

The patch has been tested on x86_64-pc-solaris2.11, sparcv9-sun-solaris2.11,
and x86_64-pc-linux-gnu.

There's a companion patch for lldb which uses LangStandard.h
(https://reviews.llvm.org/D65717).

While polly includes isl which in turn uses InputKind::C, that part of the
code isn't even built inside the llvm tree.  I've posted a patch to allow
for both InputKind::C and Language::C upstream
(https://groups.google.com/forum/#!topic/isl-development/6oEvNWOSQFE).

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

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

5 years ago[clang][NFC] Remove unused private variable 'CI' in CrossTranslationUnit.h
Raphael Isemann [Mon, 5 Aug 2019 12:23:39 +0000 (12:23 +0000)]
[clang][NFC] Remove unused private variable 'CI' in CrossTranslationUnit.h

It seems because of the recent refactorings this variable has become unused
and now we get this warning in the build logs:

In file included from llvm/clang/lib/CrossTU/CrossTranslationUnit.cpp:12:
llvm/clang/include/clang/CrossTU/CrossTranslationUnit.h:200:21: warning: private field 'CI' is not used [-Wunused-private-field]
  CompilerInstance &CI;
                    ^

I'll remove them for now to get the builds back to green.

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

5 years ago[AST] Fix RecursiveASTVisitor visiting implicit constructor initializers.
Johan Vikstrom [Mon, 5 Aug 2019 12:20:43 +0000 (12:20 +0000)]
[AST] Fix RecursiveASTVisitor visiting implicit constructor initializers.

Summary: RecursiveASTVisitor was visiting implcit constructor initializers. This caused semantic highlighting in clangd to emit error logs. Fixes this by checking if the constructor is written or if the visitor should visit implicit decls.

Reviewers: hokein, ilya-biryukov

Subscribers: kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[CrossTU][NFCI] Refactor loadExternalAST function
Endre Fulop [Mon, 5 Aug 2019 11:06:41 +0000 (11:06 +0000)]
[CrossTU][NFCI] Refactor loadExternalAST function

Summary:
Refactor loadExternalAST method of CrossTranslationUnitContext in order to
reduce maintenance burden and so that features are easier to add in the future.

Reviewers: martong

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

Tags: #clang

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

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

5 years agoSidestep false positive due to a matching git repository name
Roger Ferrer Ibanez [Mon, 5 Aug 2019 10:09:06 +0000 (10:09 +0000)]
Sidestep false positive due to a matching git repository name

I have failures in this test because the grep @b gets confused by the
clang version including a repository name like this

!1 = !{!"clang version 10.0.0 (git@build-machine:llvm/llvm-monorepo.git fe958c0e8c89ec663c8e551936778e2cbb460154)"}

I considered something like grep -w but my understanding of the manpages
was that that isn't super portable. So I think it is easier to make
clang not to output that metadata using -fno-ident.

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

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

5 years ago[OpenCL] Fix vector literal test broken in rL367675.
Anastasia Stulova [Mon, 5 Aug 2019 09:50:28 +0000 (09:50 +0000)]
[OpenCL] Fix vector literal test broken in rL367675.

Avoid checking alignment unnecessary that is not portable
among targets.

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

5 years agoAdds a warning when an inline Doxygen comment has no argument
Dmitri Gribenko [Mon, 5 Aug 2019 08:05:16 +0000 (08:05 +0000)]
Adds a warning when an inline Doxygen comment has no argument

Summary:
It warns for for comments like
/** \pre \em */

where \em has no argument

This warning is enabled with the -Wdocumentation option.

Reviewers: gribozavr, rsmith

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

Patch by Mark de Wever.

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

5 years ago[Analyzer] Iterator Checkers - Fix for Crash on Iterator Differences
Adam Balogh [Mon, 5 Aug 2019 06:45:41 +0000 (06:45 +0000)]
[Analyzer] Iterator Checkers - Fix for Crash on Iterator Differences

Iterators differences were mistakenly handled as random decrements which
causes an assertion. This patch fixes this.

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

5 years agoRename F_{None,Text,Append} to OF_{None,Text,Append}. NFC
Fangrui Song [Mon, 5 Aug 2019 05:43:48 +0000 (05:43 +0000)]
Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC

F_{None,Text,Append} are kept for compatibility since r334221.

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

5 years ago[Driver] Don't disable -fsanitizer-coverage for safe-stack or shadow-call-stack
Petr Hosek [Mon, 5 Aug 2019 04:48:56 +0000 (04:48 +0000)]
[Driver] Don't disable -fsanitizer-coverage for safe-stack or shadow-call-stack

These "sanitizers" are hardened ABIs that are wholly orthogonal
to the SanitizerCoverage instrumentation.

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

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

5 years ago[Driver] Derive Fuchsia Linker directly from Tool
Petr Hosek [Mon, 5 Aug 2019 01:36:51 +0000 (01:36 +0000)]
[Driver] Derive Fuchsia Linker directly from Tool

Fuchsia Linker tool doesn't need any of the GnuTool behavior.

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

5 years ago[Driver] Always use -z separate-code with lld on Fuchsia
Petr Hosek [Mon, 5 Aug 2019 01:15:33 +0000 (01:15 +0000)]
[Driver] Always use -z separate-code with lld on Fuchsia

Previously -z separate-code was the default lld behavior, but now it
has to be explicitly requested by specifying the flag.

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

5 years ago[Driver] Support for disabling sanitizer runtime linking
Petr Hosek [Sun, 4 Aug 2019 22:24:14 +0000 (22:24 +0000)]
[Driver] Support for disabling sanitizer runtime linking

This change introduces a pair of -fsanitize-link-runtime and
-fno-sanitize-link-runtime flags which can be used to control linking of
sanitizer runtimes. This is useful in certain environments like kernels
where existing runtime libraries cannot be used.

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

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

5 years ago[Parser] Emit descriptive diagnostic for misplaced pragma
Serge Pavlov [Sun, 4 Aug 2019 10:08:51 +0000 (10:08 +0000)]
[Parser] Emit descriptive diagnostic for misplaced pragma

If a class or struct or union declaration contains a pragma that
is not valid in this context, compiler issues generic error like
"expected member name or ';' after declaration specifiers". With this
change the error tells that this pragma cannot appear in this declaration.

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

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

5 years agoRevert "[OpenMP 5.0] Codegen support for user-defined mappers."
Michael Kruse [Sun, 4 Aug 2019 05:16:52 +0000 (05:16 +0000)]
Revert "[OpenMP 5.0] Codegen support for user-defined mappers."

This reverts commit r367773. The test case
OpenMP/declare_mapper_codegen.cpp is failing.

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

5 years ago[OpenMP 5.0] Codegen support for user-defined mappers.
Michael Kruse [Sun, 4 Aug 2019 04:18:42 +0000 (04:18 +0000)]
[OpenMP 5.0] Codegen support for user-defined mappers.

This patch implements the code generation for OpenMP 5.0 declare mapper
(user-defined mapper) constructs. For each declare mapper, a mapper
function is generated. These mapper functions will be called by the
runtime and/or other mapper functions to achieve user defined mapping.

The design slides can be found at
https://github.com/lingda-li/public-sharing/blob/master/mapper_runtime_design.pptx

Patch by Lingda Li <lildmh@gmail.com>

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

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

5 years agoUse switch instead of series of comparisons
Serge Pavlov [Sat, 3 Aug 2019 16:32:49 +0000 (16:32 +0000)]
Use switch instead of series of comparisons

This is style correction, no functional changes.

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

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

5 years agoIR: print value numbers for unnamed function arguments
Tim Northover [Sat, 3 Aug 2019 14:28:34 +0000 (14:28 +0000)]
IR: print value numbers for unnamed function arguments

For consistency with normal instructions and clarity when reading IR,
it's best to print the %0, %1, ... names of function arguments in
definitions.

Also modifies the parser to accept IR in that form for obvious reasons.

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

5 years agoThe MinGW linker supports response files
Reid Kleckner [Fri, 2 Aug 2019 22:55:00 +0000 (22:55 +0000)]
The MinGW linker supports response files

This affects both LLD and ld.bfd.

This isn't testable with a normal driver test with -### because those
command lines are printed before response file setup. I tested manually
and confirmed it seems to do the right thing.

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

5 years ago[BPF] annotate DIType metadata for builtin preseve_array_access_index()
Yonghong Song [Fri, 2 Aug 2019 21:28:28 +0000 (21:28 +0000)]
[BPF] annotate DIType metadata for builtin preseve_array_access_index()

Previously, debuginfo types are annotated to
IR builtin preserve_struct_access_index() and
preserve_union_access_index(), but not
preserve_array_access_index(). The debug info
is useful to identify the root type name which
later will be used for type comparison.

For user access without explicit type conversions,
the previous scheme works as we can ignore intermediate
compiler generated type conversions (e.g., from union types to
union members) and still generate correct access index string.

The issue comes with user explicit type conversions, e.g.,
converting an array to a structure like below:
  struct t { int a; char b[40]; };
  struct p { int c; int d; };
  struct t *var = ...;
  ... __builtin_preserve_access_index(&(((struct p *)&(var->b[0]))->d)) ...
Although BPF backend can derive the type of &(var->b[0]),
explicit type annotation make checking more consistent
and less error prone.

Another benefit is for multiple dimension array handling.
For example,
  struct p { int c; int d; } g[8][9][10];
  ... __builtin_preserve_access_index(&g[2][3][4].d) ...
It would be possible to calculate the number of "struct p"'s
before accessing its member "d" if array debug info is
available as it contains each dimension range.

This patch enables to annotate IR builtin preserve_array_access_index()
with proper debuginfo type. The unit test case and language reference
is updated as well.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D65664

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

5 years ago[Driver][test] Avoid undefined grep in darwin-ld.c
Hubert Tong [Fri, 2 Aug 2019 19:26:05 +0000 (19:26 +0000)]
[Driver][test] Avoid undefined grep in darwin-ld.c

Summary:
question-mark is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\?`
as used by rC366282 is undefined. This patch uses an ERE instead.

Reviewers: rnk, daltenty, xingxue, jasonliu

Reviewed By: rnk

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRemove a dead diagnostic, NFC
Erik Pilkington [Fri, 2 Aug 2019 19:25:58 +0000 (19:25 +0000)]
Remove a dead diagnostic, NFC

This was issued in Objective-C 1 mode, but we not longer support that, so this
is just unreachable.

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

5 years ago[Sema] Disable -Wbitwise-op-parentheses and -Wlogical-op-parentheses by default
Fangrui Song [Fri, 2 Aug 2019 16:31:38 +0000 (16:31 +0000)]
[Sema] Disable -Wbitwise-op-parentheses and -Wlogical-op-parentheses by default

Summary:
The -Wparentheses warnings are enabled by default in clang but they are under
-Wall in gcc (gcc/c-family/c.opt). Some of the operator precedence warnings are
oftentimes criticized as noise (clang: default; gcc: -Wall). If a warning is
very controversial, it is probably not a good idea to enable it by default.
This patch disables the rather annoying ones:

-Wbitwise-op-parentheses, e.g. i & i | i
-Wlogical-op-parentheses, e.g. i && i || i

After this change:

```
* = enabled by default

-Wall
  -Wparentheses
    -Wlogical-op-parentheses
    -Wlogical-not-parentheses*
    -Wbitwise-op-parentheses
    -Wshift-op-parentheses*
    -Woverloaded-shift-op-parentheses*
    -Wparentheses-equality*
    -Wdangling-else*
```

-Woverloaded-shift-op-parentheses is typically followed by overload
resolution failure. We can instead improve the error message, and
probably delete -Woverloaded-shift-op-parentheses in the future. Keep it
for now because it gives some diagnostics.

Reviewers: akyrtzi, jyknight, rtrieu, rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[OpenCL] Allow OpenCL C style vector initialization in C++
Anastasia Stulova [Fri, 2 Aug 2019 11:19:35 +0000 (11:19 +0000)]
[OpenCL] Allow OpenCL C style vector initialization in C++

Allow creating vector literals from other vectors.

 float4 a = (float4)(1.0f, 2.0f, 3.0f, 4.0f);
 float4 v = (float4)(a.s23, a.s01);

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

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

5 years agoDon't try emitting dllexported explicitly defaulted non-trivial ctors twice during...
Hans Wennborg [Fri, 2 Aug 2019 07:51:41 +0000 (07:51 +0000)]
Don't try emitting dllexported explicitly defaulted non-trivial ctors twice during explicit template instantiation definition (PR42857)

Trying to emit the definition twice triggers an assert.

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

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

5 years agoRevert r367649: Improve raw_ostream so that you can "write" colors using operator<<
Rui Ueyama [Fri, 2 Aug 2019 07:22:34 +0000 (07:22 +0000)]
Revert r367649: Improve raw_ostream so that you can "write" colors using operator<<

This reverts commit r367649 in an attempt to unbreak Windows bots.

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

5 years ago[PGO] Fix bolt failures from r367628
Rong Xu [Fri, 2 Aug 2019 07:21:50 +0000 (07:21 +0000)]
[PGO] Fix bolt failures from r367628

Relaxed the check in a test because the windows bolt generates different
profile variables.

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

5 years agoImprove raw_ostream so that you can "write" colors using operator<<
Rui Ueyama [Fri, 2 Aug 2019 04:48:30 +0000 (04:48 +0000)]
Improve raw_ostream so that you can "write" colors using operator<<

1. raw_ostream supports ANSI colors so that you can write messages to
the termina with colors. Previously, in order to change and reset
color, you had to call `changeColor` and `resetColor` functions,
respectively.

So, if you print out "error: " in red, for example, you had to do
something like this:

  OS.changeColor(raw_ostream::RED);
  OS << "error: ";
  OS.resetColor();

With this patch, you can write the same code as follows:

  OS << raw_ostream::RED << "error: " << raw_ostream::RESET;

2. Add a boolean flag to raw_ostream so that you can disable colored
output. If you disable colors, changeColor, operator<<(Color),
resetColor and other color-related functions have no effect.

Most LLVM tools automatically prints out messages using colors, and
you can disable it by passing a flag such as `--disable-colors`.
This new flag makes it easy to write code that works that way.

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

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

5 years ago[clang-format] Fix a bug that doesn't break braces before unions for Allman
Owen Pan [Fri, 2 Aug 2019 04:30:42 +0000 (04:30 +0000)]
[clang-format] Fix a bug that doesn't break braces before unions for Allman
Differential Revision: https://reviews.llvm.org/D65631

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

5 years ago[DirectoryWatcher] Relax assumption to prevent test flakiness
Jan Korous [Thu, 1 Aug 2019 23:24:30 +0000 (23:24 +0000)]
[DirectoryWatcher] Relax assumption to prevent test flakiness

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

5 years ago[PGO] Add PGO support at -O0 in the experimental new pass manager
Rong Xu [Thu, 1 Aug 2019 22:36:34 +0000 (22:36 +0000)]
[PGO] Add PGO support at -O0 in the experimental new pass manager

Add PGO support at -O0 in the experimental new pass manager to sync the
behavior of the legacy pass manager.

Also change the test of gcc-flag-compatibility.c for more complete test:
(1) change the match string to "profc" and "profd" to ensure the
    instrumentation is happening.
(2) add IR format proftext so that PGO use compilation is tested.

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

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

5 years agoFix Windows branch of FileManagerTest changes
Harlan Haskins [Thu, 1 Aug 2019 21:58:56 +0000 (21:58 +0000)]
Fix Windows branch of FileManagerTest changes

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

5 years agoFix use-after-move in ClangBasicTests
Harlan Haskins [Thu, 1 Aug 2019 21:50:16 +0000 (21:50 +0000)]
Fix use-after-move in ClangBasicTests

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

5 years ago[clang] Adopt new FileManager error-returning APIs
Harlan Haskins [Thu, 1 Aug 2019 21:31:56 +0000 (21:31 +0000)]
[clang] Adopt new FileManager error-returning APIs

Update the callers of FileManager::getFile and FileManager::getDirectory to handle the new llvm::ErrorOr-returning methods.

Signed-off-by: Harlan Haskins <harlan@apple.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367616 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] Adopt llvm::ErrorOr in FileManager methods
Harlan Haskins [Thu, 1 Aug 2019 21:31:49 +0000 (21:31 +0000)]
[clang] Adopt llvm::ErrorOr in FileManager methods

Previously, the FileManager would use NULL returns to signify whether a file existed, but that doesn’t cover permissions issues or anything else that might occur while trying to stat or read a file. Instead, convert getFile and getDirectory into returning llvm::ErrorOr

Signed-off-by: Harlan Haskins <harlan@apple.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367615 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenMP] Fix declare target link implementation
Gheorghe-Teodor Bercea [Thu, 1 Aug 2019 21:15:58 +0000 (21:15 +0000)]
[OpenMP] Fix declare target link implementation

Summary:
This patch fixes the case where variables in different compilation units or the same compilation unit are under the declare target link clause AND have the same name.
This also fixes the name clash error that occurs when unified memory is activated.
The changes in this patch include:
- Pointers to internal variables are given unique names.
- Externally visible variables are given the same name as before.
- All pointer variables (external or internal) are weakly linked.

Reviewers: ABataev, jdoerfert, caomhin

Reviewed By: ABataev

Subscribers: lebedev.ri, guansong, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] StackFrameContext: Add NodeBuilderContext::blockCount() to its profile
Csaba Dabis [Thu, 1 Aug 2019 20:41:13 +0000 (20:41 +0000)]
[analyzer] StackFrameContext: Add NodeBuilderContext::blockCount() to its profile

Summary:
It allows discriminating between stack frames of the same call that is
called multiple times in a loop.

Thanks to Artem Dergachev for the great idea!

Reviewed By: NoQ

Tags: #clang

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

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

5 years agoTest linux only for absolute paths in the -fuse-ld option
Yuanfang Chen [Thu, 1 Aug 2019 18:49:59 +0000 (18:49 +0000)]
Test linux only for absolute paths in the -fuse-ld option

Some target do not use this option and may emit a error message for
using it.

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

5 years ago[Parser] Use special definition for pragma annotations
Serge Pavlov [Thu, 1 Aug 2019 15:15:10 +0000 (15:15 +0000)]
[Parser] Use special definition for pragma annotations

Previously pragma annotation tokens were described as any other
annotations in TokenKinds.def. This change introduces special macro
PRAGMA_ANNOTATION for the pragma descriptions. It allows implementing
checks that deal with pragma annotations only.

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

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

5 years agoRename two clang tests from .cc to .cpp.
Nico Weber [Thu, 1 Aug 2019 15:06:57 +0000 (15:06 +0000)]
Rename two clang tests from .cc to .cpp.

clang/test/lit.cfg.py doesn't list .cc as test extension, so these
tests never ran.

Tweak one of the two tests to actually pass, now that it runs.
(The other one was already passing.)

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

5 years agoAdd support for openSUSE RISC-V triple
Sam Elliott [Thu, 1 Aug 2019 14:23:56 +0000 (14:23 +0000)]
Add support for openSUSE RISC-V triple

Reviewers: asb

Reviewed By: asb

Subscribers: lenary, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lebedev.ri, kito-cheng, shiva0217, rogfer01, dexonsmith, rkruppe, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Patch by Andreas Schwab (schwab)

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

5 years ago[RISCV] Add FreeBSD targets
Sam Elliott [Thu, 1 Aug 2019 13:14:30 +0000 (13:14 +0000)]
[RISCV] Add FreeBSD targets

Reviewers: asb

Reviewed By: asb

Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits

Tags: #clang

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

Patch by James Clarke (jrtc27)

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

5 years ago[Parser] Change parameter type from int to enum
Serge Pavlov [Thu, 1 Aug 2019 11:46:28 +0000 (11:46 +0000)]
[Parser] Change parameter type from int to enum

Some parser functions accept argument of type unsigned while it is
actually of type DeclSpec::TST. No functional changes.

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

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

5 years ago[Preprocessor] Always discard body of #define if we failed to parse it
Ilya Biryukov [Thu, 1 Aug 2019 09:10:37 +0000 (09:10 +0000)]
[Preprocessor] Always discard body of #define if we failed to parse it

Summary:
Preivously we would only discard it if we failed to parse parameter lists.
If we do not consume the body, parser sees tokens inside directive. In
turn, this leads to spurious diagnostics and a crash in TokenBuffer, see
the added tests.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoDelay emitting dllexport explicitly defaulted members until the class is fully parsed...
Hans Wennborg [Thu, 1 Aug 2019 08:01:09 +0000 (08:01 +0000)]
Delay emitting dllexport explicitly defaulted members until the class is fully parsed (PR40006)

This is similar to r245139, but that only addressed dllexported classes.
It was still possible to run into the same problem with dllexported
members in an otherwise normal class (see bug). This uses the same
strategy to fix: delay defining the method until the whole class has
been parsed.

(The easiest way to see the ordering problem is in
Parser::ParseCXXMemberSpecification(): it calls
ParseLexedMemberInitializers() *after* ActOnFinishCXXMemberDecls(),
which was trying to define the dllexport method. Now we delay it to
ActOnFinishCXXNonNestedClass() which is called after both of those.)

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

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

5 years ago[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision...
Ziang Wan [Thu, 1 Aug 2019 01:39:21 +0000 (01:39 +0000)]
[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

Fix one test case for it to be system-independent.

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

5 years ago[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision...
Ziang Wan [Thu, 1 Aug 2019 00:16:43 +0000 (00:16 +0000)]
[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

Issue an warning when the code tries to do an implicit int -> float
conversion, where the float type ha a narrower significant than the
float type.

The new warning is controlled by flag -Wimplicit-int-float-conversion,
under -Wimplicit-float-conversion and -Wconversion. It is also silenced
when c++11 narrowing warning is issued.

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

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

5 years ago[clang][ARM] Fix msvc arm{64} builtins to use int on LP64 systems.
Michael J. Spencer [Wed, 31 Jul 2019 20:42:28 +0000 (20:42 +0000)]
[clang][ARM] Fix msvc arm{64} builtins to use int on LP64 systems.

The `InterlockedX_{acq,nf,rel}` functions deal with 32 bits which is long on
MSVC, but int on most other systems.

This also checks that `ReadStatusRegister` and `WriteStatusRegister` have
the correct type on aarch64-darwin.

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

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

5 years ago[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.
Puyan Lotfi [Wed, 31 Jul 2019 20:40:08 +0000 (20:40 +0000)]
[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.

Second landing attempt: Changed TY_ObjCXXHeader to TY_PP_ObjCXXHeader to fix
                        -xobjective-c++-header. This time I verified against
                        preprocessor output.

Dropping the 'u' entry and the entire Flags table from Types.def.
Now it'll be a bit easier to tablegenify this.

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

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

5 years ago[InstCombine] canonicalize fneg before fmul/fdiv
Sanjay Patel [Wed, 31 Jul 2019 16:53:22 +0000 (16:53 +0000)]
[InstCombine] canonicalize fneg before fmul/fdiv

Reverse the canonicalization of fneg relative to fmul/fdiv. That makes it
easier to implement the transforms (and possibly other fneg transforms) in
1 place because we can always start the pattern match from fneg (either the
legacy binop or the new unop).

There's a secondary practical benefit seen in PR21914 and PR42681:
https://bugs.llvm.org/show_bug.cgi?id=21914
https://bugs.llvm.org/show_bug.cgi?id=42681
...hoisting fneg rather than sinking seems to play nicer with LICM in IR
(although this change may expose analysis holes in the other direction).

1. The instcombine test changes show the expected neutral IR diffs from
   reversing the order.

2. The reassociation tests show that we were missing an optimization
   opportunity to fold away fneg-of-fneg. My reading of IEEE-754 says
   that all of these transforms are allowed (regardless of binop/unop
   fneg version) because:

   "For all other operations [besides copy/abs/negate/copysign], this
   standard does not specify the sign bit of a NaN result."
   In all of these transforms, we always have some other binop
   (fadd/fsub/fmul/fdiv), so we are free to flip the sign bit of a
   potential intermediate NaN operand.
   (If that interpretation is wrong, then we must already have a bug in
   the existing transforms?)

3. The clang tests shouldn't exist as-is, but that's effectively a
   revert of rL367149 (the test broke with an extension of the
   pre-existing fneg canonicalization in rL367146).

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

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

5 years agoAMDGPU: Add missing builtin declarations
Matt Arsenault [Wed, 31 Jul 2019 14:03:05 +0000 (14:03 +0000)]
AMDGPU: Add missing builtin declarations

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

5 years ago[AArch64] Add support for Transactional Memory Extension (TME)
Momchil Velikov [Wed, 31 Jul 2019 12:52:17 +0000 (12:52 +0000)]
[AArch64] Add support for Transactional Memory Extension (TME)

Re-commit r366322 after some fixes

TME is a future architecture technology, documented in

  https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools
  https://developer.arm.com/docs/ddi0601/a

More about the future architectures:

  https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/new-technologies-for-the-arm-a-profile-architecture

This patch adds support for the TME instructions TSTART, TTEST, TCOMMIT, and
TCANCEL and the target feature/arch extension "tme".

It also implements TME builtin functions, defined in ACLE Q2 2019
(https://developer.arm.com/docs/101028/latest)

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

Patch by Javed Absar and Momchil Velikov

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

5 years ago[RISCV] Support 'f' Inline Assembly Constraint
Sam Elliott [Wed, 31 Jul 2019 09:45:55 +0000 (09:45 +0000)]
[RISCV] Support 'f' Inline Assembly Constraint

Summary:
This adds the 'f' inline assembly constraint, as supported by GCC. An
'f'-constrained operand is passed in a floating point register. Exactly
which kind of floating-point register (32-bit or 64-bit) is decided
based on the operand type and the available standard extensions (-f and
-d, respectively).

This patch adds support in both the clang frontend, and LLVM itself.

Reviewers: asb, lewis-revill

Reviewed By: asb

Subscribers: hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[RISCV] Add support for floating point registers in inlineasm
Simon Cook [Wed, 31 Jul 2019 09:12:00 +0000 (09:12 +0000)]
[RISCV] Add support for floating point registers in inlineasm

This adds support for parsing/emitting in IR the floating-point RISC-V
registers in inline assembly clobber lists.

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

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

5 years ago[Fix] Customize warnings for missing built-in types
Johannes Doerfert [Wed, 31 Jul 2019 05:16:38 +0000 (05:16 +0000)]
[Fix] Customize warnings for missing built-in types

If we detect a built-in declaration for which we cannot derive a type
matching the pattern in the Builtins.def file, we currently emit a
warning that the respective header is needed. However, this is not
necessarily the behavior we want as it has no connection to the location
of the declaration (which can actually be in the header in question).
Instead, this warning is generated
  - if we could not build the type for the pattern on file (for some
    reason). Here we should make the reason explicit. The actual problem
    is otherwise circumvented as the warning is misleading, see [0] for
    an example.
  - if we could not build the type for the pattern because we do not
    have a type on record, possible since D55483, we should not emit any
    warning. See [1] for a legitimate problem.

This patch address both cases. For the "setjmp" family a new warning is
introduced and for built-ins without type on record, so far
"pthread_create", we do not emit the warning anymore.

Also see: PR40692

[0] https://lkml.org/lkml/2019/1/11/718
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235583

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

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

5 years ago[NFC] Remove LLVM_ALIGNAS
JF Bastien [Wed, 31 Jul 2019 03:22:08 +0000 (03:22 +0000)]
[NFC] Remove LLVM_ALIGNAS

Summary: The minimum compilers support all have alignas, and we don't use LLVM_ALIGNAS anywhere anymore. This also removes an MSVC diagnostic which, according to the comment above, isn't relevant anymore.

Reviewers: rnk

Subscribers: mgorny, jkorous, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoNFCI, optimize layout of FileEntry
Alex Lorenz [Wed, 31 Jul 2019 00:12:00 +0000 (00:12 +0000)]
NFCI, optimize layout of FileEntry

The reordering of the UID field makes the size of a
FileEntry 8 bytes smaller on 64bit platforms.

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

5 years ago[Sema] Actually map a variable template specialization from pattern to instantiation
Erik Pilkington [Tue, 30 Jul 2019 23:38:18 +0000 (23:38 +0000)]
[Sema] Actually map a variable template specialization from pattern to instantiation

We were previously just using a specialization in the class template instead of
creating a new specialization in the class instantiation.

Fixes llvm.org/PR42779.

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

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

5 years agoRevert "[NFC][clang] Refactor getCompilationPhases()+Types.def step 3."
Sam McCall [Tue, 30 Jul 2019 20:38:11 +0000 (20:38 +0000)]
Revert "[NFC][clang] Refactor getCompilationPhases()+Types.def step 3."

This reverts commit d2254dbf21a3243233b75294ef901086199df1b9.
This (unintentionally?) changed behavior, disallowing e.g. -x objective-c++-header

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

5 years ago[Driver] Support -fsanitize=function on Solaris/x86
Rainer Orth [Tue, 30 Jul 2019 20:04:53 +0000 (20:04 +0000)]
[Driver] Support -fsanitize=function on Solaris/x86

UBSan-Standalone-x86_64 :: TestCases/TypeCheck/Function/function.cpp currently
FAILs on Solaris/x86_64:

  clang-9: error: unsupported option '-fsanitize=function' for target 'x86_64-pc-solaris2.11'

AFAICS, there's nothing more to do then enable that sanitizer in the driver (for x86 only),
which is what this patch does, together with updating another testcase.

Tested on x86_64-pc-solaris2.11.

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

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

5 years ago[NFC] simplify Darwin environment handling
JF Bastien [Tue, 30 Jul 2019 20:01:46 +0000 (20:01 +0000)]
[NFC] simplify Darwin environment handling

The previous code detected conflicts through copy-pasta, this versions
uses a 'loop'.

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

5 years ago[Parser] Lambda capture lists can start with '*'
Erik Pilkington [Tue, 30 Jul 2019 19:21:20 +0000 (19:21 +0000)]
[Parser] Lambda capture lists can start with '*'

Fixes llvm.org/PR42778

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

5 years ago[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.
Puyan Lotfi [Tue, 30 Jul 2019 19:03:17 +0000 (19:03 +0000)]
[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.

Dropping the 'u' entry and the entire Flags table from Types.def.
Now it'll be a bit easier to tablegenify this.

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

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

5 years agoRemove cache for macro arg stringization
Reid Kleckner [Tue, 30 Jul 2019 17:58:22 +0000 (17:58 +0000)]
Remove cache for macro arg stringization

Summary:
The cache recorded the wrong expansion location for all but the first
stringization. It seems uncommon to stringize the same macro argument
multiple times, so this cache doesn't seem that important.

Fixes PR39942

Reviewers: vsk, rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[COFF][ARM64] Reorder handling of aarch64 MSVC builtins
David Major [Tue, 30 Jul 2019 15:32:49 +0000 (15:32 +0000)]
[COFF][ARM64] Reorder handling of aarch64 MSVC builtins

In `CodeGenFunction::EmitAArch64BuiltinExpr()`, bulk move all of the aarch64 MSVC-builtin cases to an earlier point in the function (the `// Handle non-overloaded intrinsics first` switch block) in order to avoid an unreachable in `GetNeonType()`. The NEON type-overloading logic is not appropriate for the Windows builtins.

Fixes https://llvm.org/pr42775

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

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

5 years agoAdd typedef declaration information to the JSON AST dump.
Aaron Ballman [Tue, 30 Jul 2019 13:42:19 +0000 (13:42 +0000)]
Add typedef declaration information to the JSON AST dump.

When dumping a desugared QualType and the type is a type alias, also print out the id for the type alias declaration.

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

5 years ago[Driver] Define _FILE_OFFSET_BITS=64 on Solaris
Rainer Orth [Tue, 30 Jul 2019 10:38:41 +0000 (10:38 +0000)]
[Driver] Define _FILE_OFFSET_BITS=64 on Solaris

make check-all currently fails on x86_64-pc-solaris2.11 when building with GCC 9:

  Undefined                       first referenced
   symbol                             in file
  _ZN11__sanitizer14internal_lseekEimi SANITIZER_TEST_OBJECTS.sanitizer_libc_test.cc.i386.o
  _ZN11__sanitizer23MapWritableFileToMemoryEPvmim SANITIZER_TEST_OBJECTS.sanitizer_libc_test.cc.i386.o
  ld: fatal: symbol referencing errors
  clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
  make[3]: *** [projects/compiler-rt/lib/sanitizer_common/tests/CMakeFiles/TSanitizer-i386-Test.dir/build.make:92: projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-i386-Test] Error 1

While e.g. __sanitizer::internal_lseek is defined in sanitizer_solaris.cc, g++ 9
predefines _FILE_OFFSET_BITS=64 while clang++ currently does not.

This patch resolves this inconsistency by following the gcc lead, which allows
make check-all to finish successfully.

There's one caveat: gcc defines _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE for C++ only, while clang has long been doing it for
all languages.  I'd like to keep it this way because those macros do is to make
declarations of fseek/ftello (_LARGEFILE_SOURCE) resp. the 64-bit versions
of largefile functions (*64 with _LARGEFILE64_SOURCE) visible additionally.
However, _FILE_OFFSET_BITS=64 changes all affected functions to be largefile-aware.
I'd like to restrict this to C++, just like gcc does.

To avoid a similar inconsistence with host compilers that don't predefine _FILE_OFFSET_BITS=64
(e.g. clang < 9, gcc < 9), this needs a compantion patch https://reviews.llvm.org/D64483.

Tested on x86_64-pc-solaris2.11.

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

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

5 years ago[AArch64] Disable __ARM_FEATURE_SVE without ACLE.
Sander de Smalen [Tue, 30 Jul 2019 10:14:39 +0000 (10:14 +0000)]
[AArch64] Disable __ARM_FEATURE_SVE without ACLE.

The Arm C Language Extensions for SVE document specifies that
__ARM_FEATURE_SVE should be set when the compiler supports SVE and
implements all the extensions described in the document.

This is currently not yet the case, so the feature should be disabled
until the compiler can provide all the extensions as described.

Reviewers: c-rhodes, rengolin, rovka, ktkachov

Reviewed By: rengolin

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

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

5 years ago[PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers
Qiu Chaofan [Tue, 30 Jul 2019 02:18:11 +0000 (02:18 +0000)]
[PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers

Move the platform check out of PPC Linux toolchain code and add platform guards
to the intrinsic headers, since they are supported currently only on 64-bit
PowerPC targets.

Reviewed By: Jinsong Ji

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

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

5 years agoFix Linux build
JF Bastien [Mon, 29 Jul 2019 23:28:44 +0000 (23:28 +0000)]
Fix Linux build

r367274 broke it

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

5 years ago[NFC] avoid AlignedCharArray in clang
JF Bastien [Mon, 29 Jul 2019 23:12:48 +0000 (23:12 +0000)]
[NFC] avoid AlignedCharArray in clang

As discussed in D65249, don't use AlignedCharArray or std::aligned_storage. Just use alignas(X) char Buf[Size];. This will allow me to remove AlignedCharArray entirely, and works on the current minimum version of Visual Studio.

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

5 years ago[DependencyCollector] Make maybeAddDependency virtual (NFC)
Jonas Devlieghere [Mon, 29 Jul 2019 23:02:11 +0000 (23:02 +0000)]
[DependencyCollector] Make maybeAddDependency virtual (NFC)

Make DependencyCollector::maybeAddDependency, just like its other
methods, which I made virtual a while ago. The motivation for this
change is still the LLDB reproducer.

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

5 years ago[docs] Add a note about where UBSan emits logs
Vedant Kumar [Mon, 29 Jul 2019 22:54:43 +0000 (22:54 +0000)]
[docs] Add a note about where UBSan emits logs

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

5 years ago[DebugInfo] Don't emit incorrect descriptions of thunk params (PR42627)
Vedant Kumar [Mon, 29 Jul 2019 22:49:55 +0000 (22:49 +0000)]
[DebugInfo] Don't emit incorrect descriptions of thunk params (PR42627)

The `this` parameter of a thunk requires adjustment. Stop emitting an
incorrect dbg.declare pointing to the unadjusted pointer.

We could describe the adjusted value instead, but there may not be much
benefit in doing so as users tend not to debug thunks.

Robert O'Callahan reports that this matches gcc's behavior.

Fixes PR42627.

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

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

5 years ago[driver][test] Use /dev/null in as-options.s instead
Jordan Rupprecht [Mon, 29 Jul 2019 20:09:20 +0000 (20:09 +0000)]
[driver][test] Use /dev/null in as-options.s instead

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

5 years agoGive the 'signed/unsigned wchar_t' extension a warning flag, and follow
Richard Smith [Mon, 29 Jul 2019 20:00:46 +0000 (20:00 +0000)]
Give the 'signed/unsigned wchar_t' extension a warning flag, and follow
GCC 9 in promoting it to an error by default.

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

5 years agoWhen determining whether a lambda-expression is implicitly constexpr,
Richard Smith [Mon, 29 Jul 2019 19:59:45 +0000 (19:59 +0000)]
When determining whether a lambda-expression is implicitly constexpr,
check the formal rules rather than seeing if the normal checks produce a
diagnostic.

This fixes the handling of C++2a extensions in lambdas in C++17 mode,
as well as some corner cases in earlier language modes where we issue
diagnostics for things other than not satisfying the formal constexpr
requirements.

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

5 years ago[driver][test] Update as-options.s to not write to a readonly tree
Jordan Rupprecht [Mon, 29 Jul 2019 19:57:31 +0000 (19:57 +0000)]
[driver][test] Update as-options.s to not write to a readonly tree

The as-options.s test writes to the build tree as of r367165. Some build systems configure this to be readonly, so this fails. Explicitly write to the output tree using `%t` to avoid this.

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

5 years agoFix taint-generic.c on Windows, handle case in OS error
Reid Kleckner [Mon, 29 Jul 2019 18:48:50 +0000 (18:48 +0000)]
Fix taint-generic.c on Windows, handle case in OS error

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

5 years ago[OpenCL] Rename builtin definition classes
Sven van Haastregt [Mon, 29 Jul 2019 14:55:29 +0000 (14:55 +0000)]
[OpenCL] Rename builtin definition classes

Factor out some of the renames from D63434 and D63442, and generate
half type convert_ builtins.

Patch by Pierre Gondois and Sven van Haastregt.

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

5 years agoclang-format clang/lib/Format
Nico Weber [Mon, 29 Jul 2019 13:26:48 +0000 (13:26 +0000)]
clang-format clang/lib/Format

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

5 years agodoc: Fix Google C++ Style Guide link.
Rafael Stahl [Mon, 29 Jul 2019 11:00:23 +0000 (11:00 +0000)]
doc: Fix Google C++ Style Guide link.

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