]> granicus.if.org Git - clang/log
clang
5 years ago[PowerPC] [Clang] Port SSE intrinsics to PowerPC
Zi Xuan Wu [Wed, 29 May 2019 05:17:03 +0000 (05:17 +0000)]
[PowerPC] [Clang] Port SSE intrinsics to PowerPC

Port xmmintrin.h which include Intel SSE 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.

Patched by: Qiu Chaofan <qiucf@cn.ibm.com>
Reviewed By: Jinsong Ji

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

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

5 years agoMake __has_builtin work with __builtin_LINE and friends.
Eric Fiselier [Wed, 29 May 2019 03:15:36 +0000 (03:15 +0000)]
Make __has_builtin work with __builtin_LINE and friends.

The source location builtins are implemented as keywords, but
__has_builtin should still report true for them.

This patch also fixes a test failure on systemz where the alignment
of string literals is 2 not 1.

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

5 years agoFix failure of lit test dependent-libs.cu
Yaxun Liu [Wed, 29 May 2019 01:34:44 +0000 (01:34 +0000)]
Fix failure of lit test dependent-libs.cu

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

5 years ago[Driver] Search the toolchain dir with -print-file-name
Petr Hosek [Wed, 29 May 2019 00:01:05 +0000 (00:01 +0000)]
[Driver] Search the toolchain dir with -print-file-name

This is useful when looking for directories or files relative to the
toolchain root, e.g. include/c++/v1. This change also adds a test
to make sure this functionality doesn't regress in the future.

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

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

5 years ago[X86] Fix the Sema checks for getmant builtins to only allow 4 and 8 for rounding...
Craig Topper [Tue, 28 May 2019 23:26:22 +0000 (23:26 +0000)]
[X86] Fix the Sema checks for getmant builtins to only allow 4 and 8 for rounding immediates.

These don't support embedded rounding so we shouldn't be setting HasRC. That way we only
allow current direction and suppress all exceptions.

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

5 years agoFix r361893 to also update a recently-added test.
Richard Smith [Tue, 28 May 2019 23:20:52 +0000 (23:20 +0000)]
Fix r361893 to also update a recently-added test.

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

5 years agoDefer creating fields for captures until we finish building the
Richard Smith [Tue, 28 May 2019 23:09:46 +0000 (23:09 +0000)]
Defer creating fields for captures until we finish building the
capturing expression or statement.

No functionality change yet. The intent is that we will also delay
building the initialization expression until the enclosing context, so
that:
a) we build the initialization expression in the right context, and
b) we can elide captures that are not odr-used, as suggested by P0588R1.

This also consolidates some duplicated code building capture fields into
a single place.

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

5 years agoSimplify clang::Capture. No functionality change intended.
Richard Smith [Tue, 28 May 2019 23:09:45 +0000 (23:09 +0000)]
Simplify clang::Capture. No functionality change intended.

We don't need to pack flags into the bottom bits of pointers here; we
have plenty of trailing bits in this type.

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

