]> granicus.if.org Git - clang/log
clang
5 years ago[X86] Make _mm_mask_cvtps_ph, _mm_maskz_cvtps_ph, _mm256_mask_cvtps_ph, and _mm256_ma...
Craig Topper [Thu, 20 Jun 2019 18:24:29 +0000 (18:24 +0000)]
[X86] Make _mm_mask_cvtps_ph, _mm_maskz_cvtps_ph, _mm256_mask_cvtps_ph, and _mm256_maskz_cvtps_ph aliases for their corresponding cvt_roundps_ph intrinsic.

These intrinsics should always take an immediate for the rounding mode.
The base instruction comes from before EVEX embdedded rounding. The
user should always provide the immediate rather than us assuming
CUR_DIRECTION.

Make the 512-bit versions also explicit aliases instead of copy
pasting the code.

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

5 years ago[OpenMP] Add support for handling declare target to clause when unified memory is...
Gheorghe-Teodor Bercea [Thu, 20 Jun 2019 18:04:47 +0000 (18:04 +0000)]
[OpenMP] Add support for handling declare target to clause when unified memory is required

Summary:
This patch adds support for the handling of the variables under the declare target to clause.

The variables in this case are handled like link variables are. A pointer is created on the host and then mapped to the device. The runtime will then copy the address of the host variable in the device pointer.

Reviewers: ABataev, AlexEichenberger, caomhin

Reviewed By: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoStore a pointer to the return value in a static alloca and let the debugger use that
Amy Huang [Thu, 20 Jun 2019 17:15:21 +0000 (17:15 +0000)]
Store a pointer to the return value in a static alloca and let the debugger use that
as the variable address for NRVO variables.

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[clang-ifs] Clang Interface Stubs, first version (second landing attempt).
Puyan Lotfi [Thu, 20 Jun 2019 16:59:48 +0000 (16:59 +0000)]
[clang-ifs] Clang Interface Stubs, first version (second landing attempt).

This change reverts r363649; effectively re-landing r363626. At this point
clang::Index::CodegenNameGeneratorImpl has been refactored into
clang::AST::ASTNameGenerator. This makes it so that the previous circular link
dependency no longer exists, fixing the previous share lib
(-DBUILD_SHARED_LIBS=ON) build issue which was the reason for r363649.

Clang interface stubs (previously referred to as clang-ifsos) is a new frontend
action in clang that allows the generation of stub files that contain mangled
name info that can be used to produce a stub library. These stub libraries can
be useful for breaking up build dependencies and controlling access to a
library's internal symbols. Generation of these stubs can be invoked by:

clang -fvisibility=<visibility> -emit-interface-stubs \
                                -interface-stub-version=<interface format>

Notice that -fvisibility (along with use of visibility attributes) can be used
to control what symbols get generated. Currently the interface format is
experimental but there are a wide range of possibilities here.

Currently clang-ifs produces .ifs files that can be thought of as analogous to
object (.o) files, but just for the mangled symbol info. In a subsequent patch
I intend to add support for merging the .ifs files into one .ifs/.ifso file
that can be the input to something like llvm-elfabi to produce something like a
.so file or .dll (but without any of the code, just symbols).

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

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

5 years ago[Sema] Diagnose addr space mismatch while constructing objects
Anastasia Stulova [Thu, 20 Jun 2019 16:23:28 +0000 (16:23 +0000)]
[Sema] Diagnose addr space mismatch while constructing objects

If we construct an object in some arbitrary non-default addr space
it should fail unless either:
- There is an implicit conversion from the address space to default
/generic address space.
- There is a matching ctor qualified with an address space that is
either exactly matching or convertible to the address space of an
object.

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

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

5 years agoDump more information about expressions involving temporaries when dumping the AST...
Aaron Ballman [Thu, 20 Jun 2019 16:22:35 +0000 (16:22 +0000)]
Dump more information about expressions involving temporaries when dumping the AST to JSON.

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

5 years agoAIX system headers need stdint.h and inttypes.h to be re-enterable
Xing Xue [Thu, 20 Jun 2019 15:36:32 +0000 (15:36 +0000)]
AIX system headers need stdint.h and inttypes.h to be re-enterable

Summary:
AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined so that limit macro definitions such as UINT32_MAX can be found. This patch attempts to allow that on AIX.

Reviewers: hubert.reinterpretcast, jasonliu, mclow.lists, EricWF

Reviewed by: hubert.reinterpretcast, mclow.lists

Subscribers: jfb, jsji, christof, cfe-commits, libcxx-commits, llvm-commits

Tags: #LLVM, #clang, #libc++

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

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

5 years agoRemoving a helper function that was trivial to inline into its only use; NFC.
Aaron Ballman [Thu, 20 Jun 2019 15:10:45 +0000 (15:10 +0000)]
Removing a helper function that was trivial to inline into its only use; NFC.

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

5 years agoAdd test cases for explicit casts when dumping the AST to JSON; NFC.
Aaron Ballman [Thu, 20 Jun 2019 15:04:24 +0000 (15:04 +0000)]
Add test cases for explicit casts when dumping the AST to JSON; NFC.

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

5 years agoDump more information about construct expressions (resolved and unresolved) when...
Aaron Ballman [Thu, 20 Jun 2019 13:19:41 +0000 (13:19 +0000)]
Dump more information about construct expressions (resolved and unresolved) when dumping the AST to JSON.

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

5 years agoRevert "[clang] Fixing windows buildbot after D61552"
Gauthier Harnisch [Thu, 20 Jun 2019 10:34:02 +0000 (10:34 +0000)]
Revert "[clang] Fixing windows buildbot after D61552"

This reverts commit 5d5d2ca69e2b29b36db1a7dd1993ead7b7d2680f.

has already been fixed by c230eea2f349533468e14672eee94c2016476784

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

5 years ago[clang] Fixing windows buildbot after D61552
Gauthier Harnisch [Thu, 20 Jun 2019 10:27:14 +0000 (10:27 +0000)]
[clang] Fixing windows buildbot after D61552

