]> granicus.if.org Git - clang/log
clang
5 years ago[clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists"
Roman Lebedev [Wed, 6 Mar 2019 07:45:10 +0000 (07:45 +0000)]
[clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists"

Summary:
This reverts rL352390 / D57280.

As discussed in https://reviews.llvm.org/D57112#inline-506781,
'flush' clause does not exist in the OpenMP spec, it can not be
specified, and `OMPFlushClause` class is just a helper class.

Now, here's the caveat. I have read @ABataev's
> Well, I think it would be good to filter out OMPC_flush somehow
> because there is no such clause actually, it is a pseudo clause
> for better handling of the flush directive.
as if that clause is pseudo clause that only exists for the sole
purpose of simplifying the parser. As in, it never reaches AST.

I did not however try to verify that. Too bad, i was wrong.
It absolutely *does* reach AST. Therefore my understanding/justification
for the change was flawed, which makes the patch a regression which **must** be reverted.

@gribozavr has brought that up again in https://reviews.llvm.org/D57112#inline-521238

> > ...
> Sorry to be late for this discussion, but I don't think this conclusion
> follows. ASTMatchers are supposed to match the AST as it is.
> Even if OMPC_flush is synthetic, it exists in the AST, and users might
> want to match it. I think users would find anything else (trying to filter
> out AST nodes that are not in the source code) to be surprising. For example,
> there's a matcher materializeTemporaryExpr even though this AST node is a
> Clang invention and is not a part of the C++ spec.
>
> Matching only constructs that appear in the source code is not feasible with
> ASTMatchers, because they are based on Clang's AST that exposes tons of semantic
> information, and its design is dictated by the structure of the semantic information.
> See "RFC: Tree-based refactorings with Clang" in cfe-dev for a library that will
> focus on representing source code as faithfully as possible.
>
> Not to even mention that this code is in ASTTypeTraits, a general library for
> handling AST nodes, not specifically for AST Matchers...

Reviewers: gribozavr, ABataev, rjmccall, aaron.ballman

Reviewed By: gribozavr, ABataev

Subscribers: dylanmckay, guansong, arphaman, jdoerfert, cfe-commits, gribozavr, ABataev

Tags: #clang, #openmp

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

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

5 years agoFix slashes in path references in -Rmodule-import test from r355477
Duncan P. N. Exon Smith [Wed, 6 Mar 2019 05:42:56 +0000 (05:42 +0000)]
Fix slashes in path references in -Rmodule-import test from r355477

Fixup for r355477 to fix the Windows bot:
  http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/16217

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

5 years agoModules: Add -Rmodule-import
Duncan P. N. Exon Smith [Wed, 6 Mar 2019 02:50:46 +0000 (02:50 +0000)]
Modules: Add -Rmodule-import

Add a remark for importing modules.  Depending on whether this is a
direct import (into the TU being built by this compiler instance) or
transitive import (into an already-imported module), the diagnostic has
two forms:

    importing module 'Foo' from 'path/to/Foo.pcm'
    importing module 'Foo' into 'Bar' from 'path/to/Foo.pcm'

Also drop a redundant FileCheck invocation in Rmodule-build.m that was
using -Reverything, since the notes from -Rmodule-import were confusing
it.

https://reviews.llvm.org/D58891

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

5 years ago[Fixed Point Arithmetic] Fixed Point and Integer Conversions
Leonard Chan [Wed, 6 Mar 2019 00:28:43 +0000 (00:28 +0000)]
[Fixed Point Arithmetic] Fixed Point and Integer Conversions

This patch includes the necessary code for converting between a fixed point type and integer.
This also includes constant expression evaluation for conversions with these types.

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

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

5 years agoRevert r355432 for buildbot failures in ppc64be-linux and s390x-linux
Rong Xu [Tue, 5 Mar 2019 23:02:06 +0000 (23:02 +0000)]
Revert r355432 for buildbot failures in ppc64be-linux and s390x-linux

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

5 years ago[clang-format] broken after lambda with return type template with boolean literal
Paul Hoad [Tue, 5 Mar 2019 22:20:25 +0000 (22:20 +0000)]
[clang-format] broken after lambda with return type template with boolean literal

Summary:
A Lamdba with a return type template with a boolean literal (true,false) behaves differently to an integer literal

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

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, jkorous

Reviewed By: jkorous

Subscribers: jkorous, cfe-commits

Tags: #clang-tools-extra

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

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

5 years ago[docs] Add some architectures into the list of supported ThreadSanitizer platforms
Vitaly Buka [Tue, 5 Mar 2019 21:10:42 +0000 (21:10 +0000)]
[docs] Add some architectures into the list of supported ThreadSanitizer platforms

Some platforms for which TSAN has build rules are omitted for the lack of
known build bots.

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

5 years ago[docs] Update the list of ThreadSanitizer supported OSes
Vitaly Buka [Tue, 5 Mar 2019 20:53:34 +0000 (20:53 +0000)]
[docs] Update the list of ThreadSanitizer supported OSes

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

5 years ago[cmake] Add libRemarks to LLVM_DISTRIBUTION_COMPONENTS
Francis Visoiu Mistrih [Tue, 5 Mar 2019 20:47:34 +0000 (20:47 +0000)]
[cmake] Add libRemarks to LLVM_DISTRIBUTION_COMPONENTS

Add this in the Apple-stage2.cmake to ship the remark tooling library
with the compiler.

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

5 years ago[clang-format] Fix lambdas returning template specialization that contains operator...
Jan Korous [Tue, 5 Mar 2019 19:27:24 +0000 (19:27 +0000)]
[clang-format] Fix lambdas returning template specialization that contains operator in parameter

A template specialization of a template foo<int N> can contain integer constants and a whole bunch of operators - e. g.  foo< 1 ? !0 : (3+1)%4 >

Inspired by https://reviews.llvm.org/D58922

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

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

5 years ago[PGO] Clang part of change for context-sensitive PGO (part2)
Rong Xu [Tue, 5 Mar 2019 19:09:56 +0000 (19:09 +0000)]
[PGO] Clang part of change for context-sensitive PGO (part2)

Part 2 of CSPGO change in Clang: Add test cases.

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

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

5 years ago[CUDA][HIP][Sema] Fix template kernel with function as template parameter
Yaxun Liu [Tue, 5 Mar 2019 18:19:35 +0000 (18:19 +0000)]
[CUDA][HIP][Sema] Fix template kernel with function as template parameter

If a kernel template has a function as its template parameter, a device function should be
allowed as template argument since a kernel can call a device function. However,
currently if the kernel template is instantiated in a host function, clang will emit an error
message saying the device function is an invalid candidate for the template parameter.

This happens because clang checks the reference to the device function during parsing
the template arguments. At this point, the template is not instantiated yet. Clang incorrectly
assumes the device function is called by the host function and emits the error message.

This patch fixes the issue by disabling checking of device function during parsing template
arguments and deferring the check to the instantion of the template. At that point, the
template decl is already available, therefore the check can be done against the instantiated
function template decl.

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

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

5 years agoAllow bundle size to be 0 in clang-offload-bundler
Yaxun Liu [Tue, 5 Mar 2019 17:52:32 +0000 (17:52 +0000)]
Allow bundle size to be 0 in clang-offload-bundler

HIP uses clang-offload-bundler to create fat binary. The bundle for host is empty.
Currently clang-offload-bundler checks if the bundle size is 0 when unbundling.
If so it will exit without unbundling the remaining bundles. This causes
clang-offload-bundler not being able to unbundle fat binaries generated for HIP.

This patch allows bundles size to be 0 when clang-offload-bundler unbundles
input files.

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

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

5 years ago[OPENMP]Target region: emit const firstprivates as globals with constant
Alexey Bataev [Tue, 5 Mar 2019 17:47:18 +0000 (17:47 +0000)]
[OPENMP]Target region: emit const firstprivates as globals with constant
memory.

If the variable with the constant non-scalar type is firstprivatized in
the target region, the local copy is created with the data copying.
Instead, we allocate the copy in the constant memory and avoid extra
copying in the outlined target regions. This global copy is used in the
target regions without loss of the performance.

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

5 years ago[HIP] Do not unbundle object files for -fno-gpu-rdc
Yaxun Liu [Tue, 5 Mar 2019 16:07:56 +0000 (16:07 +0000)]
[HIP] Do not unbundle object files for -fno-gpu-rdc

When -fno-gpu-rdc is set, device code is compiled, linked, and assembled into fat binary
and embedded as string in object files. The object files are normal object files which
can be linked by host linker. In the linking stage, the object files should not be unbundled
when -fno-gpu-rdc is set since they are normal object files, not bundles. The object files
only need to be unbundled when -fgpu-rdc is set.

Currently clang always unbundles object files, disregarding -fgpu-rdc option.

This patch fixes that.

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

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

5 years ago[analyzer] Fix taint propagation in GenericTaintChecker
Kristof Umann [Tue, 5 Mar 2019 12:42:59 +0000 (12:42 +0000)]
[analyzer] Fix taint propagation in GenericTaintChecker

The gets function has no SrcArgs. Because the default value for isTainted was
false, it didn't mark its DstArgs as tainted.

Patch by Gábor Borsik!

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

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

5 years ago[ASTMatchers] Improved formatting in a documentation comment
Dmitri Gribenko [Tue, 5 Mar 2019 12:38:18 +0000 (12:38 +0000)]
[ASTMatchers] Improved formatting in a documentation comment

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

5 years ago[ASTImporter] Fix redecl failures of Class and ClassTemplate
Gabor Marton [Tue, 5 Mar 2019 11:23:24 +0000 (11:23 +0000)]
[ASTImporter] Fix redecl failures of Class and ClassTemplate

Summary:
Redecl chains of classes and class templates are not handled well
currently. We want to handle them similarly to functions, i.e. try to
keep the structure of the original AST as much as possible. The aim is
to not squash a prototype with a definition, rather we create both and
put them in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years agoReplace clang::FileData with llvm::vfs::Status
Harlan Haskins [Tue, 5 Mar 2019 02:27:12 +0000 (02:27 +0000)]
Replace clang::FileData with llvm::vfs::Status

Summary:
FileData was only ever used as a container for the values in
llvm::vfs::Status, so they might as well be consolidated.

The `InPCH` member was also always set to false, and unused.

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang-format][docs][NFC] Fix example for Allman brace breaking style
Jan Korous [Tue, 5 Mar 2019 01:45:31 +0000 (01:45 +0000)]
[clang-format][docs][NFC] Fix example for Allman brace breaking style

I assume the example is wrong as it's clearly missing line-breaks before
braces.

I just ran the example through clang-format with .clang-format like
this:
BreakBeforeBraces: Allman

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

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

5 years ago[cmake] Create exports for umbrella library targets
Shoaib Meenai [Tue, 5 Mar 2019 00:38:32 +0000 (00:38 +0000)]
[cmake] Create exports for umbrella library targets

When using the umbrella llvm-libraries and clang-libraries targets, we
should export all library targets, otherwise they'll be part of our
distribution but not usable from the CMake package.

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

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

5 years ago[build] Rename clang-headers to clang-resource-headers
Shoaib Meenai [Mon, 4 Mar 2019 21:19:53 +0000 (21:19 +0000)]
[build] Rename clang-headers to clang-resource-headers

Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].