5 years agoIf capturing a variable fails, add a capture anyway (and mark it
Richard Smith [Tue, 28 May 2019 23:09:44 +0000 (23:09 +0000)]
If capturing a variable fails, add a capture anyway (and mark it
invalid) so that we can avoid repeated diagnostics for the same capture.

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

5 years agoMove code to mark a variable as odr-used adjacement to all the related
Richard Smith [Tue, 28 May 2019 23:09:42 +0000 (23:09 +0000)]
Move code to mark a variable as odr-used adjacement to all the related
code.

No functional change intended.

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

5 years ago[Driver] Fix -working-directory issues
Michael J. Spencer [Tue, 28 May 2019 22:21:47 +0000 (22:21 +0000)]
[Driver] Fix -working-directory issues

Currently the `-working-directory` option does not actually impact the working
directory for all of the clang driver, it only impacts how files are looked up
to make sure they exist.  This means that that clang passes the wrong paths
to -fdebug-compilation-dir and -coverage-notes-file.

This patch fixes that by changing all the places in the driver where we convert
to absolute paths to use the VFS, and then calling setCurrentWorkingDirectory on
the VFS.  This also changes the default VFS for `Driver` to use a virtualized
working directory, instead of changing the process's working directory.

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

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

5 years ago[CUDA][HIP] Emit dependent libs for host only
Yaxun Liu [Tue, 28 May 2019 21:18:59 +0000 (21:18 +0000)]
[CUDA][HIP] Emit dependent libs for host only

Recently D60274 was introduced to allow lld to handle dependent libs. However current
usage of dependent libs (e.g. pragma comment(lib, *) in windows header files) are intended
for host only. Emitting the metadata in device IR causes link error in device path.

Until there is a way to different it dependent libs for device or host, metadata for dependent
libs should be emitted for host only. This patch enforces that.

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

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

5 years ago[clang] Handle lrint/llrint builtins
Adhemerval Zanella [Tue, 28 May 2019 21:16:04 +0000 (21:16 +0000)]
[clang] Handle lrint/llrint builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lrint
and llrint.  It currently only optimize for AArch64 backend.

Reviewed By: craig.topper

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

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

5 years ago[OpenMP] Set pragma start loc to `#pragma` loc
Joel E. Denny [Tue, 28 May 2019 19:27:19 +0000 (19:27 +0000)]
[OpenMP] Set pragma start loc to `#pragma` loc

This patch adjusts `PragmaOpenMPHandler` to set the location of
`tok::annot_pragma_openmp` to the `#pragma` location instead of the
`omp` location so that the former becomes the start location of the
OpenMP AST node.  This can be useful when, for example, rewriting a
directive using Clang's Rewrite facility.  Most of this patch updates
tests for changes to locations in diagnostics and `-ast-dump` output.

Reviewed By: ABataev, lebedev.ri, Meinersbur, aaron.ballman

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

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

5 years agoDriver: support `/Zc:char8_t` and `/Zc:char8_t-`
Saleem Abdulrasool [Tue, 28 May 2019 18:26:00 +0000 (18:26 +0000)]
Driver: support `/Zc:char8_t` and `/Zc:char8_t-`

Update the `cl` emulation to support the `/Zc:char8_t[-]?` options as per the
MSVC 2019.1 toolset.  These are aliases for `-fchar8_t` and `-fno-char8_t`.

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

5 years ago[ARM] Replace fp-only-sp and d16 with fp64 and d32.
Simon Tatham [Tue, 28 May 2019 16:13:20 +0000 (16:13 +0000)]
[ARM] Replace fp-only-sp and d16 with fp64 and d32.

Those two subtarget features were awkward because their semantics are
reversed: each one indicates the _lack_ of support for something in
the architecture, rather than the presence. As a consequence, you
don't get the behavior you want if you combine two sets of feature
bits.

Each SubtargetFeature for an FP architecture version now comes in four
versions, one for each combination of those options. So you can still
say (for example) '+vfp2' in a feature string and it will mean what
it's always meant, but there's a new string '+vfp2d16sp' meaning the
version without those extra options.

A lot of this change is just mechanically replacing positive checks
for the old features with negative checks for the new ones. But one
more interesting change is that I've rearranged getFPUFeatures() so
that the main FPU feature is appended to the output list *before*
rather than after the features derived from the Restriction field, so
that -fp64 and -d32 can override defaults added by the main feature.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: srhines, javed.absar, eraman, kristof.beyls, hiraditya, zzheng, Petar.Avramovic, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[CodeComplete] Set preferred type for qualified-id
Ilya Biryukov [Tue, 28 May 2019 15:21:03 +0000 (15:21 +0000)]
[CodeComplete] Set preferred type for qualified-id

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[CodeComplete] Consistently break after '{' in multi-line patterns
Ilya Biryukov [Tue, 28 May 2019 14:33:16 +0000 (14:33 +0000)]
[CodeComplete] Consistently break after '{' in multi-line patterns

Summary:
Completion can return multi-line patterns in some cases, e.g.

    for (<#init#>; <#cond#>; <#inc#>) {
    <#body#>
    }

However, most patterns break the line only before closing brace,
resulting in code like:

    namespace <#name#> { <#decls#>
    }

While some (e.g. the 'for' example above) are breaking lines after the
opening brace too.

This change ensures all patterns consistently break after the opening
brace, this leads to nicer UX when using those in an actual editor.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd release note entries for recent typo correction changes
Nico Weber [Tue, 28 May 2019 14:04:48 +0000 (14:04 +0000)]
Add release note entries for recent typo correction changes

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

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

5 years ago[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`
Adam Balogh [Tue, 28 May 2019 13:07:09 +0000 (13:07 +0000)]
[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`

The `cplusplus.SelfAssignment` checker has a visitor that is added
to every `BugReport` to mark the to branch of the self assignment
operator with e.g. `rhs == *this` and `rhs != *this`. With the new
`NoteTag` feature this visitor is not needed anymore. Instead the
checker itself marks the two branches using the `NoteTag`s.

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

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

5 years agoRe-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Hans Wennborg [Tue, 28 May 2019 12:19:38 +0000 (12:19 +0000)]
Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This was reverted in r360086 as it was supected of causing mysterious test
failures internally. However, it was never concluded that this patch was the
root cause.

> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936

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

5 years agoRevert [test] Fix plugin tests
Don Hinton [Tue, 28 May 2019 06:38:16 +0000 (06:38 +0000)]
Revert [test] Fix plugin tests

This reverts r361790 (git commit fe5eaab2b5b4523886bd63aebcfea8cfce586fa1)

It's causing buildbot breakage, so reverting while I investigate.

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

5 years ago[test] Fix plugin tests
Don Hinton [Tue, 28 May 2019 06:26:58 +0000 (06:26 +0000)]
[test] Fix plugin tests

Summary:
The following changes were required to fix these tests:

1) Change LLVM_ENABLE_PLUGINS to an option and move it to
   llvm/CMakeLists.txt with an appropriate default -- which matches
   the original default behavior.

2) Move the plugins directory from clang/test/Analysis
   clang/lib/Analysis.  It's not enough to add an exclude to the
   lit.local.cfg file because add_lit_testsuites recurses the tree and
   automatically adds the appropriate `check-` targets, which don't
   make sense for the plugins because they aren't tests and don't
   have `RUN` statements.

   Here's a list of the `clang-check-anlysis*` targets with this
   change:

```
  $ ninja -t targets all| sed -n "s/.*\/\(check[^:]*\):.*/\1/p" | sort -u | grep clang-analysis
  check-clang-analysis
  check-clang-analysis-checkers
  check-clang-analysis-copypaste
  check-clang-analysis-diagnostics
  check-clang-analysis-engine
  check-clang-analysis-exploration_order
  check-clang-analysis-html_diagnostics
  check-clang-analysis-html_diagnostics-relevant_lines
  check-clang-analysis-inlining
  check-clang-analysis-objc
  check-clang-analysis-unified-sources
  check-clang-analysis-z3
```

3) Simplify the logic and only include the subdirectories under
   clang/lib/Analysis/plugins if LLVM_ENABLE_PLUGINS is set.

Reviewed By: NoQ

Tags: #clang, #llvm

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

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

5 years ago[Driver] Change layout of per-target runtimes to resemble multiarch
Petr Hosek [Mon, 27 May 2019 23:23:50 +0000 (23:23 +0000)]
[Driver] Change layout of per-target runtimes to resemble multiarch

This is a follow up to r361432, changing the layout of per-target
runtimes to more closely resemble multiarch. While before, we used
the following layout:

[RESOURCE_DIR]/<target>/lib/libclang_rt.<runtime>.<ext>

Now we use the following layout:

[RESOURCE_DIR]/lib/<target>/libclang_rt.<runtime>.<ext>

This also more closely resembles the existing "non-per-target" layout:

[RESOURCE_DIR]/lib/<os>/libclang_rt.<runtime>-<arch>.<ext>

This change will enable further simplification of the driver logic
in follow up changes.

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

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

5 years ago[Preprocessor] Fix crash emitting note with framework location for "file not found...
Volodymyr Sapsai [Mon, 27 May 2019 19:15:30 +0000 (19:15 +0000)]
[Preprocessor] Fix crash emitting note with framework location for "file not found" error.

A filename can be remapped with a header map to point to a framework
header and we can find the corresponding framework without the header.
But if the original filename doesn't have a remapped framework name,
we'll fail to find its location and will dereference a null pointer
during diagnostics emission.

Fix by tracking remappings better and emit the note only if a framework
is found before any of the remappings.

rdar://problem/48883447

Reviewers: arphaman, erik.pilkington, jkorous

Reviewed By: arphaman

Subscribers: dexonsmith, cfe-commits

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

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

5 years ago[clang] Respect TerseOutput when printing lambdas
Kadir Cetinkaya [Mon, 27 May 2019 16:20:45 +0000 (16:20 +0000)]
[clang] Respect TerseOutput when printing lambdas

Reviewers: ilya-biryukov, hokein, sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoWhen dumping the AST to JSON, dump the type information from a typeid expression...
Aaron Ballman [Mon, 27 May 2019 14:34:31 +0000 (14:34 +0000)]
When dumping the AST to JSON, dump the type information from a typeid expression with a type operand.

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

5 years agoWhen dumping the AST to JSON, dump whether a function is variadic or not.
Aaron Ballman [Mon, 27 May 2019 14:29:10 +0000 (14:29 +0000)]
When dumping the AST to JSON, dump whether a function is variadic or not.

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

5 years agoWhen dumping the AST to JSON, dump the declared name of a MemberExpr operand.
Aaron Ballman [Mon, 27 May 2019 14:25:04 +0000 (14:25 +0000)]
When dumping the AST to JSON, dump the declared name of a MemberExpr operand.

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

5 years agoWhen dumping the AST to JSON, dump the argument name to a sizeof pack expression.
Aaron Ballman [Mon, 27 May 2019 14:17:32 +0000 (14:17 +0000)]
When dumping the AST to JSON, dump the argument name to a sizeof pack expression.

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

5 years agoAdd test cases for dumping AST expression nodes to JSON; NFC.
Aaron Ballman [Mon, 27 May 2019 14:12:48 +0000 (14:12 +0000)]
Add test cases for dumping AST expression nodes to JSON; NFC.

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

5 years ago[OpenCL] Fix file-scope const sampler variable for 2.0
Yaxun Liu [Mon, 27 May 2019 11:19:07 +0000 (11:19 +0000)]
[OpenCL] Fix file-scope const sampler variable for 2.0

OpenCL spec v2.0 s6.13.14:

Samplers can also be declared as global constants in the program
source using the following syntax.

   const sampler_t <sampler name> = <value>
This works fine for OpenCL 1.2 but fails for 2.0, because clang duduces
address space of file-scope const sampler variable to be in global address
space whereas spec v2.0 s6.9.b forbids file-scope sampler variable to be
in global address space.

The fix is not to deduce address space for file-scope sampler variables.

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

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

5 years ago[CodeComplete] Complete 'return true/false' in boolean functions
Ilya Biryukov [Mon, 27 May 2019 09:52:09 +0000 (09:52 +0000)]
[CodeComplete] Complete 'return true/false' in boolean functions

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Added visibility context check for CXXRecordDecl.
Balazs Keri [Mon, 27 May 2019 09:36:00 +0000 (09:36 +0000)]
[ASTImporter] Added visibility context check for CXXRecordDecl.

Summary:
ASTImporter makes now difference between classes with same name in different
translation units if these are not visible outside. These classes are not linked
into one decl chain.

Reviewers: martong, a.sidorin, shafik

Reviewed By: shafik

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

Tags: #clang

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

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

5 years ago[Driver][RISCV] Simplify. NFC
Fangrui Song [Sun, 26 May 2019 07:43:45 +0000 (07:43 +0000)]
[Driver][RISCV] Simplify. NFC

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