Summary:
original review : https://reviews.llvm.org/D61552

build bot faillure : http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/110

this adds a missing definition of cxxDeductionGuideDecl.
surprisingly it was still working on linux with out it.

Reviewers: aaron.ballman

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

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

5 years ago[clang][ASTMatchers] Add definition for cxxDeductionGuideDecl introduced in rL363855
Kadir Cetinkaya [Thu, 20 Jun 2019 10:13:58 +0000 (10:13 +0000)]
[clang][ASTMatchers] Add definition for cxxDeductionGuideDecl introduced in rL363855

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

5 years ago[Testing] Dumping the graph requires assertions be enabled
David Zarzycki [Thu, 20 Jun 2019 09:58:58 +0000 (09:58 +0000)]
[Testing] Dumping the graph requires assertions be enabled

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

5 years ago[clang][AST] Refactoring ASTNameGenerator to use pimpl pattern (NFC).
Puyan Lotfi [Thu, 20 Jun 2019 06:01:06 +0000 (06:01 +0000)]
[clang][AST] Refactoring ASTNameGenerator to use pimpl pattern (NFC).

The original pimpl pattern used between CodegenNameGenerator and
CodegenNameGeneratorImpl did a good job of hiding DataLayout making it so that
users of CodegenNameGenerator did not need to link with llvm core.  This is an
NFC change to neatly wrap ASTNameGenerator in a pimpl.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Implement a --diff mode.
Artem Dergachev [Wed, 19 Jun 2019 23:33:59 +0000 (23:33 +0000)]
[analyzer] exploded-graph-rewriter: Implement a --diff mode.

In this mode the tool would avoid duplicating the contents of the
program state on every node, replacing them with a diff-like dump
of changes that happened on that node.

This is useful because most of the time we only interested in whether
the effect of the statement was modeled correctly. A diffed graph would
also be much faster to load and navigate, being much smaller than
the original graph.

The diffs are computed "semantically" as opposed to plain text diffs.
I.e., the diff algorithm is hand-crafted separately for every state trait,
taking the underlying data structures into account. This is especially nice
for Environment because textual diffs would have been terrible.
On the other hand, it requires some boilerplate to implement.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Fix escaping StringRegions.
Artem Dergachev [Wed, 19 Jun 2019 23:33:55 +0000 (23:33 +0000)]
[analyzer] exploded-graph-rewriter: Fix escaping StringRegions.

Quotes around StringRegions are now escaped and unescaped correctly,
producing valid JSON.

Additionally, add a forgotten escape for Store values.

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

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

5 years ago[analyzer] Fix JSON dumps for store clusters.
Artem Dergachev [Wed, 19 Jun 2019 23:33:51 +0000 (23:33 +0000)]
[analyzer] Fix JSON dumps for store clusters.

Include a unique pointer so that it was possible to figure out if it's
the same cluster in different program states. This allows comparing
dumps of different states against each other.

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

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

5 years ago[analyzer] Fix JSON dumps for location contexts.
Artem Dergachev [Wed, 19 Jun 2019 23:33:48 +0000 (23:33 +0000)]
[analyzer] Fix JSON dumps for location contexts.

Location context ID is a property of the location context, not of an item
within it. It's useful to know the id even when there are no items
in the context, eg. for the purposes of figuring out how did contents
of the Environment for the same location context changed across states.

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

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

5 years ago[analyzer] Fix JSON dumps for dynamic type information.
Artem Dergachev [Wed, 19 Jun 2019 23:33:45 +0000 (23:33 +0000)]
[analyzer] Fix JSON dumps for dynamic type information.

They're now valid JSON.

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

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

5 years ago[analyzer] NFC: Change evalCall() to provide a CallEvent.
Artem Dergachev [Wed, 19 Jun 2019 23:33:42 +0000 (23:33 +0000)]
[analyzer] NFC: Change evalCall() to provide a CallEvent.

This changes the checker callback signature to use the modern, easy to
use interface. Additionally, this unblocks future work on allowing
checkers to implement evalCall() for calls that don't correspond to any
call-expression or require additional information that's only available
as part of the CallEvent, such as C++ constructors and destructors.

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

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

5 years ago[analyzer] DeadStores: Add a crude suppression files generated by DriverKit IIG.
Artem Dergachev [Wed, 19 Jun 2019 23:33:39 +0000 (23:33 +0000)]
[analyzer] DeadStores: Add a crude suppression files generated by DriverKit IIG.

IIG is a replacement for MIG in DriverKit: IIG is autogenerating C++ code.
Suppress dead store warnings on such code, as the tool seems to be producing
them regularly, and the users of IIG are not in position to address these
warnings, as they don't control the autogenerated code. IIG-generated code
is identified by looking at the comments at the top of the file.

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

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

5 years ago[analyzer] RetainCount: Add support for OSRequiredCast().
Artem Dergachev [Wed, 19 Jun 2019 23:33:34 +0000 (23:33 +0000)]
[analyzer] RetainCount: Add support for OSRequiredCast().

It's a new API for custom RTTI in Apple IOKit/DriverKit framework that is
similar to OSDynamicCast() that's already supported, but crashes instead of
returning null (and therefore causing UB when the cast fails unexpectedly).
Kind of like cast_or_null<> as opposed to dyn_cast_or_null<> in LLVM's RTTI.

Historically, RetainCountChecker was responsible for modeling OSDynamicCast.
This is simply an extension of the same functionality.

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

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

5 years ago[X86] Correct the __min_vector_width__ attribute on a few intrinsics.
Craig Topper [Wed, 19 Jun 2019 23:27:04 +0000 (23:27 +0000)]
[X86] Correct the __min_vector_width__ attribute on a few intrinsics.

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

5 years ago[clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).
Puyan Lotfi [Wed, 19 Jun 2019 20:51:35 +0000 (20:51 +0000)]
[clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).