I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html

Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille

Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #lldb, #openmp, #llvm

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

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

5 years agoOrder File Instrumentation: add clang support for -forder-file-instrumentation
Manman Ren [Mon, 4 Mar 2019 20:30:30 +0000 (20:30 +0000)]
Order File Instrumentation: add clang support for -forder-file-instrumentation

When -forder-file-instrumentation is on, we pass llvm flag to enable the order file instrumentation pass.

https://reviews.llvm.org/D58751

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

5 years ago[ASTImporter] Handle built-in when importing SourceLocation and FileID
Shafik Yaghmour [Mon, 4 Mar 2019 20:25:54 +0000 (20:25 +0000)]
[ASTImporter] Handle built-in when importing SourceLocation and FileID

Summary:
Currently when we see a built-in we try and import the include location. Instead what we do now is find the buffer like we do for the invalid case and copy that over to the to context.

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

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

5 years ago[PGO] Clang part of change for context-sensitive PGO (part1)
Rong Xu [Mon, 4 Mar 2019 20:21:31 +0000 (20:21 +0000)]
[PGO] Clang part of change for context-sensitive PGO (part1)

Part 1 of CSPGO change in Clang. This includes changes in clang options
and calls to llvm PassManager. Tests will be committed in part2.
This change needs the PassManager change in llvm.

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

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