5 years ago[Driver] Update handling of c++ and runtime directories
Petr Hosek [Sun, 26 May 2019 03:39:07 +0000 (03:39 +0000)]
[Driver] Update handling of c++ and runtime directories

This is a follow up to r361432 and r361504 which addresses issues
introduced by those changes. Specifically, it avoids duplicating
file and runtime paths in case when the effective triple is the
same as the cannonical one. Furthermore, it fixes the broken multilib
setup in the Fuchsia driver and deduplicates some of the code.

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

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

5 years agoAdd missing newline at end of file
Duncan P. N. Exon Smith [Sat, 25 May 2019 22:38:02 +0000 (22:38 +0000)]
Add missing newline at end of file

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

5 years agoPermit static local structured bindings to be named from arbitrary scopes inside...
Richard Smith [Sat, 25 May 2019 01:04:17 +0000 (01:04 +0000)]
Permit static local structured bindings to be named from arbitrary scopes inside their declaring scope.

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

5 years agoRevert "[Analysis] Link library dependencies to Analysis plugins"
Akira Hatanaka [Sat, 25 May 2019 00:50:03 +0000 (00:50 +0000)]
Revert "[Analysis] Link library dependencies to Analysis plugins"

This reverts commit r361340. The following builder has been broken for
the past few days because of this commit:

http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/

Also revert r361399, which was committed to fix r361340.

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

5 years agoRename clangToolingRefactor to clangToolingRefactoring for consistency with its directory
Nico Weber [Sat, 25 May 2019 00:27:19 +0000 (00:27 +0000)]
Rename clangToolingRefactor to clangToolingRefactoring for consistency with its directory

See "[cfe-dev] The name of clang/lib/Tooling/Refactoring".

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

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

5 years ago[analyzer] Add a prunable note for skipping vbase inits in subclasses.
Artem Dergachev [Fri, 24 May 2019 23:37:11 +0000 (23:37 +0000)]
[analyzer] Add a prunable note for skipping vbase inits in subclasses.

When initialization of virtual base classes is skipped, we now tell the user
about it, because this aspect of C++ isn't very well-known.

The implementation is based on the new "note tags" feature (r358781).
In order to make use of it, allow note tags to produce prunable notes,
and move the note tag factory to CoreEngine.

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

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

5 years ago[CFG] Add branch to skip vbase inits when they're handled by superclass.
Artem Dergachev [Fri, 24 May 2019 23:37:08 +0000 (23:37 +0000)]
[CFG] Add branch to skip vbase inits when they're handled by superclass.

This patch adds the run-time CFG branch that would skip initialization of
virtual base classes depending on whether the constructor is called from a
superclass constructor or not. Previously the Static Analyzer was already
skipping virtual base-class initializers in such constructors, but it wasn't
skipping their arguments and their potential side effects, which was causing
pr41300 (and was generally incorrect). The previous skipping behavior is
now replaced with a hard assertion that we're not even getting there due
to how our CFG works.

The new CFG element is under a CFG build option so that not to break other
consumers of the CFG by this change. Static Analyzer support for this change
is implemented.

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

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

5 years agoFix crash deserializing a CUDAKernelCallExpr with a +Asserts binary.
Richard Smith [Fri, 24 May 2019 23:26:07 +0000 (23:26 +0000)]
Fix crash deserializing a CUDAKernelCallExpr with a +Asserts binary.

The assertion in setConfig read from the (uninitialized) CONFIG
expression.

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

5 years agoMark tests as x86.
Alina Sbirlea [Fri, 24 May 2019 21:49:27 +0000 (21:49 +0000)]
Mark tests as x86.

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

5 years agoDefault arguments are potentially constant evaluated.
Richard Smith [Fri, 24 May 2019 21:08:12 +0000 (21:08 +0000)]
Default arguments are potentially constant evaluated.

We need to eagerly instantiate constexpr functions used in them even if
the default argument is never actually used, because we might evaluate
portions of it when performing semantic checks.

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

5 years agoRefactor use-marking to better match standard terminology. No
Richard Smith [Fri, 24 May 2019 20:42:25 +0000 (20:42 +0000)]
Refactor use-marking to better match standard terminology. No
functionality change intended.

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

5 years ago[Analyzer] Checker for non-determinism caused by iteration of unordered container...
Mandeep Singh Grang [Fri, 24 May 2019 19:24:08 +0000 (19:24 +0000)]
[Analyzer] Checker for non-determinism caused by iteration of unordered container of pointers

Summary: Added a checker for non-determinism caused by iterating unordered containers like std::unordered_set containing pointer elements.

Reviewers: NoQ, george.karpenkov, whisperity, Szelethus, baloghadamsoftware

Reviewed By: Szelethus

Subscribers: mgorny, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, jdoerfert, Charusso, cfe-commits

Tags: #clang

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

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

5 years ago[cmake] Remove old unused version of FindZ3.cmake from clang [NFC]
Don Hinton [Fri, 24 May 2019 19:21:21 +0000 (19:21 +0000)]
[cmake] Remove old unused version of FindZ3.cmake from clang [NFC]

Summary: This file was moved to llvm in D54978, r356929, but the old
file was never removed.

Reviewed By: beanz

Tags: #clang

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

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