This is a NFC refactor move of CodegenNameGeneratorImpl from clang::Index to
clang:AST (and rename to ASTNameGenerator). The purpose is to make the
highlevel mangling code more reusable inside of clang (say in places like clang
FrontendAction). This does not affect anything in CodegenNameGenerator, except
that CodegenNameGenerator will now use ASTNameGenerator (in AST).

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

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

5 years agoPrint whether a generic selection expression is result dependent when dumping the...
Aaron Ballman [Wed, 19 Jun 2019 20:16:55 +0000 (20:16 +0000)]
Print whether a generic selection expression is result dependent when dumping the AST to JSON.

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

5 years agoReapply "r363684: AMDGPU: Add GWS instruction builtins"
Matt Arsenault [Wed, 19 Jun 2019 19:55:49 +0000 (19:55 +0000)]
Reapply "r363684: AMDGPU: Add GWS instruction builtins"

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

5 years agoPrint out the union field being initialized by an InitListExpr when dumping the AST...
Aaron Ballman [Wed, 19 Jun 2019 19:40:07 +0000 (19:40 +0000)]
Print out the union field being initialized by an InitListExpr when dumping the AST to JSON.

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

5 years agoDump the value calculated by a constant expression when dumping the AST to JSON.
Aaron Ballman [Wed, 19 Jun 2019 19:12:22 +0000 (19:12 +0000)]
Dump the value calculated by a constant expression when dumping the AST to JSON.

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

5 years agoSwitching this test to use output generated by script; NFC.
Aaron Ballman [Wed, 19 Jun 2019 19:07:52 +0000 (19:07 +0000)]
Switching this test to use output generated by script; NFC.

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

5 years ago[AST] Fixed extraneous warnings for binary conditional operator
Nathan Huckleberry [Wed, 19 Jun 2019 18:37:01 +0000 (18:37 +0000)]
[AST] Fixed extraneous warnings for binary conditional operator

Summary:
Binary conditional operator gave warnings where ternary operators
did not. They have been fixed to warn similarly to ternary operators.

Link: https://bugs.llvm.org/show_bug.cgi?id=42239
Reviewers: rsmith, aaron.ballman, nickdesaulniers

Reviewed By: rsmith, nickdesaulniers

Subscribers: srhines, cfe-commits

Tags: #clang

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

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

5 years ago[clang] Adapt ASTMatcher to explicit(bool) specifier
Gauthier Harnisch [Wed, 19 Jun 2019 18:27:56 +0000 (18:27 +0000)]
[clang] Adapt ASTMatcher to explicit(bool) specifier

Summary:
Changes:
 - add an ast matcher for deductiong guide.
 - allow isExplicit matcher for deductiong guide.
 - add hasExplicitSpecifier matcher which give access to the expression of the explicit specifier if present.

Reviewers: klimek, rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Tags: #clang

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

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

5 years agoAdd test cases for dumping record definition data to JSON; NFC.
Aaron Ballman [Wed, 19 Jun 2019 17:49:25 +0000 (17:49 +0000)]
Add test cases for dumping record definition data to JSON; NFC.

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

5 years ago[clang][test] Add missing LambdaTemplateParams test and migrate from getLocStart
Jordan Rupprecht [Wed, 19 Jun 2019 17:43:58 +0000 (17:43 +0000)]
[clang][test] Add missing LambdaTemplateParams test and migrate from getLocStart

These were removed a long time ago in r341573, but this test was missed because it was not in cmake

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

5 years ago[clang][NewPM] Fixing remaining -O0 tests that are broken under new PM
Leonard Chan [Wed, 19 Jun 2019 17:41:30 +0000 (17:41 +0000)]
[clang][NewPM] Fixing remaining -O0 tests that are broken under new PM

- CodeGen/flatten.c will fail under new PM becausec the new PM AlwaysInliner
  seems to intentionally inline functions but not call sites marked with
  alwaysinline (D23299)
- Tests that check remarks happen to check them for the inliner which is not
  turned on at O0. These tests just check that remarks work, but we can make
  separate tests for the new PM with -O1 so we can turn on the inliner and
  check the remarks with minimal changes.

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

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

5 years agoUnify DependencyFileGenerator class and DependencyCollector interface (NFCI)
Alex Lorenz [Wed, 19 Jun 2019 17:07:36 +0000 (17:07 +0000)]
Unify DependencyFileGenerator class and DependencyCollector interface (NFCI)

Make DependencyFileGenerator a DependencyCollector as it was intended when
DependencyCollector was introduced. The missing PPCallbacks overrides are added to
the DependencyCollector as well.

This change will allow clang-scan-deps to access the produced dependencies without
writing them out to .d files to disk, so that it will be able collate them and
report them to the user.

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

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

5 years ago[NFC][codeview] Avoid undefined grep in debug-info-codeview-display-name.cpp
Hubert Tong [Wed, 19 Jun 2019 15:48:12 +0000 (15:48 +0000)]
[NFC][codeview] Avoid undefined grep in debug-info-codeview-display-name.cpp

