Commit Graph

78794 Commits

Author SHA1 Message Date
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