5 years agoAdding an explicit triple to this test to appease build bots.
Aaron Ballman [Fri, 24 May 2019 19:19:00 +0000 (19:19 +0000)]
Adding an explicit triple to this test to appease build bots.

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

5 years agoAdd JSON dumping tests for ObjC statements; add support for dumping @catch catch...
Aaron Ballman [Fri, 24 May 2019 18:58:29 +0000 (18:58 +0000)]
Add JSON dumping tests for ObjC statements; add support for dumping @catch catch-all statements.

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

5 years ago[OpenMP] Add test for requires and unified shared memory clause with declare target...
Gheorghe-Teodor Bercea [Fri, 24 May 2019 18:48:42 +0000 (18:48 +0000)]
[OpenMP] Add test for requires and unified shared memory clause with declare target link

Summary:
This patch adds a test for requires with unified share memory clause when a declare target link is present.

This test needs to go in prior to changes to declare target link for comparison purposes.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[NewPassManager] Add tuning option: LoopUnrolling [clang-change]
Alina Sbirlea [Fri, 24 May 2019 17:40:52 +0000 (17:40 +0000)]
[NewPassManager] Add tuning option: LoopUnrolling [clang-change]

Summary:
Use CodeGenOpts's setting for loop unrolling.
[to be coupled with D61618]

Reviewers: chandlerc

Subscribers: jlebar, dmgreen, cfe-commits, llvm-commits

Tags: #clang

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

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

5 years agoAdd support for dumping Objective C AST declaration nodes to JSON.
Aaron Ballman [Fri, 24 May 2019 17:39:55 +0000 (17:39 +0000)]
Add support for dumping Objective C AST declaration nodes to JSON.

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

5 years ago[WebAssembly] Use "linker" as linker shortname.
Sam Clegg [Fri, 24 May 2019 17:36:07 +0000 (17:36 +0000)]
[WebAssembly] Use "linker" as linker shortname.

This is in line with other platforms.

Also, move the single statement methods into the header (also
in line with other platform).

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

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

5 years ago[ASTImporter] Call to HandleNameConflict in VisitRecordDecl mistakeningly using Name...
Shafik Yaghmour [Fri, 24 May 2019 16:53:44 +0000 (16:53 +0000)]
[ASTImporter] Call to HandleNameConflict in VisitRecordDecl mistakeningly using Name instead of SearchName

Summary:
https://reviews.llvm.org/D51633 added error handling to the ASTNodeImporter::VisitRecordDecl for the conflicting names case. This could lead to erroneous return of an error in that case since we should have been using SearchName. Name may be empty in the case where we find the name via D->getTypedefNameForAnonDecl()->getDeclName().

This fix is very similar to https://reviews.llvm.org/D59665

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

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

5 years ago[CodeComplete] Add whitespace around braces in lambda completions
Ilya Biryukov [Fri, 24 May 2019 16:16:15 +0000 (16:16 +0000)]
[CodeComplete] Add whitespace around braces in lambda completions

This produces nicer output.
Trivial follow-up to r361461, so sending without review.

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

5 years ago[LibTooling] Add Explanation parameter to `makeRule`.
Yitzhak Mandelbaum [Fri, 24 May 2019 15:11:45 +0000 (15:11 +0000)]
[LibTooling] Add Explanation parameter to `makeRule`.

Summary:
Conceptually, a single-case RewriteRule has a matcher, edit(s) and an (optional)
explanation. `makeRule` previously only took the matcher and edit(s). This
change adds (optional) support for the explanation.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[OpenCL] Add support for the cl_arm_integer_dot_product extensions
Kevin Petit [Fri, 24 May 2019 14:53:52 +0000 (14:53 +0000)]
[OpenCL] Add support for the cl_arm_integer_dot_product extensions

The specification is available in the Khronos OpenCL registry:

https://www.khronos.org/registry/OpenCL/extensions/arm/cl_arm_integer_dot_product.txt

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361641 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeComplete] Filter override completions by function name
Ilya Biryukov [Fri, 24 May 2019 10:18:39 +0000 (10:18 +0000)]
[CodeComplete] Filter override completions by function name

Summary:
We put only part of the signature starting with a function name into "typed text"
chunks now, previously the whole signature was "typed text".

This leads to meaningful fuzzy match scores, giving better signals to
compare with other completion items.

Ideally, we would not display the result type to the user, but that requires adding
a new kind of completion chunk.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years agoDo not resolve directory junctions for `-fdiagnostics-absolute-paths` on Windows.
Igor Kudrin [Fri, 24 May 2019 04:46:22 +0000 (04:46 +0000)]
Do not resolve directory junctions for `-fdiagnostics-absolute-paths` on Windows.

If the source file path contains directory junctions, and we resolve them when
printing diagnostic messages, these paths look independent for an IDE.
For example, both Visual Studio and Visual Studio Code open separate editors
for such paths, which is not only inconvenient but might even result in losing
changes made in one of them.

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

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

5 years ago[analyzer] NFC: Prevent multi-file plist test from spamming up the build folder.
Artem Dergachev [Fri, 24 May 2019 02:29:18 +0000 (02:29 +0000)]
[analyzer] NFC: Prevent multi-file plist test from spamming up the build folder.

It was producing an HTML report with a random name on every tests run
and never cleaned those up.

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