5 years agoEnable _rotl, _lrotl, _rotr, _lrotr on all platforms.
Erich Keane [Mon, 4 Mar 2019 18:47:21 +0000 (18:47 +0000)]
Enable _rotl, _lrotl, _rotr, _lrotr on all platforms.

The above builtins are currently implemented for MSVC mode, however GCC
also implements these.  This patch enables them for all platforms.

Additionally, this corrects the type for these builtins to always be
'long int' to match the specification in the Intel Intrinsics Guide.

Change-Id: Ida34be98078709584ef5136c8761783435ec02b1

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

5 years agoGive builtins and alloc/dealloc operators the default calling convention.
Erich Keane [Mon, 4 Mar 2019 14:54:52 +0000 (14:54 +0000)]
Give builtins and alloc/dealloc operators the default calling convention.

On SPIR targets, the default calling convention is SpirFunction.
However, operator new/delete and builtins were being created with CC_C.
The result is indirect references to new/delete (or builtins that are permitted
to be called indirectly have a mismatched type, as well as questionable codegen
in some cases.

This patch sets both to the default calling convention, so that it
properly matches the calling convention of the target.

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

Change-Id: I52065bb00bc2655945caea8f29c409ba1e0ac24a

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

5 years ago[analyzer] Enable subcheckers to possess checker options
Kristof Umann [Mon, 4 Mar 2019 00:28:16 +0000 (00:28 +0000)]
[analyzer] Enable subcheckers to possess checker options

Under the term "subchecker", I mean checkers that do not have a checker class on
their own, like unix.MallocChecker to unix.DynamicMemoryModeling.

Since a checker object was required in order to retrieve checker options,
subcheckers couldn't possess options on their own.

This patch is also an excuse to change the argument order of getChecker*Option,
it always bothered me, now it resembles the actual command line argument
(checkername:option=value).

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

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

5 years agoModules: Document that ReadASTCore exits its final loop via `return`, NFC
Duncan P. N. Exon Smith [Sun, 3 Mar 2019 20:17:53 +0000 (20:17 +0000)]
Modules: Document that ReadASTCore exits its final loop via `return`, NFC

The final loop never breaks.  Document that by following it with
llvm_unreachable.

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

5 years ago[clang] [ToolChains/NetBSD] Support relative libc++ header path
Michal Gorny [Sun, 3 Mar 2019 10:06:34 +0000 (10:06 +0000)]
[clang] [ToolChains/NetBSD] Support relative libc++ header path

Support locating the libc++ header files relatively to the clang
executable, in addition to the default system path.  This is meant
to cover two use cases: running just-built clang from the install
directory, and running installed clang from non-standard location
(e.g. /usr/local).

This is the first step towards ensuring that tests of more LLVM projects
can work out-of-the-box within the build tree, and use the correct set
of headers (rather than e.g. mixing just-built clang+libcxx with system
install of libcxx).  It avoids requiring the user to hack around missing
include paths, or LLVM build system to replicate system-specific C++
library defaults in order to append appropriate paths implicitly.

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

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

5 years agoTweak r355278 for compatibility with gcc 6 and earlier.
James Y Knight [Sat, 2 Mar 2019 21:55:36 +0000 (21:55 +0000)]
Tweak r355278 for compatibility with gcc 6 and earlier.

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

5 years agoTweak r355278 for compatibility with gcc 6 and earlier.
James Y Knight [Sat, 2 Mar 2019 21:20:30 +0000 (21:20 +0000)]
Tweak r355278 for compatibility with gcc 6 and earlier.

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

5 years agoMake the new SanitizerMask code added in r355190 constexpr.
James Y Knight [Sat, 2 Mar 2019 20:22:48 +0000 (20:22 +0000)]
Make the new SanitizerMask code added in r355190 constexpr.

Then, as a consequence, remove the complex set of workarounds for
initialization order -- which are apparently not 100% reliable.

The only downside is that some of the member functions are now
specific to kNumElem == 2, and will need to be updated if that
constant is increased in the future.

Unfortunately, the current code caused an initialization-order runtime
failure for me in some compilation modes. It appears that in a
toolchain without init-array enabled, the order of initialization of
static data members of a template can be reversed w.r.t. the order
within a file.

This caused e.g. SanitizerKind::CFI to be initialized to 0.

I'm not quite sure if that is an allowable ordering variation, or
nonconforming behavior, but in any case, making everything constexpr
eliminates the possibility of such an issue.

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

5 years ago[clang-format] clang-format off/on not respected when using C Style comments
Paul Hoad [Sat, 2 Mar 2019 09:08:51 +0000 (09:08 +0000)]
[clang-format] clang-format off/on not respected when using C Style comments

Summary:
If the clang-format on/off is in a /* comment */ then the sorting of headers is not ignored

PR40901 - https://bugs.llvm.org/show_bug.cgi?id=40901

Reviewers: djasper, klimek, JonasToth, krasimir, alexfh

Reviewed By: alexfh

Subscribers: alexfh, cfe-commits, llvm-commits

Tags: #clang, #clang-tools-extra

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

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

5 years agolib/Header: Simplify CMakeLists.txt
Tom Stellard [Sat, 2 Mar 2019 00:50:13 +0000 (00:50 +0000)]
lib/Header: Simplify CMakeLists.txt

Summary:
Replace cut and pasted code with cmake macros and reduce the number of
install commands.  This fixes an issue where the headers were being
installed twice.

This clean up should also make future modifications easier, like
adding a cmake option to install header files into a custom resource
directory.

Reviewers: chandlerc, smeenai, mgorny, beanz, phosek

Reviewed By: smeenai

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[WebAssembly] Temporarily disable bulk-memory with -pthread
Thomas Lively [Sat, 2 Mar 2019 00:18:09 +0000 (00:18 +0000)]
[WebAssembly] Temporarily disable bulk-memory with -pthread

Summary:
To prevent the instability of bulk-memory in the wasm backend from
blocking separate pthread testing, temporarily remove the logic that
adds -mbulk-memory in the presence of -pthread. Since browsers will
ship bulk memory before or alongside threads, this change will be
reverted as soon as bulk memory has stabilized in the backend.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, jfb, cfe-commits

Tags: #clang

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

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

5 years ago[DWARF] Make -g with empty assembler source work better.
Paul Robinson [Fri, 1 Mar 2019 20:58:04 +0000 (20:58 +0000)]
[DWARF] Make -g with empty assembler source work better.

This was sometimes causing clang or llvm-mc to crash, and in other
cases could emit a bogus DWARF line-table header. I did an interim
patch in r352541; this patch should be a cleaner and more complete
fix, and retains the test.

Addresses PR40538.

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

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

5 years ago[PGO] Use the explicit parameter in ProfileSummary API. NFC
Rong Xu [Fri, 1 Mar 2019 17:50:20 +0000 (17:50 +0000)]
[PGO] Use the explicit parameter in ProfileSummary API. NFC

Use the explicit parameter in setProfileSummary() and getSummary().
This is a follow-up of r355131.

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

5 years ago[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer...
Pierre Gousseau [Fri, 1 Mar 2019 10:05:15 +0000 (10:05 +0000)]
[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer checks, NFC.

enum SanitizerOrdinal has reached maximum capacity, this change extends the capacity to 128 sanitizer checks.
This can eventually allow us to add gcc 8's options "-fsanitize=pointer-substract" and "-fsanitize=pointer-compare".

This is a recommit of r354873 but with a fix for unqualified lookup error in lldb cmake build bot.

Fixes: https://llvm.org/PR39425
Differential Revision: https://reviews.llvm.org/D57914

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

5 years ago[clang-format] [NFC] clang-format the Format library
Paul Hoad [Fri, 1 Mar 2019 09:09:54 +0000 (09:09 +0000)]
[clang-format] [NFC] clang-format the Format library

Previously revisions commited non-clang-formatted changes to the Format library, this means submitting any revision e.g. {D55170} can cause additional whitespace changes to potentially be included in a revision.

Commit a non functional change using latest build Windows clang-format r351376 with no other changes, to remove these differences

All FormatTests
pass [==========] 652 tests from 20 test cases ran.

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

5 years agoCodeGen: Fix PR40605 by splitting constant struct initializers
Alexander Potapenko [Fri, 1 Mar 2019 09:00:41 +0000 (09:00 +0000)]
CodeGen: Fix PR40605 by splitting constant struct initializers

When emitting initializers for local structures for code built with
-ftrivial-auto-var-init, replace constant structures with sequences of
stores.

This appears to greatly help removing dead initialization stores to those
locals that are later overwritten by other data.
This also removes a lot of .rodata constants (see PR40605), replacing most
of them with immediate values (for Linux kernel the .rodata size is
reduced by ~1.9%)

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

5 years agoFix file headers. NFC
Fangrui Song [Fri, 1 Mar 2019 06:49:51 +0000 (06:49 +0000)]
Fix file headers. NFC

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

5 years ago[Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings by
Akira Hatanaka [Fri, 1 Mar 2019 06:43:20 +0000 (06:43 +0000)]
[Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings by
declaring an unavailable method in the subclass's extension that
overrides the designated initializer in the base class.

r243676 made changes to allow declaring the unavailable method in the
subclass interface to silence the warning. This commit additionally
allows declaring the unavailable method in the class extension.

rdar://problem/42731306

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

5 years ago[CodeGen] Fix calling llvm.var.annotation outside of a basic block.
Volodymyr Sapsai [Fri, 1 Mar 2019 02:15:39 +0000 (02:15 +0000)]
[CodeGen] Fix calling llvm.var.annotation outside of a basic block.

When we have an annotated local variable after a function returns, we
generate IR that fails verification with the error

> Instruction referencing instruction not embedded in a basic block!

And it means that bitcast referencing alloca doesn't have a parent basic
block.

Fix by checking if we are at an unreachable point and skip emitting
annotations. This approach is similar to the way we emit variable
initializer and debug info.

rdar://problem/46200420

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: aprantl, jkorous, dexonsmith, cfe-commits

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

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

5 years ago[clang-format][TableGen] Don't add spaces around items in square braces.
Jordan Rupprecht [Fri, 1 Mar 2019 00:12:18 +0000 (00:12 +0000)]
[clang-format][TableGen] Don't add spaces around items in square braces.

Summary:
clang-formatting wants to add spaces around items in square braces, e.g. [1, 2] -> [ 1, 2 ]. Based on a quick check [1], it seems like most cases are using the [1, 2] format, so make that the consistent one.

[1] in llvm `.td` files, the regex `\[[^ ]` (bracket followed by not-a-space) shows up ~400 times, but `\[\s[^ ]` (bracket followed by one space and one not-a-space) shows up ~40 times => ~90% uses this format.

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format][NFC] Allow getLLVMStyle() to take a language
Jordan Rupprecht [Thu, 28 Feb 2019 19:16:45 +0000 (19:16 +0000)]
[clang-format][NFC] Allow getLLVMStyle() to take a language

Summary:
getLLVMStyle() sets the default style, but doesn't take the language as a parameter, so can't set default parameters when they differ from C++. This change adds LanguageKind as an input to getLLVMStyle so that we can start doing that.

See D55964 as a motivation for this, where we want Tablegen to be formatted differently than C++.

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: jdoerfert, MyDeveloperDay, kristina, cfe-commits, arphaman

Tags: #clang

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

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

5 years ago[WebAssembly] Remove uses of ThreadModel
Thomas Lively [Thu, 28 Feb 2019 18:39:08 +0000 (18:39 +0000)]
[WebAssembly] Remove uses of ThreadModel

Summary:
In the clang UI, replaces -mthread-model posix with -matomics as the
source of truth on threading. In the backend, replaces
-thread-model=posix with the atomics target feature, which is now
collected on the WebAssemblyTargetMachine along with all other used
features. These collected features will also be used to emit the
target features section in the future.

The default configuration for the backend is thread-model=posix and no
atomics, which was previously an invalid configuration. This change
makes the default valid because the thread model is ignored.

A side effect of this change is that objects are never emitted with
passive segments. It will instead be up to the linker to decide
whether sections should be active or passive based on whether atomics
are used in the final link.

Reviewers: aheejin, sbc100, dschuff

Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, steven_wu, dexonsmith, rupprecht, jfb, jdoerfert, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoPartial revert of r353952: [HIP] Handle compile -m options and propagate into LLC
Yaxun Liu [Thu, 28 Feb 2019 17:08:26 +0000 (17:08 +0000)]
Partial revert of r353952: [HIP] Handle compile -m options and propagate into LLC

Remove comments and tests about passing -mcode-object-v3 to driver since it does
not work. Other -m options are OK.

Also put back -mattr=-code-object-v3 since HIP is still not ready for code object
v3.

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

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

5 years ago[CTU] Do not allow different CPP dialects in CTU
Gabor Marton [Thu, 28 Feb 2019 15:24:59 +0000 (15:24 +0000)]
[CTU] Do not allow different CPP dialects in CTU

Summary:
If CPP dialects are different then return with error.

Consider this STL code:
  template<typename _Alloc>
    struct __alloc_traits
  #if __cplusplus >= 201103L
    : std::allocator_traits<_Alloc>
  #endif
    { // ...
    };
This class template would create ODR errors during merging the two units,
since in one translation unit the class template has a base class, however
in the other unit it has none.

Reviewers: xazax.hun, a_sidorin, r.stahl

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

Tags: #clang

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

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

5 years ago[clang][index-while-building][NFC] Comment about implementation detail in FileIndexRecord
Jan Korous [Thu, 28 Feb 2019 01:12:27 +0000 (01:12 +0000)]
[clang][index-while-building][NFC] Comment about implementation detail in FileIndexRecord

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

5 years agoEnsure that set constrained asm operands are not affected by truncation.
Joerg Sonnenberger [Thu, 28 Feb 2019 00:55:09 +0000 (00:55 +0000)]
Ensure that set constrained asm operands are not affected by truncation.

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

5 years ago[CodeGen] Fix some broken IR generated by -fsanitize=unsigned-integer-overflow
Erik Pilkington [Thu, 28 Feb 2019 00:47:55 +0000 (00:47 +0000)]
[CodeGen] Fix some broken IR generated by -fsanitize=unsigned-integer-overflow

I think the author of the function assumed that `GetInsertBlock()`
wouldn't change from where `atomicPHI` was created, but this isn't
true when `-fsanitize=unsigned-integer-overflow` is enabled (we
generate an overflow/continuation label). Fix by keeping track of the
block we want to return to to complete the cmpxchg loop.

rdar://48406558

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

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

5 years ago[InstrProf] Use separate comdat group for data and counters
Reid Kleckner [Wed, 27 Feb 2019 23:38:44 +0000 (23:38 +0000)]
[InstrProf] Use separate comdat group for data and counters

Summary:
I hadn't realized that instrumentation runs before inlining, so we can't
use the function as the comdat group. Doing so can create relocations
against discarded sections when references to discarded __profc_
variables are inlined into functions outside the function's comdat
group.

In the future, perhaps we should consider standardizing the comdat group
names that ELF and COFF use. It will save object file size, since
__profv_$sym won't appear in the symbol table again.

Reviewers: xur, vsk

Subscribers: eraman, hiraditya, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

5 years ago[clang][index-while-building][NFC] FileIndexRecord - Comments, replace auto with...
Jan Korous [Wed, 27 Feb 2019 21:48:02 +0000 (21:48 +0000)]
[clang][index-while-building][NFC] FileIndexRecord - Comments, replace auto with type

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

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

5 years ago[clang][index-while-building] FileIndexRecord
Jan Korous [Wed, 27 Feb 2019 21:47:40 +0000 (21:47 +0000)]
[clang][index-while-building] FileIndexRecord

Basic data structures for index

Tests are missing from this patch - will be covered properly by tests for the whole feature.
I'm just trying to split into smaller patches to make it easier for reviewers.

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

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

5 years agoUse Secure PLT as default on NetBSD/PowerPC.
Joerg Sonnenberger [Wed, 27 Feb 2019 21:46:01 +0000 (21:46 +0000)]
Use Secure PLT as default on NetBSD/PowerPC.

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

5 years ago[OPENMP]Delay emission of the error for unsupported types.
Alexey Bataev [Wed, 27 Feb 2019 20:29:45 +0000 (20:29 +0000)]
[OPENMP]Delay emission of the error for unsupported types.

If the type is unsupported on the device side, it still must be emitted,
but we should emit errors for operations with such types.

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

5 years agoAdd triples to the test I committed in r355012 to fix windows bots.
Akira Hatanaka [Wed, 27 Feb 2019 18:59:52 +0000 (18:59 +0000)]
Add triples to the test I committed in r355012 to fix windows bots.

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

5 years agoAvoid needlessly copying a block to the heap when a block literal
Akira Hatanaka [Wed, 27 Feb 2019 18:17:16 +0000 (18:17 +0000)]
Avoid needlessly copying a block to the heap when a block literal
initializes a local auto variable or is assigned to a local auto
variable that is declared in the scope that introduced the block
literal.

rdar://problem/13289333

https://reviews.llvm.org/D58514

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

5 years agoSupport framework import/include auto-completion
David Goldman [Wed, 27 Feb 2019 17:40:33 +0000 (17:40 +0000)]
Support framework import/include auto-completion

Frameworks filesystem representations:
  UIKit.framework/Headers/%header%

Framework import format:
  #import <UIKit/%header%>

Thus the completion code must map the input format of <UIKit/> to
the path of UIKit.framework/Headers as well as strip the
".framework" suffix when auto-completing the framework name.

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

5 years ago[ASTImporter] Improve import of FileID.
Balazs Keri [Wed, 27 Feb 2019 16:31:48 +0000 (16:31 +0000)]
[ASTImporter] Improve import of FileID.

Summary:
Even if the content cache has a directory and filename, it may be a virtual file.
The old code returned with error in this case, but it is worth to try to handle
the file as it were a memory buffer.

Reviewers: a.sidorin, shafik, martong, a_sidorin

Reviewed By: shafik

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

Tags: #clang

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

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

5 years ago[NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on functio...
Yaxun Liu [Wed, 27 Feb 2019 15:46:29 +0000 (15:46 +0000)]
[NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on function target

Add comments and move a variable to if block.

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

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

5 years agoAttrDocs.td: fix broken bullet-point indentation
Hans Wennborg [Wed, 27 Feb 2019 13:11:37 +0000 (13:11 +0000)]
AttrDocs.td: fix broken bullet-point indentation

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

5 years ago[HIP] change kernel stub name
Yaxun Liu [Wed, 27 Feb 2019 02:02:52 +0000 (02:02 +0000)]
[HIP] change kernel stub name

Add .stub to kernel stub function name so that it is different from kernel
name in device code. This is necessary to let debugger find correct symbol
for kernel.

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

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

5 years ago[index] Fixup for r354942. Specify target in test to achieve stable mangling.
Volodymyr Sapsai [Wed, 27 Feb 2019 01:37:43 +0000 (01:37 +0000)]
[index] Fixup for r354942. Specify target in test to achieve stable mangling.

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

5 years ago[index] Improve indexing support for MSPropertyDecl.
Volodymyr Sapsai [Wed, 27 Feb 2019 01:04:53 +0000 (01:04 +0000)]
[index] Improve indexing support for MSPropertyDecl.

Currently the symbol for MSPropertyDecl has kind `SymbolKind::Unknown`
which can trip up various indexing tools.

rdar://problem/46764224

Reviewers: akyrtzi, benlangmuir, jkorous

Reviewed By: jkorous

Subscribers: dexonsmith, cfe-commits, jkorous, jdoerfert, arphaman

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

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

5 years agoFix inline assembler constraint validation
Joerg Sonnenberger [Wed, 27 Feb 2019 00:40:59 +0000 (00:40 +0000)]
Fix inline assembler constraint validation

The current constraint logic is both too lax and too strict. It fails
for input outside the [INT_MIN..INT_MAX] range, but it also implicitly
accepts 0 as value when it should not. Adjust logic to handle both
correctly.

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

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

5 years ago[CUDA][HIP] Check calling convention based on function target
Yaxun Liu [Tue, 26 Feb 2019 22:24:49 +0000 (22:24 +0000)]
[CUDA][HIP] Check calling convention based on function target

MSVC header files using vectorcall to differentiate overloaded functions, which
causes failure for AMDGPU target. This is because clang does not check function
calling convention based on function target.

This patch checks calling convention using the proper target info.

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

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

5 years ago[OPENMP][CUDA]Do not emit warnings for variables in late-reported asm
Alexey Bataev [Tue, 26 Feb 2019 21:51:16 +0000 (21:51 +0000)]
[OPENMP][CUDA]Do not emit warnings for variables in late-reported asm
statements.

If the assembler instruction is not generated and the delayed diagnostic
is emitted, we may end up with extra warning message for variables used
in the asm statement. Since the asm statement is not built, the
variables may be left non-referenced and it may produce a warning about
a use of the non-initialized variables.

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

5 years ago[OPENMP]Delay emission for unsupported va_arg expression.
Alexey Bataev [Tue, 26 Feb 2019 20:52:16 +0000 (20:52 +0000)]
[OPENMP]Delay emission for unsupported va_arg expression.

If the OpenMP device is NVPTX and va_arg is used, delay emission of the
error for va_arg unless it is used in the device code.

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

5 years ago[MS] Don't emit coverage for deleting dtors
Reid Kleckner [Tue, 26 Feb 2019 20:42:52 +0000 (20:42 +0000)]
[MS] Don't emit coverage for deleting dtors

Summary:
The MS C++ ABI has no constructor variants, but it has destructor
variants, so we should move the deleting destructor variant check
outside the check for "does the ABI have constructor variants".

Fixes PR37561, so basic code coverage works on Windows with C++.

Reviewers: vsk

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Add support for importing ChooseExpr AST nodes.
Tom Roeder [Tue, 26 Feb 2019 19:26:41 +0000 (19:26 +0000)]
[ASTImporter] Add support for importing ChooseExpr AST nodes.

Summary:
This allows ASTs to be merged when they contain ChooseExpr (the GNU
__builtin_choose_expr construction). This is needed, for example, for
cross-CTU analysis of C code that makes use of __builtin_choose_expr.

The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter.

This was originally reviewed and approved in
https://reviews.llvm.org/D58292 and submitted as r354832. It was
reverted in r354839 due to failures on the Windows CI builds.

This version fixes the test failures on Windows, which were caused by
differences in template expansion between versions of clang on different
OSes. The version of clang built with MSVC and running on Windows never
expands the template in the C++ test in ImportExpr.ImportChooseExpr in
clang/unittests/AST/ASTImporter.cpp, but the version on Linux does for
the empty arguments and -fms-compatibility.

So, this version of the patch drops the C++ test for
__builtin_choose_expr, since that version was written to catch
regressions of the logic for isConditionTrue() in the AST import code
for ChooseExpr, and those regressions are also caught by
ASTImporterOptionSpecificTestBase.ImportChooseExpr, which does work on
Windows.

Reviewers: shafik, a_sidorin, martong, aaron.ballman, rnk, a.sidorin

Subscribers: cfe-commits, jdoerfert, rnkovacs, aaron.ballman

Tags: #clang

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

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

5 years ago[X86] Add 'znver2' and 'cascadelake' to the __builtin_cpu_is test.
Craig Topper [Tue, 26 Feb 2019 19:20:04 +0000 (19:20 +0000)]
[X86] Add 'znver2' and 'cascadelake' to the __builtin_cpu_is test.

These are supported by at least libgcc trunk so we can include them now.

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

5 years ago[AMDGPU] Allow using integral non-type template parameters
Michael Liao [Tue, 26 Feb 2019 18:49:36 +0000 (18:49 +0000)]
[AMDGPU] Allow using integral non-type template parameters

Summary:
- Allow using integral non-type template parameters in the following
  attributes

  __attribute__((amdgpu_flat_work_group_size(<min>, <max>)))
  __attribute__((amdgpu_waves_per_eu(<min>[, <max>])))

Reviewers: kzhuravl, yaxunl

Subscribers: jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[X86] AMD znver2 enablement
Ganesh Gopalasubramanian [Tue, 26 Feb 2019 17:15:36 +0000 (17:15 +0000)]
[X86] AMD znver2 enablement

This patch enables the following

1) AMD family 17h "znver2" tune flag (-march, -mcpu).
2) ISAs that are enabled for "znver2" architecture.
3) For the time being, it uses the znver1 scheduler model.
4) Tests are updated.
5) This patch is the clang counterpart to D58343

Reviewers: craig.topper
Tags: #clang

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

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

5 years ago[OpenCL] Fix assertion due to blocks
Yaxun Liu [Tue, 26 Feb 2019 16:20:41 +0000 (16:20 +0000)]
[OpenCL] Fix assertion due to blocks

A recent change caused assertion in CodeGenFunction::EmitBlockCallExpr when a block is called.

There is code

  Func = CGM.getOpenCLRuntime().getInvokeFunction(E->getCallee());
getCalleeDecl calls Expr::getReferencedDeclOfCallee, which does not handle
BlockExpr and returns nullptr, which causes isa to assert.

This patch fixes that.

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

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

5 years ago[libclang] Avoid crashing when getting layout info of an undeduced type.
Emilio Cobos Alvarez [Tue, 26 Feb 2019 15:04:18 +0000 (15:04 +0000)]
[libclang] Avoid crashing when getting layout info of an undeduced type.

When the type is not deducible, return an error instead of crashing.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40813.

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

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

5 years ago[clang-format] SpaceBeforeParens for lambda expressions
Andrew Ng [Tue, 26 Feb 2019 14:34:49 +0000 (14:34 +0000)]
[clang-format] SpaceBeforeParens for lambda expressions

Add support for lambda expressions to the SpaceBeforeParens formatting
option.

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

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

5 years ago[clang][Index] Visit UsingDecls and generate USRs for them
Kadir Cetinkaya [Tue, 26 Feb 2019 14:23:12 +0000 (14:23 +0000)]
[clang][Index] Visit UsingDecls and generate USRs for them

Summary:
Add indexing of UsingDecl itself.
Also enable generation of USRs for UsingDecls, using the qualified name of the
decl.

Reviewers: ilya-biryukov, akyrtzi

Subscribers: arphaman, cfe-commits

Tags: #clang

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

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

5 years agorevert r354873 as this breaks lldb builds.
Pierre Gousseau [Tue, 26 Feb 2019 13:50:29 +0000 (13:50 +0000)]
revert r354873 as this breaks lldb builds.

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

5 years ago[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer...
Pierre Gousseau [Tue, 26 Feb 2019 13:30:14 +0000 (13:30 +0000)]
[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer checks, NFC.

enum SanitizerOrdinal has reached maximum capacity, this change extends the capacity to 128 sanitizer checks.
This can eventually allow us to add gcc 8's options "-fsanitize=pointer-substract" and "-fsanitize=pointer-compare".

Fixes: https://llvm.org/PR39425
Differential Revision: https://reviews.llvm.org/D57914

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

5 years ago[CodeComplete] Propagate preferred type for function arguments in more cases
Ilya Biryukov [Tue, 26 Feb 2019 11:01:50 +0000 (11:01 +0000)]
[CodeComplete] Propagate preferred type for function arguments in more cases

Summary:
See the added test for some new cases.
This change also removes special code completion calls inside the
ParseExpressionList function now that we properly propagate expected
type to the function responsible for parsing elements of the expression list
(ParseAssignmentExpression).

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: xbolva00, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoCodeGen: Explicitly initialize structure padding in the -ftrivial-auto-var-init mode
Alexander Potapenko [Tue, 26 Feb 2019 10:46:21 +0000 (10:46 +0000)]
CodeGen: Explicitly initialize structure padding in the -ftrivial-auto-var-init mode

When generating initializers for local structures in the
-ftrivial-auto-var-init mode, explicitly wipe the padding bytes with
either 0x00 or 0xAA.

This will allow us to automatically handle the padding when splitting
the initialization stores (see https://reviews.llvm.org/D57898).

Reviewed at https://reviews.llvm.org/D58188

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

5 years ago[CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial
Aaron Smith [Tue, 26 Feb 2019 03:49:05 +0000 (03:49 +0000)]
[CGDebugInfo] Set NonTrivial DIFlag to a c++ record if it's not trivial

This goes with https://reviews.llvm.org/D44406

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

5 years agoRevert r354832 "[ASTImporter] Add support for importing ChooseExpr AST nodes."
Reid Kleckner [Tue, 26 Feb 2019 02:22:22 +0000 (02:22 +0000)]
Revert r354832 "[ASTImporter] Add support for importing ChooseExpr AST nodes."

Test does not pass on Windows

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

5 years ago[MS] Fix for Bug 8446, template instantiation without a 'typename' keyword
Reid Kleckner [Tue, 26 Feb 2019 02:22:17 +0000 (02:22 +0000)]
[MS] Fix for Bug 8446, template instantiation without a 'typename' keyword

Patch by Zahira Ammarguellat!

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

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

5 years ago[ASTImporter] Add support for importing ChooseExpr AST nodes.
Tom Roeder [Mon, 25 Feb 2019 23:24:58 +0000 (23:24 +0000)]
[ASTImporter] Add support for importing ChooseExpr AST nodes.

Summary:
This allows ASTs to be merged when they contain ChooseExpr (the GNU
__builtin_choose_expr construction). This is needed, for example, for
cross-CTU analysis of C code that makes use of __builtin_choose_expr.

The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter.

Reviewers: shafik, a_sidorin, martong, aaron.ballman

Subscribers: aaron.ballman, rnkovacs, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[NFC] Reorder some mis-ordered tests
JF Bastien [Mon, 25 Feb 2019 23:09:34 +0000 (23:09 +0000)]
[NFC] Reorder some mis-ordered tests

I somehow had misaligned some of the tests when I originally wrote this. Re-order them properly.

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

5 years agoReapply "Make static counters in ASTContext non-static." with fixes.
Alexander Kornienko [Mon, 25 Feb 2019 22:22:09 +0000 (22:22 +0000)]
Reapply "Make static counters in ASTContext non-static." with fixes.

This reverts commit e50038e4dc53caee1acc811362ac0b15e00ef5eb.

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

5 years ago[CodeGenObjC] Fix a nullptr dyn_cast
Erik Pilkington [Mon, 25 Feb 2019 21:35:14 +0000 (21:35 +0000)]
[CodeGenObjC] Fix a nullptr dyn_cast

ObjCMessageExpr::getInstanceReceiver returns nullptr if the receiver
is 'super'. Make this check more strict, since we don't care about
messages to super here.

rdar://48247290

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

5 years ago[libclang] Expose warn_unused and warn_unused_result attributes.
Emilio Cobos Alvarez [Mon, 25 Feb 2019 21:24:52 +0000 (21:24 +0000)]
[libclang] Expose warn_unused and warn_unused_result attributes.

This is helpful to properly detect them, and fixing issues like
https://github.com/rust-lang/rust-bindgen/issues/1518.

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

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

5 years ago[libclang] Fix a trivial error introduced in D57946.
Emilio Cobos Alvarez [Mon, 25 Feb 2019 21:15:34 +0000 (21:15 +0000)]
[libclang] Fix a trivial error introduced in D57946.

The value for CXCursor_ConvergentAttr is not 420. I'm not really sure how easy
it is to test this, and I'm not familiar with the python bindings, just noticed
the error while looking at D57946 to write D58570.

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

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

5 years ago[OpenMP 5.0] Parsing/sema support for from clause with mapper modifier.
Michael Kruse [Mon, 25 Feb 2019 20:34:15 +0000 (20:34 +0000)]
[OpenMP 5.0] Parsing/sema support for from clause with mapper modifier.

This patch implements the parsing and sema support for the OpenMP
'from'-clause with potential user-defined mappers attached.
User-defined mappers are a new feature in OpenMP 5.0. A 'from'-clause
can have an explicit or implicit associated mapper, which instructs the
compiler to generate and use customized mapping functions. An example is
shown below:

    struct S { int len; int *d; };
    #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len])
    struct S ss;
    #pragma omp target update from(mapper(id): ss) // use the mapper with name 'id' to map ss from device

Contributed-by: Lingda Li <lildmh@gmail.com>
Differential Revision: https://reviews.llvm.org/D58638

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

5 years agoRevert "Make static counters in ASTContext non-static."
Vlad Tsyrklevich [Mon, 25 Feb 2019 19:53:13 +0000 (19:53 +0000)]
Revert "Make static counters in ASTContext non-static."

This reverts commit r354795, I suspect it is causing test failures
on MSan sanitizer bots.

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

5 years ago[analyzer] Fix infinite recursion in printing macros
Kristof Umann [Mon, 25 Feb 2019 18:49:42 +0000 (18:49 +0000)]
[analyzer] Fix infinite recursion in printing macros

#define f(y) x
#define x f(x)
int main() { x; }

This example results a compilation error since "x" in the first line was not
defined earlier. However, the macro expression printer goes to an infinite
recursion on this example.

Patch by Tibor Brunner!

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

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

5 years agoMake static counters in ASTContext non-static.
Alexander Kornienko [Mon, 25 Feb 2019 16:08:46 +0000 (16:08 +0000)]
Make static counters in ASTContext non-static.

Summary:
Fixes a data race and makes it possible to run clang-based tools in
multithreaded environment with TSan.

Reviewers: ilya-biryukov, riccibruno

Reviewed By: riccibruno

Subscribers: riccibruno, jfb, cfe-commits

Tags: #clang

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

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

5 years ago[AArch64] Add support for Cortex-A76 and Cortex-A76AE
Luke Cheeseman [Mon, 25 Feb 2019 15:11:31 +0000 (15:11 +0000)]
[AArch64] Add support for Cortex-A76 and Cortex-A76AE

- Add LLVM backend support for Cortex-A76 and Cortex-A76AE
- Documentation can be found at
  https://developer.arm.com/products/processors/cortex-a/cortex-a76

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

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

5 years agoFixed typos in tests: s/CHEKC/CHECK/
Dmitri Gribenko [Mon, 25 Feb 2019 13:41:59 +0000 (13:41 +0000)]
Fixed typos in tests: s/CHEKC/CHECK/

Reviewers: ilya-biryukov

Subscribers: nemanjai, javed.absar, jsji, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[SYCL] Add clang front-end option to enable SYCL device compilation flow.
Alexey Bader [Mon, 25 Feb 2019 11:48:48 +0000 (11:48 +0000)]
[SYCL] Add clang front-end option to enable SYCL device compilation flow.

Patch by Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>

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

5 years agoFix accidentally used hard tabs. NFC
Kristina Brooks [Sun, 24 Feb 2019 18:06:10 +0000 (18:06 +0000)]
Fix accidentally used hard tabs. NFC

Big sorry. This undoes the indentation mess I made
in r354751.

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