vertical-line is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\|`
is undefined. This patch uses an ERE instead.

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

5 years agoRevert rL363684 : AMDGPU: Add GWS instruction builtins
Simon Pilgrim [Wed, 19 Jun 2019 15:35:45 +0000 (15:35 +0000)]
Revert rL363684 : AMDGPU: Add GWS instruction builtins
........
Depends on rL363678 which was reverted at rL363797

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

5 years ago[analyzer] SARIF: Add EOF newline; replace diff_sarif
Hubert Tong [Wed, 19 Jun 2019 15:27:35 +0000 (15:27 +0000)]
[analyzer] SARIF: Add EOF newline; replace diff_sarif

Summary:
This patch applies a change similar to rC363069, but for SARIF files.

The `%diff_sarif` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

Additionally, this patch updates the SARIF output to have a newline at
the end of the file. This makes it so that the SARIF file qualifies as a
POSIX text file, which increases the consumability of the generated file
in relation to various tools.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

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

5 years agoAdd a script to help generate expected test output for dumping the AST to JSON.
Aaron Ballman [Wed, 19 Jun 2019 15:25:24 +0000 (15:25 +0000)]
Add a script to help generate expected test output for dumping the AST to JSON.

Patch by Abhishek Bhaskar.

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

5 years agoChange the way we output templates for JSON AST dumping and dump information about...
Aaron Ballman [Wed, 19 Jun 2019 15:24:06 +0000 (15:24 +0000)]
Change the way we output templates for JSON AST dumping and dump information about template arguments.

Previously, we attempted to write out template parameters and specializations to their own array, but due to the architecture of the ASTNodeTraverser, this meant that other nodes were not being written out. This now follows the same behavior as the regular AST dumper and puts all the (correct) information into the "inner" array. When we correct the AST node traverser itself, we can revisit splitting this information into separate arrays again.

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

5 years ago[OpenMP] Strengthen regression tests for task allocation under nowait depend clauses NFC
Gheorghe-Teodor Bercea [Wed, 19 Jun 2019 14:26:43 +0000 (14:26 +0000)]
[OpenMP] Strengthen regression tests for task allocation under nowait depend clauses NFC

Summary:
This patch strengthens the tests introduced in D63009 by:
- adding new test for default device ID.
- modifying existing tests to pass device ID local variable to the task allocation function.

Reviewers: ABataev, Hahnfeld, caomhin, jdoerfert

Reviewed By: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoAllow copy/move assignment operator to be coroutine as per N4775
Vivek Pandya [Wed, 19 Jun 2019 14:12:19 +0000 (14:12 +0000)]
Allow copy/move assignment operator to be coroutine as per N4775

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

Reviewers: GorNishanov, rsmith
Reviewed by: GorNishanov
Subscribers: cfe-commits, lewissbaker, modocache, llvm-commits

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

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

5 years ago[Syntax] Fix a crash when dumping empty token buffer
Ilya Biryukov [Wed, 19 Jun 2019 13:56:36 +0000 (13:56 +0000)]
[Syntax] Fix a crash when dumping empty token buffer

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

5 years ago[OpenCL] Split type and macro definitions into opencl-c-base.h
Sven van Haastregt [Wed, 19 Jun 2019 12:48:22 +0000 (12:48 +0000)]
[OpenCL] Split type and macro definitions into opencl-c-base.h

Using the -fdeclare-opencl-builtins option will require a way to
predefine types and macros such as `int4`, `CLK_GLOBAL_MEM_FENCE`,
etc.  Move these out of opencl-c.h into opencl-c-base.h such that the
latter can be shared by -fdeclare-opencl-builtins and
-finclude-default-header.

This changes the behaviour of -finclude-default-header when
-fdeclare-opencl-builtins is specified: instead of including the full
header, it will include the header with only the base definitions.

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

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

5 years agoRevert r363116 "[X86] [ABI] Fix i386 ABI "__m64" type bug"
Hans Wennborg [Wed, 19 Jun 2019 11:34:08 +0000 (11:34 +0000)]
Revert r363116 "[X86] [ABI] Fix i386 ABI "__m64" type bug"

This introduced MMX instructions in code that wasn't previously using
them, breaking programs using 64-bit vectors and x87 floating-point in
the same application. See discussion on the code review for more
details.

> According to System V i386 ABI: the  __m64 type paramater and return
> value are passed by MMX registers. But current implementation treats
> __m64 as i64 which results in parameter passing by stack and returning
> by EDX and EAX.
>
> This patch fixes the bug (https://bugs.llvm.org/show_bug.cgi?id=41029)
> for Linux and NetBSD.
>
> Patch by Wei Xiao (wxiao3)
>
> Differential Revision: https://reviews.llvm.org/D59744

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

5 years ago[analyzer][NFC][tests] Pre-normalize expected-sarif files
Hubert Tong [Wed, 19 Jun 2019 11:19:51 +0000 (11:19 +0000)]
[analyzer][NFC][tests] Pre-normalize expected-sarif files

As discussed in the review for D62952, this patch pre-normalizes the
reference expected output sarif files by removing lines containing
fields for which we expect differences that should be ignored.

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

5 years ago[RISCV] Mark TLS as supported
Lewis Revill [Wed, 19 Jun 2019 08:53:46 +0000 (08:53 +0000)]
[RISCV] Mark TLS as supported

Inform Clang that TLS is implemented by LLVM for RISC-V

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

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

5 years agogit-clang-format: Remove trailing whitespace in docstring. NFC.
Sam Clegg [Wed, 19 Jun 2019 01:52:41 +0000 (01:52 +0000)]
git-clang-format: Remove trailing whitespace in docstring. NFC.

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

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

5 years agoFix tests after r363749
Aaron Puchert [Tue, 18 Jun 2019 23:40:17 +0000 (23:40 +0000)]
Fix tests after r363749

We changed -Wmissing-prototypes there, which was used in these tests via
-Weverything.

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

5 years agoSuggestions to fix -Wmissing-{prototypes,variable-declarations}
Aaron Puchert [Tue, 18 Jun 2019 22:57:08 +0000 (22:57 +0000)]
Suggestions to fix -Wmissing-{prototypes,variable-declarations}

Summary:
I've found that most often the proper way to fix this warning is to add
`static`, because if the code otherwise compiles and links, the function
or variable is apparently not needed outside of the TU.

We can't provide a fix-it hint for variable declarations, because
multiple VarDecls can share the same type, and if we put static in front
of that, we affect all declared variables, some of which might have
previous declarations.

We also provide no fix-it hint for the rare case of an `extern` function
definition, because that would require removing `extern` and I have no
idea how to get the source location of the storage class specifier from
a FunctionDecl. I believe this information is only available earlier in
the AST construction from DeclSpec::getStorageClassSpecLoc(), but we
don't have that here.

Reviewed By: aaron.ballman

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

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

5 years agoShow note for -Wmissing-prototypes for functions with parameters
Aaron Puchert [Tue, 18 Jun 2019 22:52:39 +0000 (22:52 +0000)]
Show note for -Wmissing-prototypes for functions with parameters

Summary:
There was a search for non-prototype declarations for the function, but
we only showed the results for zero-parameter functions. Now we show the
note for functions with parameters as well, but we omit the fix-it hint
suggesting to add `void`.

Reviewed By: aaron.ballman

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

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

5 years ago[test] NFC, udpate clang-scan-deps tests to not use -c to avoid driver issues when...
Alex Lorenz [Tue, 18 Jun 2019 21:36:30 +0000 (21:36 +0000)]
[test] NFC, udpate clang-scan-deps tests to not use -c to avoid driver issues when no integrated assembler is present

Caught by Douglas Yung.

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

5 years ago[OPENMP]Use host's mangling for 128 bit float types on the device.
Alexey Bataev [Tue, 18 Jun 2019 20:29:06 +0000 (20:29 +0000)]
[OPENMP]Use host's mangling for 128 bit float types on the device.

Device have to use the same mangling as the host for 128bit float types. Otherwise, the codegen for the device is unable to find the parent function when it tries to generate the outlined function for the target region and it leads to incorrect compilation and crash at the runtime.

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

5 years ago[OPENMP][NVPTX]Correct codegen for 128 bit long double.
Alexey Bataev [Tue, 18 Jun 2019 19:04:27 +0000 (19:04 +0000)]
[OPENMP][NVPTX]Correct codegen for 128 bit long double.

If the host uses 128 bit long doubles, the compiler should generate correct code for NVPTX devices. If the return type has 128 bit long doubles, in LLVM IR this type must be coerced to int array instead.

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

5 years ago[OPENMP]Use host's long double when compiling the code for device.
Alexey Bataev [Tue, 18 Jun 2019 18:39:26 +0000 (18:39 +0000)]
[OPENMP]Use host's long double when compiling the code for device.

The device code must use the same long double type as the host.
Otherwise the code cannot be linked and executed properly. Patch adds
only basic support and checks for supporting of the host long double
double on the device.

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

5 years agoAdd test cases for dumping AST function decl nodes to JSON; NFC.
Aaron Ballman [Tue, 18 Jun 2019 17:56:50 +0000 (17:56 +0000)]
Add test cases for dumping AST function decl nodes to JSON; NFC.

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

5 years agoAdd test cases for dumping AST decl nodes to JSON; NFC.
Aaron Ballman [Tue, 18 Jun 2019 16:36:49 +0000 (16:36 +0000)]
Add test cases for dumping AST decl nodes to JSON; NFC.

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

5 years ago[Syntax] Add a helper to find expansion by its first spelled token
Ilya Biryukov [Tue, 18 Jun 2019 16:27:27 +0000 (16:27 +0000)]
[Syntax] Add a helper to find expansion by its first spelled token

Summary: Used in clangd for a code tweak that expands a macro.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[CodeGen][ARM] Fix FP16 vector coercion
Mikhail Maltsev [Tue, 18 Jun 2019 14:34:27 +0000 (14:34 +0000)]
[CodeGen][ARM] Fix FP16 vector coercion

Summary:
When a function argument or return type is a homogeneous aggregate
which contains an FP16 vector but the target does not support FP16
operations natively, the type must be converted into an array of
integer vectors by then front end (otherwise LLVM will handle FP16
vectors incorrectly by scalarizing them and promoting FP16 to float,
see https://reviews.llvm.org/D50507).

Currently the logic for checking whether or not a given homogeneous
aggregate contains FP16 vectors is incorrect: it only looks at the
type of the first vector.

This patch fixes the issue by adding a new method
ARMABIInfo::containsAnyFP16Vectors and using it. The traversal logic
of this method is largely the same as in
ABIInfo::isHomogeneousAggregate.

Reviewers: eli.friedman, olista01, ostannard

Reviewed By: ostannard

Subscribers: ostannard, john.brawn, javed.absar, kristof.beyls, pbarrio, cfe-commits

Tags: #clang

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

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

5 years agoAMDGPU: Add GWS instruction builtins
Matt Arsenault [Tue, 18 Jun 2019 14:10:01 +0000 (14:10 +0000)]
AMDGPU: Add GWS instruction builtins

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

5 years agoAMDGPU: Disable errno by default
Matt Arsenault [Tue, 18 Jun 2019 13:59:32 +0000 (13:59 +0000)]
AMDGPU: Disable errno by default

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

5 years agoRequire commas to separate multiple GNU-style attributes in the same attribute list.
Aaron Ballman [Tue, 18 Jun 2019 12:57:05 +0000 (12:57 +0000)]
Require commas to separate multiple GNU-style attributes in the same attribute list.

Fixes PR38352.

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

5 years agoFix compiler warning by removing unused variable
Mikael Holmen [Tue, 18 Jun 2019 06:41:56 +0000 (06:41 +0000)]
Fix compiler warning by removing unused variable

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

5 years agoRevert D60974 "[clang-ifs] Clang Interface Stubs, first version."
Fangrui Song [Tue, 18 Jun 2019 05:52:39 +0000 (05:52 +0000)]
Revert D60974 "[clang-ifs] Clang Interface Stubs, first version."

This reverts commit rC363626.

clangIndex depends on clangFrontend. r363626 adds a dependency from
clangFrontend to clangIndex, which creates a circular dependency.

This is disallowed by -DBUILD_SHARED_LIBS=on builds:

    CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
      "clangFrontend" of type SHARED_LIBRARY
        depends on "clangIndex" (weak)
      "clangIndex" of type SHARED_LIBRARY
        depends on "clangFrontend" (weak)
    At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.

Note, the dependency on clangIndex cannot be removed because
libclangFrontend.so is linked with -Wl,-z,defs: a shared object must
have its full direct dependencies specified on the linker command line.

In -DBUILD_SHARED_LIBS=off builds, this appears to work when linking
`bin/clang-9`. However, it can cause trouble to downstream clang library
users. The llvm build system links libraries this way:

    clang main_program_object_file ... lib/libclangIndex.a ...  lib/libclangFrontend.a -o exe

libclangIndex.a etc are not wrapped in --start-group.

If the downstream application depends on libclangFrontend.a but not any
other clang libraries that depend on libclangIndex.a, this can cause undefined
reference errors when the linker is ld.bfd or gold.

The proper fix is to not include clangIndex files in clangFrontend.

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

5 years ago[NFC] Undoing r363646 to fix bots.
Puyan Lotfi [Tue, 18 Jun 2019 05:15:59 +0000 (05:15 +0000)]
[NFC] Undoing r363646 to fix bots.

-DBUILD_SHARED_LIBS=ON is still having problem caused by layering issues with
D60974. Locally there weren't problems building with shared libs on or off but
the bots appear to be acting up.

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

5 years ago[NFC] Fixing -DBUILD_SHARED_LIBS=ON problem caused by layering issue in D60974
Puyan Lotfi [Tue, 18 Jun 2019 04:40:03 +0000 (04:40 +0000)]
[NFC] Fixing -DBUILD_SHARED_LIBS=ON problem caused by layering issue in  D60974

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

5 years ago[Remarks][Driver] Use the specified format in the remarks file extension
Francis Visoiu Mistrih [Mon, 17 Jun 2019 22:49:38 +0000 (22:49 +0000)]
[Remarks][Driver] Use the specified format in the remarks file extension

By default, use `.opt.yaml`, but when a format is specified with
`-fsave-optimization-record=<format>`, use `.opt.<format>`.

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

5 years ago[clang-ifs] Clang Interface Stubs, first version.
Puyan Lotfi [Mon, 17 Jun 2019 22:46:54 +0000 (22:46 +0000)]
[clang-ifs] Clang Interface Stubs, first version.

Clang interface stubs (previously referred to as clang-ifsos) is a new frontend
action in clang that allows the generation of stub files that contain mangled
name info that can be used to produce a stub library. These stub libraries can
be useful for breaking up build dependencies and controlling access to a
library's internal symbols. Generation of these stubs can be invoked by:

clang -fvisibility=<visibility> -emit-interface-stubs \
                                -interface-stub-version=<interface format>

Notice that -fvisibility (along with use of visibility attributes) can be used
to control what symbols get generated. Currently the interface format is
experimental but there are a wide range of possibilities here.

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

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

5 years agoFix crash when checking a dependently-typed reference that is
Richard Smith [Mon, 17 Jun 2019 21:46:17 +0000 (21:46 +0000)]
Fix crash when checking a dependently-typed reference that is
initialized from a non-value-dependent initializer.

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

5 years agoRewrite ConstStructBuilder with a mechanism that can cope with splitting and updating...
Richard Smith [Mon, 17 Jun 2019 21:08:30 +0000 (21:08 +0000)]
Rewrite ConstStructBuilder with a mechanism that can cope with splitting and updating constants.

Summary:
This adds a ConstantBuilder class that deals with incrementally building
an aggregate constant, including support for overwriting
previously-emitted parts of the aggregate with new values.

This fixes a bunch of cases where we used to be unable to reduce a
DesignatedInitUpdateExpr down to an IR constant, and also lays some
groundwork for emission of class constants with [[no_unique_address]]
members.

Reviewers: rjmccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoClang :: Sema/wchar.c has long been failing on Solaris:
Rainer Orth [Mon, 17 Jun 2019 20:21:25 +0000 (20:21 +0000)]
Clang :: Sema/wchar.c has long been failing on Solaris:

  error: 'error' diagnostics expected but not seen:
    File /vol/llvm/src/clang/local/test/Sema/wchar.c Line 22: initializing wide char array with non-wide string literal
  error: 'error' diagnostics seen but not expected:
    File /vol/llvm/src/clang/local/test/Sema/wchar.c Line 20: array initializer must be an initializer list
    File /vol/llvm/src/clang/local/test/Sema/wchar.c Line 22: array initializer must be an initializer list

It turns out the definition is wrong, as can be seen in GCC's gcc/config/sol2.h:

  /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
     compilations.  This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
     (32-bit) and p. 6P-10, Figure 6.38 (64-bit).  */

  #undef WCHAR_TYPE
  #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")

The following patch implements this, and at the same time corrects the wint_t
definition which is the same:

  /* Same for wint_t.  See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit).  There's
     no corresponding 64-bit definition, but this is what Solaris 8
     <iso/wchar_iso.h> uses.  */

  #undef WINT_TYPE
  #define WINT_TYPE (TARGET_64BIT ? "int" : "long int")

Clang :: Preprocessor/wchar_t.c and Clang :: Sema/format-strings.c need to
be adjusted to account for that.

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

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

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

5 years agoPR42205: DebugInfio: Do not attempt to emit debug info metadata for static member...
David Blaikie [Mon, 17 Jun 2019 19:40:52 +0000 (19:40 +0000)]
PR42205: DebugInfio: Do not attempt to emit debug info metadata for static member variable template partial specializations

Would cause a crash in an attempt to create the type for the still
unresolved 'auto' in the partial specialization (& even without the use
of 'auto', the expression would be value dependent &
crash/assertion-fail there).

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

5 years ago[clang][AST] Remove unnecessary 'const'.
Michael Liao [Mon, 17 Jun 2019 17:47:03 +0000 (17:47 +0000)]
[clang][AST] Remove unnecessary 'const'.

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

5 years agoVarious improvements to Clang MSVC Visualizer
Mike Spertus [Mon, 17 Jun 2019 16:12:45 +0000 (16:12 +0000)]
Various improvements to Clang MSVC Visualizer

This change adds/improves MSVC visualizers for many Clang types, including array types, trailing return types in function, deduction guides, a fix for OpaquePtr, etc. It also replaces all of the view(deref) with the "na" formatter, which is a better built-in natvis technique for doing the same thing.

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

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

5 years ago[Remarks] Extend -fsave-optimization-record to specify the format
Francis Visoiu Mistrih [Mon, 17 Jun 2019 16:06:00 +0000 (16:06 +0000)]
[Remarks] Extend -fsave-optimization-record to specify the format

Use -fsave-optimization-record=<format> to specify a different format
than the default, which is YAML.

For now, only YAML is supported.

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

5 years ago[clang][CodeGen] Remove std::move on temporary
Kadir Cetinkaya [Mon, 17 Jun 2019 14:23:06 +0000 (14:23 +0000)]
[clang][CodeGen] Remove std::move on temporary

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

5 years ago[HIP] Add the interface deriving the stub name of device kernels.
Michael Liao [Mon, 17 Jun 2019 12:51:36 +0000 (12:51 +0000)]
[HIP] Add the interface deriving the stub name of device kernels.

Summary:
- Revise the interface to derive the stub name and simplify the
  assertion of it.

Reviewers: yaxunl, tra

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoPromote -fdebug-compilation-dir from a cc1 flag to clang and clang-cl driver flags
Nico Weber [Mon, 17 Jun 2019 12:10:40 +0000 (12:10 +0000)]
Promote -fdebug-compilation-dir from a cc1 flag to clang and clang-cl driver flags

The flag is useful when wanting to create .o files that are independent
from the absolute path to the build directory. -fdebug-prefix-map= can
be used to the same effect, but it requires putting the absolute path
to the build directory on the build command line, so it still requires
the build command line to be dependent on the absolute path of the build
directory. With this flag, "-fdebug-compilation-dir ." makes it so that
both debug info and the compile command itself are independent of the
absolute path of the build directory, which is good for build
determinism (in the sense that the build is independent of which
directory it happens in) and for caching compile results.
(The tradeoff is that the debugger needs explicit configuration to know
the build directory. See also http://dwarfstd.org/ShowIssue.php?issue=171130.2)

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

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

5 years agoRecommit [OpenCL] Move OpenCLBuiltins.td and remove unused include
Sven van Haastregt [Mon, 17 Jun 2019 10:06:34 +0000 (10:06 +0000)]
Recommit [OpenCL] Move OpenCLBuiltins.td and remove unused include

Reland r363242 after fixing an issue with the tablegen dependence.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

5 years agoRe-commit r357452 (take 3): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Hans Wennborg [Mon, 17 Jun 2019 07:47:28 +0000 (07:47 +0000)]
Re-commit r357452 (take 3): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

Third time's the charm.

This was reverted in r363220 due to being suspected of an internal benchmark
regression and a test failure, none of which turned out to be caused by this.

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

5 years ago[docs] Fix another bot error by setting highlight language of objc code-block to...
Don Hinton [Sun, 16 Jun 2019 19:15:04 +0000 (19:15 +0000)]
[docs] Fix another bot error by setting highlight language of objc code-block to objc instead of c++.

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

5 years ago[analyzer] ReturnVisitor: more portable test case
Csaba Dabis [Sun, 16 Jun 2019 17:29:37 +0000 (17:29 +0000)]
[analyzer] ReturnVisitor: more portable test case

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

5 years ago[analyzer] Push correct version of 'Track indices of arrays'
Kristof Umann [Sun, 16 Jun 2019 15:41:25 +0000 (15:41 +0000)]
[analyzer] Push correct version of 'Track indices of arrays'

Messed up the commit, oops.

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

5 years ago[analyzer] Track indices of arrays
Kristof Umann [Sun, 16 Jun 2019 14:52:56 +0000 (14:52 +0000)]
[analyzer] Track indices of arrays

Often times, when an ArraySubscriptExpr was reported as null or
undefined, the bug report was difficult to understand, because the
analyzer explained why arr[i] has that value, but didn't realize that in
fact i's value is very important as well. This patch fixes this by
tracking the indices of arrays.

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

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

5 years ago[analyzer][NFC] Tease apart and clang-format NoStoreFuncVisitor
Kristof Umann [Sun, 16 Jun 2019 14:09:11 +0000 (14:09 +0000)]
[analyzer][NFC] Tease apart and clang-format NoStoreFuncVisitor

Make several methods static functions
Move non-trivial methods out-of-line
Add a divider
Turn non-obvious autos into Optional<RegionVector>
clang-format affected lines

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

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

5 years agoRecommit r363298 "[lit] Disable test on darwin when building shared libs."
Don Hinton [Sat, 15 Jun 2019 20:09:54 +0000 (20:09 +0000)]
Recommit r363298 "[lit] Disable test on darwin when building shared libs."

Was reverted in r363379 due to build breakage.

Thanks to Nico Weber for reverting the original and suggesting the
fix.

Please see https://reviews.llvm.org/D61697

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

5 years ago[Clang] Harmonize Split DWARF options with llc
Aaron Puchert [Sat, 15 Jun 2019 15:38:51 +0000 (15:38 +0000)]
[Clang] Harmonize Split DWARF options with llc

Summary:
With Split DWARF the resulting object file (then called skeleton CU)
contains the file name of another ("DWO") file with the debug info.
This can be a problem for remote compilation, as it will contain the
name of the file on the compilation server, not on the client.

To use Split DWARF with remote compilation, one needs to either

* make sure only relative paths are used, and mirror the build directory
  structure of the client on the server,
* inject the desired file name on the client directly.

Since llc already supports the latter solution, we're just copying that
over. We allow setting the actual output filename separately from the
value of the DW_AT_[GNU_]dwo_name attribute in the skeleton CU.

Fixes PR40276.

Reviewers: dblaikie, echristo, tejohnson

Reviewed By: dblaikie

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

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

5 years ago[Clang] Rename -split-dwarf-file to -split-dwarf-output
Aaron Puchert [Sat, 15 Jun 2019 14:07:43 +0000 (14:07 +0000)]
[Clang] Rename -split-dwarf-file to -split-dwarf-output

Summary:
This is the first in a series of changes trying to align clang -cc1
flags for Split DWARF with those of llc. The unfortunate side effect of
having -split-dwarf-output for single file Split DWARF will disappear
again in a subsequent change.

The change is the result of a discussion in D59673.

Reviewers: dblaikie, echristo

Reviewed By: dblaikie

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

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

5 years ago[clang] Add storage for APValue in ConstantExpr
Gauthier Harnisch [Sat, 15 Jun 2019 10:24:47 +0000 (10:24 +0000)]
[clang] Add storage for APValue in ConstantExpr

Summary:
When using ConstantExpr we often need the result of the expression to be kept in the AST. Currently this is done on a by the node that needs the result and has been done multiple times for enumerator, for constexpr variables... . This patch adds to ConstantExpr the ability to store the result of evaluating the expression. no functional changes expected.

Changes:
 - Add trailling object to ConstantExpr that can hold an APValue or an uint64_t. the uint64_t is here because most ConstantExpr yield integral values so there is an optimized layout for integral values.
 - Add basic* serialization support for the trailing result.
 - Move conversion functions from an enum to a fltSemantics from clang::FloatingLiteral to llvm::APFloatBase. this change is to make it usable for serializing APValues.
 - Add basic* Import support for the trailing result.
 - ConstantExpr created in CheckConvertedConstantExpression now stores the result in the ConstantExpr Node.
 - Adapt AST dump to print the result when present.

basic* : None, Indeterminate, Int, Float, FixedPoint, ComplexInt, ComplexFloat,
the result is not yet used anywhere but for -ast-dump.

Reviewers: rsmith, martong, shafik

Reviewed By: rsmith

Subscribers: rnkovacs, hiraditya, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[analyzer] ReturnVisitor: Bypass everything to see inlined calls
Csaba Dabis [Sat, 15 Jun 2019 10:05:49 +0000 (10:05 +0000)]
[analyzer] ReturnVisitor: Bypass everything to see inlined calls

Summary:
When we traversed backwards on ExplodedNodes to see where processed the
given statement we `break` too early. With the current approach we do not
miss the CallExitEnd ProgramPoint which stands for an inlined call.

Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp, cfe-commits

Tags: #clang

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

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

5 years ago[clang] perform semantic checking in constant context
Gauthier Harnisch [Sat, 15 Jun 2019 08:32:56 +0000 (08:32 +0000)]
[clang] perform semantic checking in constant context

Summary:
Since the addition of __builtin_is_constant_evaluated the result of an expression can change based on whether it is evaluated in constant context. a lot of semantic checking performs evaluations with out specifying context. which can lead to wrong diagnostics.
for example:
```
constexpr int i0 = (long long)__builtin_is_constant_evaluated() * (1ll << 33); //#1
constexpr int i1 = (long long)!__builtin_is_constant_evaluated() * (1ll << 33); //#2
```
before the patch, #2 was diagnosed incorrectly and #1 wasn't diagnosed.
after the patch #1 is diagnosed as it should and #2 isn't.

Changes:
 - add a flag to Sema to passe in constant context mode.
 - in SemaChecking.cpp calls to Expr::Evaluate* are now done in constant context when they should.
 - in SemaChecking.cpp diagnostics for UB are not checked for in constant context because an error will be emitted by the constant evaluator.
 - in SemaChecking.cpp diagnostics for construct that cannot appear in constant context are not checked for in constant context.
 - in SemaChecking.cpp diagnostics on constant expression are always emitted because constant expression are always evaluated.
 - semantic checking for initialization of constexpr variables is now done in constant context.
 - adapt test that were depending on warning changes.
 - add test.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFixed the --print-supported-cpus test
Ziang Wan [Fri, 14 Jun 2019 23:34:40 +0000 (23:34 +0000)]
Fixed the --print-supported-cpus test

Add constraints for the test that require specific backend targets
to be registered.

Remove trailing whitespace in the doc.

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

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

5 years ago[X86] Add checks that immediate for reducesd/ss fits in 8-bits.
Craig Topper [Fri, 14 Jun 2019 23:23:19 +0000 (23:23 +0000)]
[X86] Add checks that immediate for reducesd/ss fits in 8-bits.

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

5 years ago[CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute
Akira Hatanaka [Fri, 14 Jun 2019 22:06:28 +0000 (22:06 +0000)]
[CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute
'objc_arc_inert'

The attribute enables the ARC optimizer to delete ObjC ARC runtime calls
on the annotated globals (see https://reviews.llvm.org/D62433). We
currently only annotate global variables for string literals and global
blocks with the attribute.

rdar://problem/49839633

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

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

5 years agoAdd --print-supported-cpus flag for clang.
Ziang Wan [Fri, 14 Jun 2019 21:42:21 +0000 (21:42 +0000)]
Add --print-supported-cpus flag for clang.

This patch allows clang users to print out a list of supported CPU models using
clang [--target=<target triple>] --print-supported-cpus

Then, users can select the CPU model to compile to using
clang --target=<triple> -mcpu=<model> a.c

It is a handy feature to help cross compilation.

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

5 years ago[Remarks][NFC] Improve testing and documentation of -foptimization-record-passes
Francis Visoiu Mistrih [Fri, 14 Jun 2019 21:38:57 +0000 (21:38 +0000)]
[Remarks][NFC] Improve testing and documentation of -foptimization-record-passes

This adds:

* documentation to the user manual
* nicer error message
* test for the error case
* test for the gold plugin

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

5 years ago[OpenMP] Add target task alloc function with device ID
Gheorghe-Teodor Bercea [Fri, 14 Jun 2019 20:19:54 +0000 (20:19 +0000)]
[OpenMP] Add target task alloc function with device ID

Summary: Add a new call to Clang to perform task allocation for the target.

Reviewers: ABataev, AlexEichenberger, caomhin

Reviewed By: ABataev, AlexEichenberger

Subscribers: openmp-commits, Hahnfeld, guansong, jdoerfert, cfe-commits

Tags: #clang, #openmp

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

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

5 years agoUse unsigned for bitfields to avoid sign extension
Reid Kleckner [Fri, 14 Jun 2019 20:19:29 +0000 (20:19 +0000)]
Use unsigned for bitfields to avoid sign extension

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

5 years agoPR42071: Reject weird names for non-type template parameters.
Richard Smith [Fri, 14 Jun 2019 20:01:54 +0000 (20:01 +0000)]
PR42071: Reject weird names for non-type template parameters.

Also reject default arguments appearing in invalid locations.

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