5 years agoFactor out repeated code to build 'this' expressions and mark them
Richard Smith [Fri, 24 May 2019 01:35:07 +0000 (01:35 +0000)]
Factor out repeated code to build 'this' expressions and mark them
referenced.

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

5 years ago[CFG] NFC: Modernize a test file for constructor initializer CFGs.
Artem Dergachev [Fri, 24 May 2019 01:34:26 +0000 (01:34 +0000)]
[CFG] NFC: Modernize a test file for constructor initializer CFGs.

Move FileCheck directives around so that it was easy to understand
what tests what and what effect do changes have.

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

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

5 years ago[CFG] NFC: Remove implicit conversion from CFGTerminator to Stmt *.
Artem Dergachev [Fri, 24 May 2019 01:34:22 +0000 (01:34 +0000)]
[CFG] NFC: Remove implicit conversion from CFGTerminator to Stmt *.

Turn it into a variant class instead. This conversion does indeed save some code
but there's a plan to add support for more kinds of terminators that aren't
necessarily based on statements, and with those in mind it becomes more and more
confusing to have CFGTerminators implicitly convertible to a Stmt *.

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

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

5 years agoFix hang during constant evaluation of union assignment.
Eric Fiselier [Thu, 23 May 2019 23:34:43 +0000 (23:34 +0000)]
Fix hang during constant evaluation of union assignment.

HandleUnionActiveMemberChange forgot to walk over a nop implicit
conversion node and got stuck in the process.

As a cleanup I changed the declaration of `E` so it can't
be accidentally accessed after the loop.

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

5 years ago[analyzer] List checker/plugin options in 3 categories: released, alpha, developer
Kristof Umann [Thu, 23 May 2019 22:52:09 +0000 (22:52 +0000)]
[analyzer] List checker/plugin options in 3 categories: released, alpha, developer

Same patch as D62093, but for checker/plugin options, the only
difference being that options for alpha checkers are implicitly marked
as alpha.

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

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

5 years ago[OPENMP]Do not crash for const firstprivates.
Alexey Bataev [Thu, 23 May 2019 22:30:43 +0000 (22:30 +0000)]
[OPENMP]Do not crash for const firstprivates.

If the variable is a firstprivate variable and it was not emitted beause
this a constant variable with the constant initializer, we can use the
initial value instead of the variable itself. It also fixes the problem
with the compiler crash in this case.

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

5 years agoUse clang_cc1 instead of clang in CodeGen test.
Alina Sbirlea [Thu, 23 May 2019 22:07:37 +0000 (22:07 +0000)]
Use clang_cc1 instead of clang in CodeGen test.

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

5 years ago[analyzer] Hide developer-only checker/package options by default
Kristof Umann [Thu, 23 May 2019 22:07:16 +0000 (22:07 +0000)]
[analyzer] Hide developer-only checker/package options by default

These options are now only visible under
-analyzer-checker-option-help-developer.

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

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

5 years ago[analyzer] List checkers in 3 categories: released, alpha, developer
Kristof Umann [Thu, 23 May 2019 21:46:51 +0000 (21:46 +0000)]
[analyzer] List checkers in 3 categories: released, alpha, developer

Previously, the only way to display the list of available checkers was
to invoke the analyzer with -analyzer-checker-help frontend flag. This
however wasn't really great from a maintainer standpoint: users came
across checkers meant strictly for development purposes that weren't to
be tinkered with, or those that were still in development. This patch
creates a clearer division in between these categories.

From now on, we'll have 3 flags to display the list checkers. These
lists are mutually exclusive and can be used in any combination (for
example to display both stable and alpha checkers).

-analyzer-checker-help: Displays the list for stable, production ready
                        checkers.

-analyzer-checker-help-alpha: Displays the list for in development
                              checkers. Enabling is discouraged
                              for non-development purposes.

-analyzer-checker-help-developer: Modeling and debug checkers. Modeling
                                  checkers shouldn't be enabled/disabled
                                  by hand, and debug checkers shouldn't
                                  be touched by users.

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

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

5 years ago[X86] Split multi-line chained assignments into single lines to avoid making clang...
Craig Topper [Thu, 23 May 2019 21:34:36 +0000 (21:34 +0000)]
[X86] Split multi-line chained assignments into single lines to avoid making clang-format create triangle shaped indentation. Simplify one if statement to remove a bunch of string matches. NFCI

We had an if statement that checked over every avx512* feature to see if it should enabled avx512f. Since they are all prefixed with avx512 just check for that instead.

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

5 years ago[analyzer] Add a new frontend flag to display all checker options
Kristof Umann [Thu, 23 May 2019 20:47:28 +0000 (20:47 +0000)]
[analyzer] Add a new frontend flag to display all checker options

Add the new frontend flag -analyzer-checker-option-help to display all
checker/package options.

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

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

5 years agoUpdate breaking test.
Alina Sbirlea [Thu, 23 May 2019 19:51:16 +0000 (19:51 +0000)]
Update breaking test.

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

5 years agoFix unresolved symbols when linking tools/clang/unittests/Tooling/ToolingTests
Thomas Lively [Thu, 23 May 2019 18:55:00 +0000 (18:55 +0000)]
Fix unresolved symbols when linking tools/clang/unittests/Tooling/ToolingTests

Summary: Add correct cmake dependencies so that `ToolingTests` link
successfully.

