Commit Graph

79054 Commits

Author SHA1 Message Date
Matt Arsenault f46f41411b Reapply "r363684: AMDGPU: Add GWS instruction builtins"
llvm-svn: 363871
2019-06-19 19:55:49 +00:00
Aaron Ballman 709a769cdd Print out the union field being initialized by an InitListExpr when dumping the AST to JSON.
llvm-svn: 363869
2019-06-19 19:40:07 +00:00
Aaron Ballman 91f7265759 Dump the value calculated by a constant expression when dumping the AST to JSON.
llvm-svn: 363866
2019-06-19 19:12:22 +00:00
Aaron Ballman 5f84ebe8de Switching this test to use output generated by script; NFC.
llvm-svn: 363859
2019-06-19 19:07:52 +00:00
Nathan Huckleberry 321f902a01 [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

llvm-svn: 363857
2019-06-19 18:37:01 +00:00
Gauthier Harnisch e1f4ba85e5 [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

llvm-svn: 363855
2019-06-19 18:27:56 +00:00
Aaron Ballman 22a5a61674 Add test cases for dumping record definition data to JSON; NFC.
llvm-svn: 363849
2019-06-19 17:49:25 +00:00
Jordan Rupprecht ff384a2d1c [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

llvm-svn: 363848
2019-06-19 17:43:58 +00:00
Leonard Chan e6d2c8dde6 [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

llvm-svn: 363846
2019-06-19 17:41:30 +00:00
Alex Lorenz 8d9eb7acd5 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

llvm-svn: 363840
2019-06-19 17:07:36 +00:00
Hubert Tong 8d92f59696 [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.

llvm-svn: 363826
2019-06-19 15:48:12 +00:00
Simon Pilgrim 6828bc5614 Revert rL363684 : AMDGPU: Add GWS instruction builtins
........
Depends on rL363678 which was reverted at rL363797

llvm-svn: 363824
2019-06-19 15:35:45 +00:00
Hubert Tong 64b60df99f [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

llvm-svn: 363822
2019-06-19 15:27:35 +00:00
Aaron Ballman 1ad10137c9 Add a script to help generate expected test output for dumping the AST to JSON.
Patch by Abhishek Bhaskar.

llvm-svn: 363820
2019-06-19 15:25:24 +00:00
Aaron Ballman 7556615a9d 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.

llvm-svn: 363819
2019-06-19 15:24:06 +00:00
Gheorghe-Teodor Bercea c74707cb39 [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

llvm-svn: 363809
2019-06-19 14:26:43 +00:00
Vivek Pandya 3a0100ac30 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

llvm-svn: 363804
2019-06-19 14:12:19 +00:00
Ilya Biryukov 26c066d66d [Syntax] Fix a crash when dumping empty token buffer
llvm-svn: 363801
2019-06-19 13:56:36 +00:00
Sven van Haastregt af1c230e70 [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

llvm-svn: 363794
2019-06-19 12:48:22 +00:00
Hans Wennborg d874c057bc 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

llvm-svn: 363790
2019-06-19 11:34:08 +00:00
Hubert Tong 122bd782d6 [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.

llvm-svn: 363788
2019-06-19 11:19:51 +00:00
Lewis Revill af22e071ca [RISCV] Mark TLS as supported
Inform Clang that TLS is implemented by LLVM for RISC-V

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

llvm-svn: 363776
2019-06-19 08:53:46 +00:00
Sam Clegg 8c24a57695 git-clang-format: Remove trailing whitespace in docstring. NFC.
Differential Revision: https://reviews.llvm.org/D62915

llvm-svn: 363759
2019-06-19 01:52:41 +00:00
Aaron Puchert 2b285c664d Fix tests after r363749
We changed -Wmissing-prototypes there, which was used in these tests via
-Weverything.

llvm-svn: 363754
2019-06-18 23:40:17 +00:00
Aaron Puchert df195d8aed 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

llvm-svn: 363749
2019-06-18 22:57:08 +00:00
Aaron Puchert f9c6e565de 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

llvm-svn: 363748
2019-06-18 22:52:39 +00:00
Alex Lorenz 7bfb43985f [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.

llvm-svn: 363742
2019-06-18 21:36:30 +00:00
Alexey Bataev 9f3a805ee9 [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.

llvm-svn: 363734
2019-06-18 20:29:06 +00:00
Alexey Bataev 7ae267dc0f [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.

llvm-svn: 363720
2019-06-18 19:04:27 +00:00
Alexey Bataev 8557d1ac98 [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.

llvm-svn: 363717
2019-06-18 18:39:26 +00:00
Aaron Ballman d4a1c3bb5a Add test cases for dumping AST function decl nodes to JSON; NFC.
llvm-svn: 363709
2019-06-18 17:56:50 +00:00
Aaron Ballman 3559d2224e Add test cases for dumping AST decl nodes to JSON; NFC.
llvm-svn: 363699
2019-06-18 16:36:49 +00:00
Ilya Biryukov 5aed309a4f [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

llvm-svn: 363698
2019-06-18 16:27:27 +00:00
Mikhail Maltsev a45292cbfd [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

llvm-svn: 363687
2019-06-18 14:34:27 +00:00
Matt Arsenault 2acc717627 AMDGPU: Add GWS instruction builtins
llvm-svn: 363684
2019-06-18 14:10:01 +00:00
Matt Arsenault d204987ada AMDGPU: Disable errno by default
llvm-svn: 363682
2019-06-18 13:59:32 +00:00
Aaron Ballman 7a89909c84 Require commas to separate multiple GNU-style attributes in the same attribute list.
Fixes PR38352.

llvm-svn: 363676
2019-06-18 12:57:05 +00:00
Mikael Holmen 5136ea4994 Fix compiler warning by removing unused variable
llvm-svn: 363651
2019-06-18 06:41:56 +00:00
Fangrui Song 2d94dd812f 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.

llvm-svn: 363649
2019-06-18 05:52:39 +00:00
Puyan Lotfi 4d36782446 [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.

llvm-svn: 363648
2019-06-18 05:15:59 +00:00
Puyan Lotfi e86b89ba46 [NFC] Fixing -DBUILD_SHARED_LIBS=ON problem caused by layering issue in D60974
llvm-svn: 363646
2019-06-18 04:40:03 +00:00
Francis Visoiu Mistrih 36a7a98272 [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>`.

llvm-svn: 363627
2019-06-17 22:49:38 +00:00
Puyan Lotfi 8df7f1a218 [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

llvm-svn: 363626
2019-06-17 22:46:54 +00:00
Richard Smith 94bc88ebf4 Fix crash when checking a dependently-typed reference that is
initialized from a non-value-dependent initializer.

llvm-svn: 363622
2019-06-17 21:46:17 +00:00
Richard Smith 5745febe27 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

llvm-svn: 363620
2019-06-17 21:08:30 +00:00
Rainer Orth abccb1ad89 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

llvm-svn: 363612
2019-06-17 20:21:25 +00:00
David Blaikie 4f3b7364a4 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).

llvm-svn: 363606
2019-06-17 19:40:52 +00:00
Michael Liao b8e8b1769f [clang][AST] Remove unnecessary 'const'.
llvm-svn: 363585
2019-06-17 17:47:03 +00:00
Mike Spertus 1f50697abc 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

llvm-svn: 363574
2019-06-17 16:12:45 +00:00
Francis Visoiu Mistrih 34667519dc [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.

llvm-svn: 363573
2019-06-17 16:06:00 +00:00
Kadir Cetinkaya 3c9391aad9 [clang][CodeGen] Remove std::move on temporary
llvm-svn: 363563
2019-06-17 14:23:06 +00:00
Michael Liao e40f879eb2 [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

llvm-svn: 363553
2019-06-17 12:51:36 +00:00
Nico Weber 37b7533682 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

llvm-svn: 363548
2019-06-17 12:10:40 +00:00
Sven van Haastregt 9d81915fca 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

llvm-svn: 363541
2019-06-17 10:06:34 +00:00
Hans Wennborg a9e5d2f35d 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.

llvm-svn: 363529
2019-06-17 07:47:28 +00:00
Don Hinton 9b2d96024a [docs] Fix another bot error by setting highlight language of objc code-block to objc instead of c++.
llvm-svn: 363521
2019-06-16 19:15:04 +00:00
Csaba Dabis 4d4ef2a167 [analyzer] ReturnVisitor: more portable test case
llvm-svn: 363515
2019-06-16 17:29:37 +00:00
Kristof Umann e20b388e2f [analyzer] Push correct version of 'Track indices of arrays'
Messed up the commit, oops.

llvm-svn: 363512
2019-06-16 15:41:25 +00:00
Kristof Umann 33b46a6df0 [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

llvm-svn: 363510
2019-06-16 14:52:56 +00:00
Kristof Umann 9ff09d49da [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

llvm-svn: 363509
2019-06-16 14:09:11 +00:00
Don Hinton 0a29028072 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

llvm-svn: 363502
2019-06-15 20:09:54 +00:00
Aaron Puchert e1dc495e63 [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

llvm-svn: 363496
2019-06-15 15:38:51 +00:00
Aaron Puchert 922759a63d [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

llvm-svn: 363494
2019-06-15 14:07:43 +00:00
Gauthier Harnisch 83c7b61052 [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

llvm-svn: 363493
2019-06-15 10:24:47 +00:00
Csaba Dabis 077f13c612 [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

llvm-svn: 363491
2019-06-15 10:05:49 +00:00
Gauthier Harnisch 0bb4d46b2b [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

llvm-svn: 363488
2019-06-15 08:32:56 +00:00
Ziang Wan 9a2e7784b1 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

llvm-svn: 363475
2019-06-14 23:34:40 +00:00
Craig Topper 9967a6c60a [X86] Add checks that immediate for reducesd/ss fits in 8-bits.
llvm-svn: 363472
2019-06-14 23:23:19 +00:00
Akira Hatanaka 6cb2d9dbd2 [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

llvm-svn: 363467
2019-06-14 22:06:28 +00:00
Ziang Wan af857b93df 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.

llvm-svn: 363464
2019-06-14 21:42:21 +00:00
Francis Visoiu Mistrih 5501dda247 [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

llvm-svn: 363463
2019-06-14 21:38:57 +00:00
Gheorghe-Teodor Bercea 545a9fe106 [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

llvm-svn: 363451
2019-06-14 20:19:54 +00:00
Reid Kleckner 49b965079b Use unsigned for bitfields to avoid sign extension
llvm-svn: 363450
2019-06-14 20:19:29 +00:00
Richard Smith da70fc0c5f PR42071: Reject weird names for non-type template parameters.
Also reject default arguments appearing in invalid locations.

llvm-svn: 363447
2019-06-14 20:01:54 +00:00
Richard Smith 7fa2b74e98 Use getOperatorSpelling to get the spelling of an overloaded operator
rather than duplicating operator name tables in multiple places.

llvm-svn: 363446
2019-06-14 20:01:51 +00:00
Gheorghe-Teodor Bercea 5254f0a9ab [OpenMP] Avoid emitting maps for target link variables when unified memory is used
Summary: This patch avoids the emission of maps for target link variables when unified memory is present.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 363435
2019-06-14 17:58:26 +00:00
Richard Smith 14059d2a13 Remove unused SK_LValueToRValue initialization step.
In addition to being unused and duplicating code, this was also wrong
(it didn't properly mark the operand as being potentially not odr-used).

This reinstates r363340, reverted in r363352.

llvm-svn: 363430
2019-06-14 17:46:39 +00:00
Richard Smith 27252a1f95 PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
nullptr_t does not access memory.

We now reuse CK_NullToPointer to represent a conversion from a glvalue
of type nullptr_t to a prvalue of nullptr_t where necessary.

This reinstates r363337, reverted in r363352.

llvm-svn: 363429
2019-06-14 17:46:38 +00:00
Richard Smith 24cdcadcc5 C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression.
Summary:
When a variable is named in a context where we can't directly emit a
reference to it (because we don't know for sure that it's going to be
defined, or it's from an enclosing function and not captured, or the
reference might not "work" for some reason), we emit a copy of the
variable as a global and use that for the known-to-be-read-only access.

This reinstates r363295, reverted in r363352, with a fix for PR42276:
we now produce a proper name for a non-odr-use reference to a static
constexpr data member. The name <mangled-name>.const is used in that
case; such names are reserved to the implementation for cases such as
this and should demangle nicely.

Reviewers: rjmccall

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 363428
2019-06-14 17:46:37 +00:00
Francis Visoiu Mistrih 7a21113ce8 Reland: [Remarks] Refactor optimization remarks setup
* Add a common function to setup opt-remarks
* Rename common options to the same names
* Add error types to distinguish between file errors and regex errors

llvm-svn: 363415
2019-06-14 16:20:51 +00:00
Yaxun Liu cabce71845 [AMDGPU] Enable the implicit arguments for HIP (CLANG)
Enable 48-bytes of implicit arguments for HIP as well. Earlier it was enabled for OpenCL. This code is specific to AMDGPU target.

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

llvm-svn: 363414
2019-06-14 15:54:47 +00:00
Matt Arsenault 5d0bebcdf2 AMDGPU: Use AMDGPU toolchain for other OSes
This would need more work to actually support them, but this is less
wrong than the default.

llvm-svn: 363390
2019-06-14 13:39:57 +00:00
Nico Weber a1c33ed558 Revert r363298 "[lit] Disable test on darwin when building shared libs."
It broke running check-lld on mac, see https://reviews.llvm.org/D61697

llvm-svn: 363379
2019-06-14 12:58:17 +00:00
Sven van Haastregt e5bd808c3e Revert "[OpenCL] Move OpenCLBuiltins.td and remove unused include"
This reverts commit r363242 as it broke some builds with

  make[2]: *** No rule to make target 'ClangOpenCLBuiltinsImpl', needed by
  'tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaLookup.cpp.o'.

llvm-svn: 363376
2019-06-14 12:14:58 +00:00
Sylvestre Ledru 0f15ba98f5 add a missing parenthese in the clang doc
llvm-svn: 363369
2019-06-14 11:33:40 +00:00
Gauthier Harnisch 796ed03b84 [C++20] add Basic consteval specifier
Summary:
this revision adds Lexing, Parsing and Basic Semantic for the consteval specifier as specified by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html

with this patch, the consteval specifier is treated as constexpr but can only be applied to function declaration.

Changes:
 - add the consteval keyword.
 - add parsing of consteval specifier for normal declarations and lambdas expressions.
 - add the whether a declaration is constexpr is now represented by and enum everywhere except for variable because they can't be consteval.
 - adapt diagnostic about constexpr to print constexpr or consteval depending on the case.
 - add tests for basic semantic.

Reviewers: rsmith, martong, shafik

Reviewed By: rsmith

Subscribers: eraman, efriedma, rnkovacs, cfe-commits

Tags: #clang

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

llvm-svn: 363362
2019-06-14 08:56:20 +00:00
Gauthier Harnisch b63e577444 [clang] Fixing incorrect implicit deduction guides (PR41549)
Summary:
[[ https://bugs.llvm.org/show_bug.cgi?id=41549 | bug report ]]

Before this patch, implicit deduction guides were generated from the first declaration found by lookup.
With this patch implicit deduction guides are generated from the definition of the class template.
Also added test that was previously failing.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, Quuxplusone

Tags: #clang

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

llvm-svn: 363361
2019-06-14 08:40:04 +00:00
Gauthier Harnisch ef629c7ef8 [clang] Don't segfault on incorrect using directive (PR41400)
Summary:
this is a bugfixe for [[ https://bugs.llvm.org/show_bug.cgi?id=41400 | PR41400 ]]

added nullptr check at the relevent place and test

Reviewers: rsmith, riccibruno

Reviewed By: rsmith

Subscribers: jkooker, jkorous, riccibruno, cfe-commits

Tags: #clang

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

llvm-svn: 363360
2019-06-14 08:25:52 +00:00
Nico Weber 3d02b895ed Revert 363295, it caused PR42276. Also revert follow-ups 363337, 363340.
Revert 363340 "Remove unused SK_LValueToRValue initialization step."
Revert 363337 "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type"
Revert 363295 "C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression."

llvm-svn: 363352
2019-06-14 04:05:17 +00:00
George Burgess IV 2c074bb39e [Targets] Move soft-float-abi filtering to `initFeatureMap`
ARM has a special target feature called soft-float-abi. This feature is
special, since we get it passed to us explicitly in the frontend, but
filter it out before it can land in any target feature strings in LLVM
IR.

__attribute__((target(""))) doesn't quite filter these features out
properly, so today, we get warnings about soft-float-abi being an
unknown feature from the backend.

This CL has us filter soft-float-abi out at a slightly different point,
so we don't end up passing these invalid features to the backend.

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

llvm-svn: 363346
2019-06-14 00:35:17 +00:00
Stanislav Mekhanoshin cafccd7a53 [AMDGPU] gfx1011/gfx1012 clang support
Differential Revision: https://reviews.llvm.org/D63308

llvm-svn: 363345
2019-06-14 00:33:59 +00:00
Francis Visoiu Mistrih e4147ea1ef Revert "[Remarks] Refactor optimization remarks setup"
This reverts commit 6e6e3af55b.

This breaks greendragon.

llvm-svn: 363343
2019-06-14 00:05:56 +00:00
Stanislav Mekhanoshin 8a8131a3f6 [AMDGPU] gfx1010 wave32 clang support
Differential Revision: https://reviews.llvm.org/D63209

llvm-svn: 363341
2019-06-13 23:47:59 +00:00
Richard Smith aca017e802 Remove unused SK_LValueToRValue initialization step.
In addition to being unused and duplicating code, this was also wrong
(it didn't properly mark the operand as being potentially not odr-used).

llvm-svn: 363340
2019-06-13 23:47:42 +00:00
Richard Smith 0476d069e3 PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
nullptr_t does not access memory.

We now reuse CK_NullToPointer to represent a conversion from a glvalue
of type nullptr_t to a prvalue of nullptr_t where necessary.

This reinstates r345562, reverted in r346065, now that CodeGen's
handling of non-odr-used variables has been fixed.

llvm-svn: 363337
2019-06-13 23:31:04 +00:00
Amy Huang 49275272e3 Use fully qualified name when printing S_CONSTANT records
Summary:
Before it was using the fully qualified name only for static data members.
Now it does for all variable names to match MSVC.

Reviewers: rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 363335
2019-06-13 22:53:43 +00:00
Francis Visoiu Mistrih 6e6e3af55b [Remarks] Refactor optimization remarks setup
* Add a common function to setup opt-remarks
* Rename common options to the same names
* Add error types to distinguish between file errors and regex errors

llvm-svn: 363328
2019-06-13 21:46:57 +00:00
Don Hinton ed9c7ec73d [lit] Disable test on darwin when building shared libs.
Summary:
This test fails to link shared libraries because tries to run
a copied version of clang-check to see if the mock version of libcxx
in the same directory can be loaded dynamically.  Since the test is
specifically designed not to look in the default just-built lib
directory, it must be disabled when building with
BUILD_SHARED_LIBS=ON.

Currently only disabling it on Darwin and basing it on the
enable_shared flag.

Reviewed By: ilya-biryukov

Tags: #clang, #llvm

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

llvm-svn: 363298
2019-06-13 19:08:49 +00:00
Richard Smith 17965d42f4 C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression.
Summary:
When a variable is named in a context where we can't directly emit a
reference to it (because we don't know for sure that it's going to be
defined, or it's from an enclosing function and not captured, or the
reference might not "work" for some reason), we emit a copy of the
variable as a global and use that for the known-to-be-read-only access.

Reviewers: rjmccall

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 363295
2019-06-13 19:00:16 +00:00
Erich Keane 34ec6929a1 PR42182: Allow thread-local to use __cxa_thread_atexit when
-fno-use-cxx-atexit is used

This matches the GCC behavior, __cxa_thread_atexit should be permissible
even though cxa_atexit is disabled.

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

llvm-svn: 363288
2019-06-13 18:20:19 +00:00
Leonard Chan 09f56b51ec [clang][NewPM] Fix broken -O0 test from missing assumptions
Add an AssumptionCache callback to the InlineFuntionInfo used for the
AlwaysInlinerPass to match codegen of the AlwaysInlinerLegacyPass to generate
llvm.assume. This fixes CodeGen/builtin-movdir.c when new PM is enabled by
default.

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

llvm-svn: 363287
2019-06-13 18:18:40 +00:00
Leonard Chan 9f8ce3feb2 [clang][NewPM] Fix split debug test
This contains the part of D62225 which fixes CodeGen/split-debug-single-file.c
by not placing .dwo sections when using -enable-split-dwarf=split.

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

llvm-svn: 363281
2019-06-13 17:40:03 +00:00
Leonard Chan ab2c0ed01e [clang][NewPM] Fix broken profile test
This contains the part of D62225 which fixes Profile/gcc-flag-compatibility.c
by adding the pass that allows default profile generation to work under the new
PM. It seems that ./default.profraw was not being generated with new PM enabled.

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

llvm-svn: 363278
2019-06-13 17:25:36 +00:00
Leonard Chan 587497b87d [clang][NewPM] Fix broken -O0 test from the AlwaysInliner
This contains the part of D62225 which prevents insertion of lifetime
intrinsics when creating the AlwaysInliner. This fixes the following tests
when the new PM is enabled by default:

Clang :: CodeGen/aarch64-neon-across.c
Clang :: CodeGen/aarch64-neon-fcvt-intrinsics.c
Clang :: CodeGen/aarch64-neon-fma.c
Clang :: CodeGen/aarch64-neon-perm.c
Clang :: CodeGen/aarch64-neon-tbl.c
Clang :: CodeGen/aarch64-poly128.c
Clang :: CodeGen/aarch64-v8.2a-neon-intrinsics.c
Clang :: CodeGen/arm-neon-fma.c
Clang :: CodeGen/arm-neon-numeric-maxmin.c
Clang :: CodeGen/arm-neon-vcvtX.c
Clang :: CodeGen/avx-builtins.c
Clang :: CodeGen/builtins-ppc-p9vector.c
Clang :: CodeGen/builtins-ppc-vsx.c
Clang :: CodeGen/lifetime.c
Clang :: CodeGen/sse-builtins.c
Clang :: CodeGen/sse2-builtins.c

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

llvm-svn: 363277
2019-06-13 16:45:29 +00:00
Dmitri Gribenko 31d68804fd Added AST matcher for ignoring elidable constructors
Summary: Added AST matcher for ignoring elidable move constructors

Reviewers: hokein, gribozavr

Reviewed By: hokein, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

Patch by Johan Vikström.

llvm-svn: 363262
2019-06-13 13:48:24 +00:00
Sven van Haastregt 95a9ee5e2f [OpenCL] Move OpenCLBuiltins.td and remove unused include
Patch by Pierre Gondois.

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

llvm-svn: 363242
2019-06-13 09:54:22 +00:00
Sam Clegg 818dd8666a [WebAssembly] Modernize include path handling
Move include path construction from
InitHeaderSearch::AddDefaultIncludePaths in the Driver which appears
to be the more modern/correct way of doing things.

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

llvm-svn: 363241
2019-06-13 09:42:43 +00:00
Sam Clegg f9ad6e57d9 [clang-scan-deps] Fix -DBUILD_SHARED_LIBS=ON build
The -DBUILD_SHARED_LIBS=ON build was broken in rL363204

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

llvm-svn: 363238
2019-06-13 08:58:46 +00:00
Hans Wennborg 1f05320763 clang-format extension: Widen the supported versions range
So that it covers also the latest VS 2019 version.

By Antonio Maiorano!

llvm-svn: 363230
2019-06-13 07:07:24 +00:00
David L. Jones c73fadaa84 Revert r361811: 'Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors ...'
We have observed some failures with internal builds with this revision.

- Performance regressions:
  - llvm's SingleSource/Misc evalloop shows performance regressions (although these may be red herrings).
  - Benchmarks for Abseil's SwissTable.
- Correctness:
  - Failures for particular libicu tests when building the Google AppEngine SDK (for PHP).

hwennborg has already been notified, and is aware of reproducer failures.

llvm-svn: 363220
2019-06-13 02:04:45 +00:00
Alex Lorenz d264351628 [clang-scan-deps] Include <mutex> in ClangScanDeps.cpp to ensure it
builds on all platforms

llvm-svn: 363208
2019-06-12 21:52:36 +00:00
Alex Lorenz b66be8c4d3 NFC, Update the ClangScanDeps.cpp file's license comment
The file ClangScanDeps.cpp from r363204 had the old outdated LLVM
license comment at the top of the file that I committed by accident.

llvm-svn: 363207
2019-06-12 21:45:28 +00:00
Alex Lorenz aeffc15f97 NFC, fixup indentation in CMakeLists.txt from r363204 as requested
in the review.

I missed that review comment from https://reviews.llvm.org/D60233 in the original
commit.

llvm-svn: 363205
2019-06-12 21:37:32 +00:00
Alex Lorenz f36d83735e [clang-scan-deps] initial outline of the tool that runs preprocessor to find
dependencies over a JSON compilation database

This commit introduces an outline for the clang-scan-deps tool that will be
used to implement fast dependency discovery phase using implicit modules for
explicit module builds.

The initial version of the tool works by computing non-modular header dependencies
for files in the compilation database without any optimizations
(i.e. without source minimization from r362459).
The tool spawns a number of worker threads to run the clang compiler workers in parallel.

The immediate goal for clang-scan-deps is to create a ClangScanDeps library
which will be used to build up this tool to use the source minimization and
caching multi-threaded filesystem to implement the optimized non-incremental
dependency scanning phase for a non-modular build. This will allow us to do
benchmarks and comparisons for performance that the minimization and caching give us

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

llvm-svn: 363204
2019-06-12 21:32:49 +00:00
Alex Lorenz 514cfdb18d [test] Reinstate the assignment to the diagnostic log in the unittest
from r363009

The diagnostic log is now set to "-" which forces it to use STDERR
instead of the filesystem. A new comment is added to explain why
the assignment is needed in the test.

llvm-svn: 363199
2019-06-12 20:35:44 +00:00
Reid Kleckner b05ce7f9f7 Add comment to r363191 code as requested in code review
llvm-svn: 363195
2019-06-12 19:50:06 +00:00
Reid Kleckner 4e9538997e [MS] Pretend constexpr variable template specializations are inline
Fixes link errors with clang and the latest Visual C++ 14.21.27702
headers, which was reported as PR42027.

I chose to intentionally make these things linkonce_odr, i.e.
discardable, so that we don't emit definitions of these things in every
translation unit that includes STL headers.

Note that this is *not* what MSVC does: MSVC has not yet implemented C++
DR2387, so they emit fully specialized constexpr variable templates with
static / internal linkage.

Reviewers: rsmith

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

llvm-svn: 363191
2019-06-12 18:53:49 +00:00
Richard Smith c69cc84253 PR42220: take into account the possibility of aggregates with base
classes when checking an InitListExpr for lifetime extension.

llvm-svn: 363188
2019-06-12 18:32:22 +00:00
Csaba Dabis fa880e6114 [analyzer] ProgramPoint: more explicit printJson()
Summary: Now we print out every possible kinds of ProgramPoints.

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/D62946

llvm-svn: 363187
2019-06-12 18:24:02 +00:00
Nikolai Kosjar 6fab7d0ef2 [NFC] Test commit
llvm-svn: 363127
2019-06-12 07:50:48 +00:00
Zi Xuan Wu cc12f68fff [PowerPC] [Clang] Port SSE2 intrinsics to PowerPC
Port emmintrin.h which include Intel SSE2 intrinsics implementation to PowerPC platform (using Altivec).

The new headers containing those implemenations are located into a directory named ppc_wrappers
which has higher priority when the platform is PowerPC on Linux. They are mainly developed by Steven Munroe,
with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu.

It's a follow-up patch of D62121.

Patched by: Qiu Chaofan <qiucf@cn.ibm.com>

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

llvm-svn: 363122
2019-06-12 05:25:40 +00:00
Pengfei Wang fbfee60c32 [X86] [ABI] Fix i386 ABI "__m64" type bug
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

llvm-svn: 363116
2019-06-12 01:52:23 +00:00
Richard Smith 7f61d44178 Mark declarations as referenced by a default argument in a
potentially-evaluated context.

This applies even if the use of the default argument is within an
unevaluated context.

llvm-svn: 363113
2019-06-11 23:51:46 +00:00
Richard Smith 36bd1c90d0 Remove redundant check for whether a DeclRefExpr that names a capture
constitutes an odr-use.

We now track this accurately on the DeclRefExpr.

llvm-svn: 363088
2019-06-11 17:50:37 +00:00
Richard Smith 1bbad59379 For DR712: store on a MemberExpr whether it constitutes an odr-use.
llvm-svn: 363087
2019-06-11 17:50:36 +00:00
Richard Smith 715f7a1bd0 For DR712: store on a DeclRefExpr whether it constitutes an odr-use.
Begin restructuring to support the forms of non-odr-use reference
permitted by DR712.

llvm-svn: 363086
2019-06-11 17:50:32 +00:00
Yaxun Liu 1362ffbc21 Revert r344630 Disable code object version 3 for HIP toolchain.
Remove the workaround so that by default code object v3 is enabled.

llvm-svn: 363076
2019-06-11 15:05:11 +00:00
Erich Keane d65ef6735a Fix for r42230, MSVC test failure in DependencyDirectivesSourceMinimizerTest.cpp
r362459 introduced DependencyDirectivesSourceMinimizerTest.cpp, which
hits an MSVC bug:
developercommunity.visualstudio.com/content/problem/67300/stringifying-raw-string-literal.html

This only happens when the parameter to a macro is stringified in the
macro.  This patch removes the string from the assert so that the
warning no longer happens.

llvm-svn: 363074
2019-06-11 14:58:26 +00:00
Hubert Tong 11db920f74 [NFC][PowerPC] Header-dependent test requires "native"
Two recently added tests mention complications for cross-compile, but
they do not actually enforce native compilation. This patch makes them
require native compilation to avoid the complications they mention.

llvm-svn: 363070
2019-06-11 14:23:55 +00:00
Hubert Tong 61c848d254 Reapply r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"
Following r363007, which reverted r362998, r362996, and r362994,
reapply with adjustments for the CRLF differences encountered with
Windows. Namely, the `-b` option of `diff` is employed, and the `grep`
patterns have `$` replaced with `[[:space:]]*$`.

llvm-svn: 363069
2019-06-11 14:21:32 +00:00
Nikolai Kosjar 8edd8da487 [libclang] Allow skipping warnings from all included files
Depending on the included files and the used warning flags, e.g. -
Weverything, a huge number of warnings can be reported for included
files. As processing that many diagnostics comes with a performance
impact and not all clients are interested in those diagnostics, add a
flag to skip them.

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

llvm-svn: 363067
2019-06-11 14:14:24 +00:00
Gabor Marton dd2b76e13e [ASTImporter] Fix unhandled cases in ASTImporterLookupTable
Summary:
In most cases the FriendDecl contains the declaration of the befriended
class as a child node, so it is discovered during the recursive
visitation. However, there are cases when the befriended class is not a
child, thus it must be fetched explicitly from the FriendDecl, and only
then can we add it to the lookup table.
(Note, this does affect only CTU and does not affect LLDB, because we
cannot and do not use the ASTImporterLookupTable in LLDB.)

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

llvm-svn: 363062
2019-06-11 13:35:25 +00:00
Lewis Revill 22196f0f69 [RISCV][NFC] Add missing test files for D54091
llvm-svn: 363056
2019-06-11 12:49:15 +00:00
Lewis Revill 5665ef3dcc [RISCV] Add inline asm constraints I, J & K for RISC-V
This allows the constraints I, J & K to be used in inline asm for
RISC-V, with the following semantics (equivalent to GCC):

I: Any 12-bit signed immediate.
J: Integer zero only.
K: Any 5-bit unsigned immediate.

See the GCC definitions here:
https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html

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

llvm-svn: 363055
2019-06-11 12:44:01 +00:00
Ilya Biryukov 1f6c602704 Make sure a test from r363036 does not write into a working directory
It breaks if build directory is not writable. This change is required
to fix our integrate.

Also add a flush() call, otherwise time trace option does not produce
the full output.

llvm-svn: 363052
2019-06-11 12:05:03 +00:00
Ilya Biryukov edea75d6f4 [Frontend] Avoid creating auxilary files during a unit test. NFC
A test added in r363009 logs diagnostics into a file inside current
working directory. This breaks when the directory is not writable.

This looks like a debugging output in the first place, the test passes
without it anyway.

llvm-svn: 363041
2019-06-11 09:52:30 +00:00
Anton Afanasyev 7599da5718 [Support][Test] Time profiler: add regression test
Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

This is recommit of r362821

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

llvm-svn: 363036
2019-06-11 08:25:54 +00:00
Pengfei Wang 244062eece [X86] Enable intrinsics that convert float and bf16 data to each other
Scalar version :
_mm_cvtsbh_ss , _mm_cvtness_sbh

Vector version:
_mm512_cvtpbh_ps , _mm256_cvtpbh_ps
_mm512_maskz_cvtpbh_ps , _mm256_maskz_cvtpbh_ps
_mm512_mask_cvtpbh_ps , _mm256_mask_cvtpbh_ps

Patch by Shengchen Kan (skan)

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

llvm-svn: 363018
2019-06-11 01:17:28 +00:00
Alex Lorenz 88377d8db7 [Frontend] SetUpDiagnosticLog should handle unowned diagnostic consumer
in the compiler

The function SetUpDiagnosticLog that was called from createDiagnostics didn't
handle the case where the diagnostics engine didn't own the diagnostics consumer.
This is a potential problem for a clang tool, in particular some of the follow-up
patches for clang-scan-deps will need this fix.

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

llvm-svn: 363009
2019-06-10 23:32:42 +00:00
Reid Kleckner e7ea1834f4 Revert r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"
Reverts r362998, r362996, and r362994 because the tests do not pass on
Windows due to CRLF changes. Adding back `-w` to diff is not enough, the
new grep substitution doesn't work on Windows, and fixing it is
non-trivial.

llvm-svn: 363007
2019-06-10 23:25:43 +00:00
Reid Kleckner e78333a010 Require stdcall etc parameters to be complete on ODR use
Functions using stdcall, fastcall, or vectorcall with C linkage mangle
in the size of the parameter pack. Calculating the size of the pack
requires the parameter types to complete, which may require template
instantiation.

Previously, we would crash during IRgen when requesting the size of
incomplete or uninstantiated types, as in this reduced example:
  struct Foo;
  void __fastcall bar(struct Foo o);
  void (__fastcall *fp)(struct Foo) = &bar;

Reported in Chromium here: https://crbug.com/971245

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

llvm-svn: 363000
2019-06-10 22:53:12 +00:00
Hubert Tong dbc85509ba [analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)
Summary:
The `%diff_plist` 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.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `tail`. `%diff_plist` is then, being unused, removed.

The changes were applied via a script.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

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/D62951

llvm-svn: 362998
2019-06-10 22:40:35 +00:00
Hubert Tong 65db5d4cb5 [analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)
Summary:
The `%diff_plist` 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.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `cat`.

The changes were applied via a script, except that
`clang/test/Analysis/NewDelete-path-notes.cpp` and
`clang/test/Analysis/plist-macros-with-expansion.cpp` were each adjusted
for the line-continuation on the relevant `RUN` step.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

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/D62950

llvm-svn: 362996
2019-06-10 22:37:31 +00:00
Hubert Tong c867b92217 [analyzer][tests] Add normalize_plist to replace diff_plist
Summary:
The `%diff_plist` 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.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html to the
specific case shown in the list message. Mechanical changes to the other
affected files will follow in later patches.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ

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/D62949

llvm-svn: 362994
2019-06-10 22:33:34 +00:00
Hubert Tong 9df9cbafce [PlistSupport] Produce a newline to end plist output files
Summary:
As suggested in the review of D62949, this patch updates the plist
output to have a newline at the end of the file. This makes it so that
the plist output file qualifies as a POSIX text file, which increases
the consumability of the generated plist file in relation to various
tools.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ, xingxue

Subscribers: jsji, cfe-commits

Tags: #clang

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

llvm-svn: 362992
2019-06-10 22:30:57 +00:00
Hubert Tong a2c2d731db [CUDA] Fix grep pattern in cuda-types.cu
Summary:
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 EREs instead.

Additionally, the pattern is further fixed so that `SIZEOF` and `WIDTH`
macros are checked.

Reviewers: jlebar, daltenty, xingxue, jasonliu, tra

Reviewed By: tra

Subscribers: jfb, jsji, cfe-commits

Tags: #clang

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

llvm-svn: 362991
2019-06-10 22:28:20 +00:00
Craig Topper 8e1f3a0538 [X86] Attempt to make the Intel core CPU inheritance a little more readable and maintainable
The recently added cooperlake CPU has made our already ugly switch statement even worse. There's a CPU exclusion list around the bf16 feature in the cooper lake block. I worry that we'll have to keep adding new CPUs to that until bf16 intercepts a client space CPU. We have several other exclusion lists in other parts of the switch due to skylakeserver, cascadelake, and cooperlake not having sgx. Another for cannonlake not having clwb but having all other features from skx.

This removes all these special ifs at the cost of some duplication of features and a goto. I've copied all of the skx features into either cannonlake or icelakeclient(for clwb). And pulled sklyakeserver, cascadelake, and cooperlake out of the main inheritance chain into their own chain. At the end of skylakeserver we merge back into the main chain at skylakeclient but below sgx. I think this is at least easier to follow.

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

llvm-svn: 362965
2019-06-10 16:59:28 +00:00
Sam Clegg 582eaca379 [WebAssembly] Cleanup toolchain test files. NFC.
Summary: Split up long lines to improve test readability.

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

Tags: #clang

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

llvm-svn: 362959
2019-06-10 16:18:04 +00:00
Sam McCall 3dea527258 Re-land "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."
ShadowMapEntry is now really, truly a normal class.

llvm-svn: 362950
2019-06-10 15:17:52 +00:00
Sam McCall 306e474b91 Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."
This reverts commit r362924, which causes a double-free of ShadowMapEntry.

llvm-svn: 362944
2019-06-10 14:55:57 +00:00
Sam McCall 94600e466c Revert "Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.""
This reverts commit r362830, and relands r362785 with the leak fixed.

llvm-svn: 362924
2019-06-10 09:52:09 +00:00
Kristof Umann 4cc6d72bb4 [analyzer][NFC] Add dividers to BugReporterVisitors.cpp
Some minor formatting to make the file more readable.
Added //===----------===// around the implementation of class methods
and divided anonymous namespaces as per
https://llvm.org/docs/CodingStandards.html#anonymous-namespaces

llvm-svn: 362887
2019-06-08 20:25:39 +00:00
Hubert Tong 15e3e95263 [analyzer][NFC][tests] Pre-normalize expected-plists
As suggested in the review for D62949, this patch pre-normalizes the
reference expected output plist files by removing lines containing
fields for which we expect differences that should be ignored.

llvm-svn: 362877
2019-06-08 13:51:37 +00:00
Hubert Tong 7081efcc58 [analyzer][NFC][tests] Remove unused expected-plist files
llvm-svn: 362876
2019-06-08 13:48:25 +00:00
David Blaikie 8472fa6c54 DebugInfo: Add support for 'nodebug' attribute on typedefs and alias templates
Seems like a logical extension to me - and of interest because it might
help reduce the debug info size of libc++ by applying this attribute to
type traits that have a disproportionate debug info cost compared to the
benefit (& possibly harm/confusion) they cause users.

llvm-svn: 362856
2019-06-08 00:01:21 +00:00
Keno Fischer 6f48c07620 [analyzer] Add werror flag for analyzer warnings
Summary:
We're using the clang static analyzer together with a number of
custom analyses in our CI system to ensure that certain invariants
are statiesfied for by the code every commit. Unfortunately, there
currently doesn't seem to be a good way to determine whether any
analyzer warnings were emitted, other than parsing clang's output
(or using scan-build, which then in turn parses clang's output).
As a simpler mechanism, simply add a `-analyzer-werror` flag to CC1
that causes the analyzer to emit its warnings as errors instead.
I briefly tried to have this be `Werror=analyzer` and make it go
through that machinery instead, but that seemed more trouble than
it was worth in terms of conflicting with options to the actual build
and special cases that would be required to circumvent the analyzers
usual attempts to quiet non-analyzer warnings. This is simple and it
works well.

Reviewed-By: NoQ, Szelethusw
Differential Revision: https://reviews.llvm.org/D62885

llvm-svn: 362855
2019-06-07 23:34:00 +00:00
Peter Collingbourne 5f55544cae Relax test so that the clang binary doesn't need to be named "clang".
llvm-svn: 362836
2019-06-07 20:26:47 +00:00
Vlad Tsyrklevich a6283b06fe Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."
This reverts commit f1f6e0fc24, it was
causing LSan failures on the sanitizer bots:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/32809

llvm-svn: 362830
2019-06-07 19:18:30 +00:00
Peter Collingbourne e08e68de21 Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.
Differential Revision: https://reviews.llvm.org/D62636

llvm-svn: 362829
2019-06-07 19:10:08 +00:00
Anton Afanasyev 07e3f3d9e4 Revert "[Support][Test] Time profiler: add regression test"
This reverts commit 44282a60c9.
This breaks buildbot.

llvm-svn: 362824
2019-06-07 18:35:58 +00:00
Anton Afanasyev 44282a60c9 [Support][Test] Time profiler: add regression test
Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

> llvm-svn: 362792

llvm-svn: 362821
2019-06-07 18:13:48 +00:00
Simon Pilgrim 96c421ddac Revert rL362792 : [Support][Test] Time profiler: add regression test
Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D61914
........
Breaks buildbots - @anton-afanasyev please can you take a look?

llvm-svn: 362816
2019-06-07 17:37:04 +00:00
David Green 5482315a73 [ARM] Add ACLE feature macros for MVE.
Fixup uninitialised variable.

llvm-svn: 362814
2019-06-07 17:28:12 +00:00
Ilya Biryukov 37e1b41f1b AST Matchers tutorial requests to enable clang-tools-extra. NFC
Otherwise the examples do not build.

llvm-svn: 362812
2019-06-07 16:31:06 +00:00
David Tenty a8d13df412 Build with _XOPEN_SOURCE defined on AIX
Summary:
It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open
and POSIX compatibility mode, to work around stray macros and other
bugs in the headers provided by the system and build compiler.

This patch adds the config to cmake to build with _XOPEN_SOURCE defined
on AIX with a few exceptions. Google Test internals require access to
platform specific thread info constructs on AIX so in that case we build
with _ALL_SOURCE defined instead. Libclang also uses header which needs
_ALL_SOURCE on AIX so we leave that as is as well.

We also add building on AIX with the large file API and doing CMake
header checks with X/OPEN definitions so the results are consistent with
the environment that will be present in the build.

Reviewers: hubert.reinterpretcast, xingxue, andusy

Reviewed By: hubert.reinterpretcast

Subscribers: mgorny, jsji, cfe-commits, llvm-commits

Tags: #llvm, #clang

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

llvm-svn: 362808
2019-06-07 15:45:25 +00:00
Sjoerd Meijer 4ea248eb56 [ARM] Add ACLE feature macros for MVE
If MVE is present at all, then the macro __ARM_FEATURE_MVE is defined
to a value which has bit 0 set for integer MVE, and bit 1 set for
floating-point MVE.

(Floating-point MVE implies integer MVE, so if this macro is defined
at all then it will be set to 1 or 3, never 2.)

Patch mostly by Simon Tatham

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

llvm-svn: 362806
2019-06-07 15:20:56 +00:00
Anton Afanasyev f2ddd60836 [Support][Test] Time profiler: add regression test
Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 362792
2019-06-07 12:59:32 +00:00
Simon Tatham 5d66f2b0af [ARM] Fix bugs introduced by the fp64/d32 rework.
Change D60691 caused some knock-on failures that weren't caught by the
existing tests. Firstly, selecting a CPU that should have had a
restricted FPU (e.g. `-mcpu=cortex-m4`, which should have 16 d-regs
and no double precision) could give the unrestricted version, because
`ARM::getFPUFeatures` returned a list of features including subtracted
ones (here `-fp64`,`-d32`), but `ARMTargetInfo::initFeatureMap` threw
away all the ones that didn't start with `+`. Secondly, the
preprocessor macros didn't reliably match the actual compilation
settings: for example, `-mfpu=softvfp` could still set `__ARM_FP` as
if hardware FP was available, because the list of features on the cc1
command line would include things like `+vfp4`,`-vfp4d16` and clang
didn't realise that one of those cancelled out the other.

I've fixed both of these issues by rewriting `ARM::getFPUFeatures` so
that it returns a list that enables every FP-related feature
compatible with the selected FPU and disables every feature not
compatible, which is more verbose but means clang doesn't have to
understand the dependency relationships between the backend features.
Meanwhile, `ARMTargetInfo::handleTargetFeatures` is testing for all
the various forms of the FP feature names, so that it won't miss cases
where it should have set `HW_FP` to feed into feature test macros.

That in turn caused an ordering problem when handling `-mcpu=foo+bar`
together with `-mfpu=something_that_turns_off_bar`. To fix that, I've
arranged that the `+bar` suffixes on the end of `-mcpu` and `-march`
cause feature names to be put into a separate vector which is
concatenated after the output of `getFPUFeatures`.

Another side effect of all this is to fix a bug where `clang -target
armv8-eabi` by itself would fail to set `__ARM_FEATURE_FMA`, even
though `armv8` (aka Arm v8-A) implies FP-Armv8 which has FMA. That was
because `HW_FP` was being set to a value including only the `FPARMV8`
bit, but that feature test macro was testing only the `VFP4FPU` bit.
Now `HW_FP` ends up with all the bits set, so it gives the right
answer.

Changes to tests included in this patch:

* `arm-target-features.c`: I had to change basically all the expected
  results. (The Cortex-M4 test in there should function as a
  regression test for the accidental double-precision bug.)
* `arm-mfpu.c`, `armv8.1m.main.c`: switched to using `CHECK-DAG`
  everywhere so that those tests are no longer sensitive to the order
  of cc1 feature options on the command line.
* `arm-acle-6.5.c`: been updated to expect the right answer to that
  FMA test.
* `Preprocessor/arm-target-features.c`: added a regression test for
  the `mfpu=softvfp` issue.

Reviewers: SjoerdMeijer, dmgreen, ostannard, samparker, JamesNagurne

Reviewed By: ostannard

Subscribers: srhines, javed.absar, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 362791
2019-06-07 12:42:54 +00:00
Russell Gallop 4bcba163b1 [X86][test] Add test cases using immediates to builtins-x86.c
These builtins should work with immediate or variable shift operand for
gcc compatibility.

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

llvm-svn: 362786
2019-06-07 09:51:44 +00:00
Sam McCall f1f6e0fc24 [CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.
Summary:
- when a method is not available because of the target value kind (e.g. an &&
  method on a Foo& variable), then don't offer it.
- when a method is effectively shadowed by another method from the same class
  with a) an identical argument list and b) superior qualifiers, then don't
  offer it.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 362785
2019-06-07 09:45:17 +00:00
Pengfei Wang 30bcda86db [X86] -march=cooperlake (clang)
Support intel -march=cooperlake in clang

Patch by Shengchen Kan (skan)

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

llvm-svn: 362781
2019-06-07 08:53:37 +00:00
Richard Smith 84be998497 Factor out duplicated code building a MemberExpr and marking it
referenced.

This reinstates r362563, reverted in r362597.

llvm-svn: 362757
2019-06-06 23:24:18 +00:00
Richard Smith dcf17ded66 Convert MemberExpr creation and serialization to work the same way as
most / all other Expr subclasses.

This reinstates r362551, reverted in r362597, with a fix to a bug that
caused MemberExprs to sometimes have a null FoundDecl after a round-trip
through an AST file.

llvm-svn: 362756
2019-06-06 23:24:15 +00:00
Francois Ferrand e8a301f87f clang-format: better handle namespace macros
Summary:
Other macros are used to declare namespaces, and should thus be handled
similarly. This is the case for crpcut's TESTSUITE macro, or for
unittest-cpp's SUITE macro:

      TESTSUITE(Foo) {
      TEST(MyFirstTest) {
        assert(0);
      }
      } // TESTSUITE(Foo)

This patch deals with this cases by introducing a new option to specify
lists of namespace macros. Internally, it re-uses the system already in
place for foreach and statement macros, to ensure there is no impact on
performance.

Reviewers: krasimir, djasper, klimek

Reviewed By: klimek

Subscribers: acoomans, cfe-commits, klimek

Tags: #clang

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

llvm-svn: 362740
2019-06-06 20:06:23 +00:00
Kadir Cetinkaya 51f85b40bc [clang][HeaderSearch] Consider all path separators equal
Reviewers: ilya-biryukov, sammccall

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 362731
2019-06-06 18:49:16 +00:00
Yitzhak Mandelbaum 2e4a628c06 [LibTooling] Add insert/remove convenience functions for creating `ASTEdit`s.
Summary: `change()` is an all purpose function; the revision adds simple shortcuts for the specific operations of inserting (before/after) or removing source.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 362707
2019-06-06 14:20:29 +00:00
Pengfei Wang 3a29f7c99c [X86] Add ENQCMD instructions
For more details about these instructions, please refer to the latest
ISE document:
https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference.

Patch by Tianqing Wang (tianqing)

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

llvm-svn: 362685
2019-06-06 08:28:42 +00:00
Ilya Biryukov 0d02dc6054 Update AST matchers tutorial to use monorepo layout
The docs were inconsistent: requesting the user to clone the monorepo,
and then continuing with the `llvm/tools/clang` layout.

Follow-up to a question on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2019-June/062518.html

llvm-svn: 362683
2019-06-06 08:06:25 +00:00
Thomas Lively 5e7ca755d8 [WebAssembly] Support Leak Sanitizer on Emscripten
Summary:
LSan is currently being ported to Emscripten and mostly works.

Enabling the support in upstream would simplify testing.

Patch by Guanzhong Chen.

Reviewers: tlively, aheejin

Reviewed By: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

llvm-svn: 362667
2019-06-06 01:38:12 +00:00
Tim Northover c46827c7ed LLVM IR: Generate new-style byval-with-Type from Clang
LLVM IR recently added a Type parameter to the byval Attribute, so that
when pointers become opaque and no longer have an element type the
information will still be present in IR.

For now the Type parameter is optional (which is why Clang didn't need
this change at the time), but it will become mandatory soon.

llvm-svn: 362652
2019-06-05 21:12:14 +00:00
Akira Hatanaka 9423f5ef56 Fix FileCheck prefixes in test case.
llvm-svn: 362651
2019-06-05 21:11:06 +00:00
Jan Korous a3701caad8 [clang-format][NFC] Fix BS_Allman style example in the header docs are generated from
Differential Revision: https://reviews.llvm.org/D61729

llvm-svn: 362646
2019-06-05 20:59:48 +00:00
Pengxuan Zheng e34d1a4e07 [cmake] Remove duplicate TestingSupport library for linking
Summary: This patch cleans up a duplicate use of TestingSupport library.

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 362637
2019-06-05 19:44:08 +00:00
Csaba Dabis 84cfca0f2b [analyzer] PathDiagnosticPopUpPiece: working with CharSourceRange
Summary: Sometimes we are at character boundaries so past the token-range.
llvm-svn: 362632
2019-06-05 18:55:39 +00:00
Chris Bieneman b67cb3cda0 Use LTO capable linker
Summary:
In DistributionExample.cmake be sure we use a LTO
capable linker, the easiest to choose is lld.

Reviewers: beanz

Reviewed By: beanz

Patch By: winksaville

Subscribers: mgorny, mehdi_amini, inglorion, dexonsmith, cfe-commits

Tags: #clang

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

llvm-svn: 362624
2019-06-05 17:35:38 +00:00
Anastasia Stulova d97ea1bc1a [Clang] Fix pretty printing of CUDA address spaces
Patch by richardmembarth (Richard Membarth)!

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

llvm-svn: 362623
2019-06-05 17:29:00 +00:00
Anastasia Stulova 7ca9b978c4 [OpenCL][PR42031] Prevent deducing addr space in type alias.
Similar to typedefs we shouldn't deduce addr space in
type alias.
 
Differential Revision: https://reviews.llvm.org/D62591

llvm-svn: 362611
2019-06-05 14:50:01 +00:00
Erich Keane da59652c1b Avoid using NoThrow Exception Specifier in non-C++ Modes.
As reported in https://bugs.llvm.org/show_bug.cgi?id=42113, there are a
number of locations in Clang where it is assumed that exception
specifications are only valid in C++ mode. Since the original
justification for the NoThrow Exception Specifier Type was C++ related,
this patch just makes C mode use the attribute-based nothrow handling.

Additionally, I noticed that the handling of non-prototype functions
regressed the behavior of the nothrow attribute, in part because it is
was listed in the function type macro(which I did in the previous
patch).  In reality, it should only be doing so in a conditional nature,
so this patch removes it there and puts it directly in the switch to be
handled correctly.

llvm-svn: 362607
2019-06-05 14:10:39 +00:00
Anastasia Stulova 5145b1e442 [Sema] Prevent binding incompatible addr space ref to temporaries
References to arbitrary address spaces can't always be bound to
temporaries. This change extends the reference binding logic to
check that the address space of a temporary can be implicitly
converted to the address space in a reference when temporary
materialization is performed.

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

llvm-svn: 362604
2019-06-05 14:03:34 +00:00
Sjoerd Meijer f95e6c0653 [ARM] Allow "-march=foo+fp" to vary with foo
Now, when clang processes an argument of the form "-march=foo+x+y+z",
then instead of calling getArchExtFeature() for each of the extension
names "x", "y", "z" and appending the returned string to its list of
low-level subtarget features, it will call appendArchExtFeatures()
which does the appending itself.

The difference is that appendArchExtFeatures can add _more_ than one
low-level feature name to the output feature list if it has to, and
also, it gets told some information about what base architecture and
CPU the extension is going to go with, which means that "+fp" can now
mean something different for different CPUs. Namely, "+fp" now selects
whatever the _default_ FPU is for the selected CPU and/or
architecture, as defined in the ARM_ARCH or ARM_CPU_NAME macros in
ARMTargetParser.def.

On the clang side, I adjust DecodeARMFeatures to call the new
appendArchExtFeatures function in place of getArchExtFeature. This
means DecodeARMFeatures needs to be passed a CPU name and an ArchKind,
which meant changing its call sites to make those available, and also
sawing getLLVMArchSuffixForARM in half so that you can get an ArchKind
enum value out of it instead of a string.

Also, I add support here for the extension name "+fp.dp", which will
automatically look through the FPU list for something that looks just
like the default FPU except for also supporting double precision.

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

llvm-svn: 362601
2019-06-05 13:12:01 +00:00
Benjamin Kramer 9b2b8ad8b1 Revert "Factor out duplicated code building a MemberExpr and marking it" and "Convert MemberExpr creation and serialization to work the same way as"
This reverts commits r362551 and r362563. Crashes during modules selfhost.

llvm-svn: 362597
2019-06-05 11:46:57 +00:00
Michal Gorny 2ae86d2089 [clang] [test] Add a (xfailing) test for PR41027
Add a test for tracking PR41027 (8.0 regression breaking assembly code
relying on __builtin_constant_p() to identify compile-time constants).
Mark it as expected to fail everywhere.

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

llvm-svn: 362587
2019-06-05 08:21:42 +00:00
Petr Hosek 9d8d0f68fb [CMake][Fuchsia] Use libc++ ABIv2 for the first stage build
This also unifies flags between macOS and Linux builds.

llvm-svn: 362585
2019-06-05 06:58:41 +00:00
Serge Guelton 4cd07dbeec Reduce memory consumption of coverage dumps
Avoiding an intermediate join operation removes the need for an
intermediate buffer that may be quite large, as showcased by

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

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

llvm-svn: 362584
2019-06-05 06:35:10 +00:00
Kristina Brooks c0eb8a9825 Add __FILE_NAME__ to ReleaseNotes. NFC
Added it under C language changes as a nonstandard
extension for the time being.

llvm-svn: 362581
2019-06-05 03:47:02 +00:00
Petr Hosek 516e6cc1dd [Clang] Disable new PM for tests that use optimization level -O1, -O2 and -O3
Tests that use -O1, -O2 and -O3 would often produce different results
with the new pass manager which makes these tests fail. Disable new PM
explicitly for these tests.

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

llvm-svn: 362580
2019-06-05 03:17:11 +00:00
Artem Dergachev 44fb55bf96 [analyzer] exploded-graph-rewriter: Add the missing license header!
llvm-svn: 362575
2019-06-05 02:09:49 +00:00
Artem Dergachev 1611cc1cba [analyzer] exploded-graph-rewriter: Pick up python from cmake in tests.
This should fix NetBSD buildbots.

llvm-svn: 362574
2019-06-05 02:09:29 +00:00
Nemanja Ivanovic 6321c68065 Initial support for vectorization using MASSV (IBM MASS vector library)
Part 2 (the Clang portion) of D59881.

This patch (first of two patches) enables the vectorizer to recognize the
IBM MASS vector library routines. This patch specifically adds support for
recognizing the -vector-library=MASSV option, and defines mappings from IEEE
standard scalar math functions to generic PowerPC MASS vector counterparts.
For instance, the generic PowerPC MASS vector entry for double-precision
cbrt function is __cbrtd2_massv.

The second patch will further lower the generic PowerPC vector entries to
PowerPC subtarget-specific entries.
For instance, the PowerPC generic entry cbrtd2_massv is lowered to
cbrtd2_P9 for Power9 subtarget.

The overall support for MASS vector library is presented as such in two patches
for ease of review.

Patch by Jeeva Paudel.

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

llvm-svn: 362571
2019-06-05 01:57:57 +00:00
Richard Smith 8ca5455764 Factor out duplicated code building a MemberExpr and marking it
referenced.

llvm-svn: 362563
2019-06-05 00:21:47 +00:00