Patch by Guanzhong Chen

Reviewers: tlively, aheejin

Reviewed By: tlively

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[NewPassManager] Add tuning option: SLPVectorization [clang-change]
Alina Sbirlea [Thu, 23 May 2019 18:51:02 +0000 (18:51 +0000)]
[NewPassManager] Add tuning option: SLPVectorization [clang-change]

Summary:
NewPassManager is not using CodeGenOpts values before this patch.
[to be coupled with D61616]

Reviewers: chandlerc

Subscribers: jlebar, cfe-commits, llvm-commits

Tags: #clang

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

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

5 years ago[Driver] Move the "-o OUT -x TYPE SRC.c" flags to the end of -cc1
Reid Kleckner [Thu, 23 May 2019 18:35:43 +0000 (18:35 +0000)]
[Driver] Move the "-o OUT -x TYPE SRC.c" flags to the end of -cc1

New -cc1 arguments, such as -faddrsig, have started appearing after the
input name. I personally find it convenient for the input to be the last
argument to the compile command line, since I often need to edit it when
running crash reproduction scripts.

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

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

5 years ago[OPENMP]Simplify codegen for the outlined regions.
Alexey Bataev [Thu, 23 May 2019 18:19:54 +0000 (18:19 +0000)]
[OPENMP]Simplify codegen for the outlined regions.

Simplified codegen for the outlined regions, excluding duplication code
for handling variables with the reference types.

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

5 years agolld-link, clang: Treat non-existent input files as possible spellos for option flags
Nico Weber [Thu, 23 May 2019 17:58:33 +0000 (17:58 +0000)]
lld-link, clang: Treat non-existent input files as possible spellos for option flags

OptTable treats arguments starting with / that aren't a known option
as filenames. This means lld-link's and clang-cl's typo correction for
unknown flags didn't do spell checking for misspelled options that start
with /.

I first tried changing OptTable, but that got pretty messy, see PR41787
comments 2 and 3.

Instead, let lld-link's and clang's (including clang-cl's) "file not
found" diagnostic check if a non-existent file looks like it could be a
mis-spelled option, and if so add a "did you mean" suggestion to the
"file not found" diagnostic.

While here, make formatting of a few diagnostics a bit more
self-consistent.

Fixes PR41787.

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

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

5 years ago[WebAssembly] Add multivalue and tail-call target features
Thomas Lively [Thu, 23 May 2019 17:26:47 +0000 (17:26 +0000)]
[WebAssembly] Add multivalue and tail-call target features

Summary:
These features will both be implemented soon, so I thought I would
save time by adding the boilerplate for both of them at the same time.

Reviewers: aheejin

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

Tags: #clang, #llvm

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

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

5 years ago[LibTooling] Fix dangling references in RangeSelector.
Yitzhak Mandelbaum [Thu, 23 May 2019 17:11:33 +0000 (17:11 +0000)]
[LibTooling] Fix dangling references in RangeSelector.

Summary:
RangeSelector had a number of cases of capturing a StringRef in a lambda, which
lead to dangling references. This change converts all uses in the API of
`StringRef` to `std::string` to avoid this problem. `std::string` in the API is
a reasonable choice, because the combinators are always storing the string
beyond the life of the combinator construction.

Reviewers: ilya-biryukov, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Index] Fix reported references in presence of template type aliases
Ilya Biryukov [Thu, 23 May 2019 16:48:47 +0000 (16:48 +0000)]
[Index] Fix reported references in presence of template type aliases

Summary: See the added test for an example.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[CodeComplete] Only show lambda completions if patterns are requested
Ilya Biryukov [Thu, 23 May 2019 16:39:26 +0000 (16:39 +0000)]
[CodeComplete] Only show lambda completions if patterns are requested

This is a trivial follow-up to r361461, so sending without review.

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

5 years agoEnsure builtins use the target default Calling Convention
Erich Keane [Thu, 23 May 2019 16:05:21 +0000 (16:05 +0000)]
Ensure builtins use the target default Calling Convention

r355317 changed builtins/allocation functions to use the default calling
convention in order to support platforms that use non-cdecl calling
conventions by default.

However the default calling convention is overridable on Windows 32 bit
implementations with some of the /G options. The intent is to permit the
user to set the calling convention of normal functions, however it
should NOT apply to builtins and C++ allocation functions.

This patch ensures that the builtin/allocation functions always use the
Target specific Calling Convention, ignoring the user overridden version
of said default.

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

5 years ago[analyzer][NFC] Prettify some RUN: lines in test files.
Kristof Umann [Thu, 23 May 2019 15:49:04 +0000 (15:49 +0000)]
[analyzer][NFC] Prettify some RUN: lines in test files.

This is a test commit in disguise.

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

5 years ago[Driver] Try normalized triple when looking for C++ libraries
Petr Hosek [Thu, 23 May 2019 15:23:16 +0000 (15:23 +0000)]
[Driver] Try normalized triple when looking for C++ libraries

This addresses the issue introduced in r361432 where we would only
try effective triple but not the normalized one as we do for other
runtimes.

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

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

5 years agoWork around a Visual C++ bug.
Paul Robinson [Thu, 23 May 2019 15:07:46 +0000 (15:07 +0000)]
Work around a Visual C++ bug.

Using a static function as a template parameter gets a bogus compile-time
error with Visual Studio 2017, prior to version 15.8. Our current
minimum-version requirement is a particular update to VS2015, and we
assume all Visual Studio 2017 versions are usable. This patch makes the
code buildable with older versions of VS2017, and can be reverted after
we upgrade the minimum version sometime in the future.

Description of the Microsoft bug:
https://developercommunity.visualstudio.com/content/problem/25334/error-code-c2971-when-specifying-a-function-as-the.html

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

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

5 years agoDelete default constructors, copy constructors, move constructors, copy assignment...
Dmitri Gribenko [Thu, 23 May 2019 09:22:43 +0000 (09:22 +0000)]
Delete default constructors, copy constructors, move constructors, copy assignment, move assignment operators on Expr, Stmt and Decl

Reviewers: ilya-biryukov, rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoEnable queue_t and clk_event_t comparisons in C++ mode
Sven van Haastregt [Thu, 23 May 2019 09:20:08 +0000 (09:20 +0000)]
Enable queue_t and clk_event_t comparisons in C++ mode

Support queue_t and clk_event_t comparisons in C++ for OpenCL mode, to
preserve backwards compatibility with OpenCL C.

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

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

5 years ago[CodeComplete] Complete a lambda when preferred type is a function
Ilya Biryukov [Thu, 23 May 2019 07:45:35 +0000 (07:45 +0000)]
[CodeComplete] Complete a lambda when preferred type is a function

Summary: Uses a heuristic to detect std::function and friends.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[CMake][Fuchsia] Use cannonical triples for runtimes
Petr Hosek [Thu, 23 May 2019 02:35:12 +0000 (02:35 +0000)]
[CMake][Fuchsia] Use cannonical triples for runtimes

This ensures that whether the user uses short or cannonical version
of the triple, Clang will still find the runtimes under the cannonical
triple name.

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

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

5 years agoFix r361428 for Windows buildbots/mangling
David Blaikie [Wed, 22 May 2019 21:58:17 +0000 (21:58 +0000)]
Fix r361428 for Windows buildbots/mangling

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

5 years agoFix new enum-codegen.cpp test
Reid Kleckner [Wed, 22 May 2019 21:52:12 +0000 (21:52 +0000)]
Fix new enum-codegen.cpp test

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

5 years agoAdd some notes on immutability and faithfulness to the internals manual.
Richard Smith [Wed, 22 May 2019 21:20:09 +0000 (21:20 +0000)]
Add some notes on immutability and faithfulness to the internals manual.

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

5 years ago[runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and include/c++
Petr Hosek [Wed, 22 May 2019 21:08:33 +0000 (21:08 +0000)]
[runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and include/c++

This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory. Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/$target/c++ and include/c++ directories, leaving resource directory
only for compiler-rt runtimes and Clang builtin headers.

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

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

5 years agoAdd back --sysroot support for darwin header search.
James Y Knight [Wed, 22 May 2019 20:39:51 +0000 (20:39 +0000)]
Add back --sysroot support for darwin header search.

Before e97b5f5cf37e ([clang][Darwin] Refactor header search path logic
into the driver), both --sysroot and -isysroot worked to specify where
to look for system and C++ headers on Darwin. However, that change
caused clang to start ignoring --sysroot.

This fixes the regression, and adds tests.

(I also note that on all other platforms, clang seems to almost
completely ignore -isysroot, but that's another issue...)

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

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

5 years agoModules: Code generation of enum constants for merged enum definitions
David Blaikie [Wed, 22 May 2019 20:36:06 +0000 (20:36 +0000)]
Modules: Code generation of enum constants for merged enum definitions

Found in a bootstrap of LLVM with implicit modules, resulting in a
deadlock of some Orc unit tests with libstdc++ 8.1. An enum was used as
part of the implementation of std::recursive_mutex and this bug resulted
in the constant initialization of zero instead of the desired non-zero
value. => Badness.

Richard Smith tells me neither of these fields are necessarily canonical
& so using declaresSamEntity is the right solution here (rather than
changing both of these Fields to be canonical by construction/from their
source)

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

5 years agoPart of P1091R3: permit structured bindings to be declared 'static' and
Richard Smith [Wed, 22 May 2019 19:52:55 +0000 (19:52 +0000)]
Part of P1091R3: permit structured bindings to be declared 'static' and
'thread_local' in C++20.

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

5 years ago[LibTooling] Update Stencil to use RangeSelector
Yitzhak Mandelbaum [Wed, 22 May 2019 18:03:00 +0000 (18:03 +0000)]
[LibTooling] Update Stencil to use RangeSelector

Add support for creating a `StencilPart` from any `RangeSelector`, which
broadens the scope of `Stencil`.

Correspondingly, deprecate Stencil's specialized combinators `node` and `sNode`
in favor of using the new `selection` combinator directly (with the appropriate
range selector).

Reviewers: sbenza

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFixed a -Wunused-variable warning when assertions are disabled
Dmitri Gribenko [Wed, 22 May 2019 17:45:24 +0000 (17:45 +0000)]
Fixed a -Wunused-variable warning when assertions are disabled

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

5 years agoCombine two if cases because the second one is never reached.
Amy Huang [Wed, 22 May 2019 15:48:59 +0000 (15:48 +0000)]
Combine two if cases because the second one is never reached.

Subscribers: cfe-commits

Tags: #clang

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

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