]> granicus.if.org Git - clang/log
clang
5 years agoModules: Adopt template parameters for variable templates to set their decl context...
David Blaikie [Fri, 19 Apr 2019 23:04:05 +0000 (23:04 +0000)]
Modules: Adopt template parameters for variable templates to set their decl context correctly

Exposed by a related bug about visibility of default arguments of nested
templates - without the correct decl context, default template
parameters of variable templates nested in classes would have incorrect
visibility computed.

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

5 years agoModules: Search for a visible definition of the decl context when computing visibilit...
David Blaikie [Fri, 19 Apr 2019 23:02:30 +0000 (23:02 +0000)]
Modules: Search for a visible definition of the decl context when computing visibility of a default template parameter

The code is/was already correct for the case where a parameter is a
parameter of its enclosing lexical DeclContext (functions and classes).
But for other templates (alias and variable templates) they don't create
their own scope to be members of - in those cases, they parameter should
be considered visible if any definition of the lexical decl context is
visible.

[this should cleanup the failure on the libstdc++ modules buildbot]
[this doesn't actually fix the variable template case for a
secondary/compounding reason (its lexical decl context is incorrectly
considered to be the translation unit)]

Test covers all 4 kinds of templates with default args, including a
regression test for the still broken variable template case.

Reviewers: rsmith

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

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

5 years ago[MS] Emit S_HEAPALLOCSITE debug info
Amy Huang [Fri, 19 Apr 2019 21:09:11 +0000 (21:09 +0000)]
[MS] Emit S_HEAPALLOCSITE debug info

Summary:
This emits labels around heapallocsite calls and S_HEAPALLOCSITE debug
info in codeview. Currently only changes FastISel, so emitting labels still
needs to be implemented in SelectionDAG.

Reviewers: hans, rnk

Subscribers: aprantl, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoReapply "[analyzer] Introduce a simplified API for adding custom path notes."
Artem Dergachev [Fri, 19 Apr 2019 20:23:29 +0000 (20:23 +0000)]
Reapply "[analyzer] Introduce a simplified API for adding custom path notes."

This reapplies commit r357323, fixing memory leak found by LSan.

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

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

5 years ago[MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next...
Martin Storsjo [Fri, 19 Apr 2019 19:04:22 +0000 (19:04 +0000)]
[MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next to cl.exe

Previously, if the MSVC installation isn't detected properly, clang
will later just fail to execute link.exe.

This improves using clang in msvc mode on linux, where one intentionally
might not want to point clang to the MSVC installation itself (which
isn't executable as such), but where a link.exe named wine wrapper is
available in the path next to a cl.exe named wine wrapper.

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

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

5 years agoEnable frame pointer elimination for OpenBSD on powerpc.
Brad Smith [Fri, 19 Apr 2019 18:41:40 +0000 (18:41 +0000)]
Enable frame pointer elimination for OpenBSD on powerpc.

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

5 years ago[OPENMP][NVPTX] target [teams distribute] simd maybe run without
Alexey Bataev [Fri, 19 Apr 2019 16:48:38 +0000 (16:48 +0000)]
[OPENMP][NVPTX] target [teams distribute] simd maybe run without
runtime.

target [teams distribute] simd costructs do not require full runtime for
the correct execution, we can run them without full runtime.

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

5 years agoUpdate to use PipelineTuningOptions. Corresponds to llvm change: D59723.
Alina Sbirlea [Fri, 19 Apr 2019 16:32:08 +0000 (16:32 +0000)]
Update to use PipelineTuningOptions. Corresponds to llvm change: D59723.

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

5 years agoDebian: Add two missing version code in sid
Sylvestre Ledru [Fri, 19 Apr 2019 13:48:52 +0000 (13:48 +0000)]
Debian: Add two missing version code in sid

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

5 years agoAdd support of the future Debian (Debian 11 - Bullseye)
Sylvestre Ledru [Fri, 19 Apr 2019 13:46:58 +0000 (13:46 +0000)]
Add support of the future Debian (Debian 11 - Bullseye)
https://wiki.debian.org/DebianBullseye

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

5 years agoAdd support of the next Ubuntu (Ubuntu 19.10 - Eoan EANIMAL)
Sylvestre Ledru [Fri, 19 Apr 2019 13:43:28 +0000 (13:43 +0000)]
Add support of the next Ubuntu (Ubuntu 19.10 - Eoan EANIMAL)

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

5 years ago[LTO] Add plumbing to save stats during LTO on Darwin.
Florian Hahn [Fri, 19 Apr 2019 12:36:41 +0000 (12:36 +0000)]
[LTO] Add plumbing to save stats during LTO on Darwin.

Gold and ld on Linux already support saving stats, but the
infrastructure is missing on Darwin. Unfortunately it seems like the
configuration from lib/LTO/LTO.cpp is not used.

This patch adds a new LTOStatsFile option and adds plumbing in Clang to
use it on Darwin, similar to the way remarks are handled.

Currnetly the handling of LTO flags seems quite spread out, with a bunch
of duplication. But I am not sure if there is an easy way to improve
that?

Reviewers: anemet, tejohnson, thegameg, steven_wu

Reviewed By: steven_wu

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

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

5 years ago[analyzer][NFC] Reimplement checker options
Kristof Umann [Fri, 19 Apr 2019 12:32:10 +0000 (12:32 +0000)]
[analyzer][NFC] Reimplement checker options

TL;DR:

* Add checker and package options to the TableGen files
* Added a new class called CmdLineOption, and both Package and Checker recieved
   a list<CmdLineOption> field.
* Added every existing checker and package option to Checkers.td.
* The CheckerRegistry class
  * Received some comments to most of it's inline classes
  * Received the CmdLineOption and PackageInfo inline classes, a list of
     CmdLineOption was added to CheckerInfo and PackageInfo
  * Added addCheckerOption and addPackageOption
  * Added a new field called Packages, used in addPackageOptions, filled up in
     addPackage

Detailed description:

In the last couple months, a lot of effort was put into tightening the
analyzer's command line interface. The main issue is that it's spectacularly
easy to mess up a lenghty enough invocation of the analyzer, and the user was
given no warnings or errors at all in that case.

We can divide the effort of resolving this into several chapters:

* Non-checker analyzer configurations:
    Gather every analyzer configuration into a dedicated file. Emit errors for
    non-existent configurations or incorrect values. Be able to list these
    configurations. Tighten AnalyzerOptions interface to disallow making such
    a mistake in the future.

* Fix the "Checker Naming Bug" by reimplementing checker dependencies:
    When cplusplus.InnerPointer was enabled, it implicitly registered
    unix.Malloc, which implicitly registered some sort of a modeling checker
    from the CStringChecker family. This resulted in all of these checker
    objects recieving the name "cplusplus.InnerPointer", making AnalyzerOptions
    asking for the wrong checker options from the command line:
      cplusplus.InnerPointer:Optimisic
    istead of
      unix.Malloc:Optimistic.
    This was resolved by making CheckerRegistry responsible for checker
    dependency handling, instead of checkers themselves.

* Checker options: (this patch included!)
    Same as the first item, but for checkers.

(+ minor fixes here and there, and everything else that is yet to come)

There were several issues regarding checker options, that non-checker
configurations didn't suffer from: checker plugins are loaded runtime, and they
could add new checkers and new options, meaning that unlike for non-checker
configurations, we can't collect every checker option purely by generating code.
Also, as seen from the "Checker Naming Bug" issue raised above, they are very
rarely used in practice, and all sorts of skeletons fell out of the closet while
working on this project.

They were extremely problematic for users as well, purely because of how long
they were. Consider the following monster of a checker option:

  alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=false

While we were able to verify whether the checker itself (the part before the
colon) existed, any errors past that point were unreported, easily resulting
in 7+ hours of analyses going to waste.

This patch, similarly to how dependencies were reimplemented, uses TableGen to
register checker options into Checkers.td, so that Checkers.inc now contains
entries for both checker and package options. Using the preprocessor,
Checkers.inc is converted into code in CheckerRegistry, adding every builtin
(checkers and packages that have an entry in the Checkers.td file) checker and
package option to the registry. The new addPackageOption and addCheckerOption
functions expose the same functionality to statically-linked non-builtin and
plugin checkers and packages as well.

Emitting errors for incorrect user input, being able to list these options, and
some other functionalies will land in later patches.

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

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

5 years ago[analyzer] Fix an assertion failure if plugins added dependencies
Kristof Umann [Fri, 19 Apr 2019 11:01:35 +0000 (11:01 +0000)]
[analyzer] Fix an assertion failure if plugins added dependencies

Ideally, there is no reason behind not being able to depend on checkers that
come from a different plugin (or on builtin checkers) -- however, this is only
possible if all checkers are added to the registry before resolving checker
dependencies. Since I used a binary search in my addDependency method, this also
resulted in an assertion failure (due to CheckerRegistry::Checkers not being
sorted), since the function used by plugins to register their checkers
(clang_registerCheckers) calls addDependency.

This patch resolves this issue by only noting which dependencies have to
established when addDependency is called, and resolves them at a later stage
when no more checkers are added to the registry, by which point
CheckerRegistry::Checkers is already sorted.

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

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

5 years ago[LibTooling] Fix -Wsign-compare after r358697
Bjorn Pettersson [Fri, 19 Apr 2019 09:10:42 +0000 (09:10 +0000)]
[LibTooling] Fix -Wsign-compare after r358697

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

5 years agoFix overly-long line after r358731.
Richard Smith [Fri, 19 Apr 2019 02:46:50 +0000 (02:46 +0000)]
Fix overly-long line after r358731.

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

5 years agoFix typo in function name [NFC]
Ali Tamur [Fri, 19 Apr 2019 02:15:57 +0000 (02:15 +0000)]
Fix typo in function name [NFC]

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

5 years ago[analyzer] Fix -Wunused-local-typedef after rC358695
Fangrui Song [Fri, 19 Apr 2019 01:54:36 +0000 (01:54 +0000)]
[analyzer] Fix -Wunused-local-typedef after rC358695

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

5 years agoAdd header guard to Reusables.h [NFC]
Ali Tamur [Fri, 19 Apr 2019 00:42:54 +0000 (00:42 +0000)]
Add header guard to Reusables.h [NFC]

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

5 years ago[analyzer] Make default bindings to variables actually work.
Artem Dergachev [Thu, 18 Apr 2019 23:35:56 +0000 (23:35 +0000)]
[analyzer] Make default bindings to variables actually work.

Default RegionStore bindings represent values that can be obtained by loading
from anywhere within the region, not just the specific offset within the region
that they are said to be bound to. For example, default-binding a character \0
to an int (eg., via memset()) means that the whole int is 0, not just
that its lower byte is 0.

Even though memset and bzero were modeled this way, it didn't work correctly
when applied to simple variables. Eg., in

  int x;
  memset(x, 0, sizeof(x));

we did produce a default binding, but were unable to read it later, and 'x'
was perceived as an uninitialized variable even after memset.

At the same time, if we replace 'x' with a variable of a structure or array
type, accessing fields or elements of such variable was working correctly,
which was enough for most cases. So this was only a problem for variables of
simple integer/enumeration/floating-point/pointer types.

Fix loading default bindings from RegionStore for regions of simple variables.

Add a unit test to document the API contract as well.

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

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

5 years ago[analyzer] NFC: Make reusable unittest mocks reusable.
Artem Dergachev [Thu, 18 Apr 2019 23:24:50 +0000 (23:24 +0000)]
[analyzer] NFC: Make reusable unittest mocks reusable.

Put them in a header for other Analyzer unittests to include.

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

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

5 years ago[analyzer] NFC: MoveChecker: Refactor tests to use -verify=prefix.
Artem Dergachev [Thu, 18 Apr 2019 23:17:58 +0000 (23:17 +0000)]
[analyzer] NFC: MoveChecker: Refactor tests to use -verify=prefix.

This -verify=prefix feature is quite underrated.

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

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

5 years ago[c++2a] Add semantic support for private module fragments.
Richard Smith [Thu, 18 Apr 2019 21:12:54 +0000 (21:12 +0000)]
[c++2a] Add semantic support for private module fragments.

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

5 years ago[OpenMP][NFC] Fix requires target test.
Gheorghe-Teodor Bercea [Thu, 18 Apr 2019 20:34:43 +0000 (20:34 +0000)]
[OpenMP][NFC] Fix requires target test.

Summary:
Fix requires target test.

Reviewers: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] Fix incorrect formatting of keyword macro definition
Owen Pan [Thu, 18 Apr 2019 20:17:08 +0000 (20:17 +0000)]
[clang-format] Fix incorrect formatting of keyword macro definition

See PR39719

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

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

5 years ago[OpenMP] Add checks for requires and target directives.
Gheorghe-Teodor Bercea [Thu, 18 Apr 2019 19:53:43 +0000 (19:53 +0000)]
[OpenMP] Add checks for requires and target directives.

Summary: The requires directive containing target related clauses must appear before any target region in the compilation unit.

Reviewers: ABataev, AlexEichenberger, caomhin

Reviewed By: ABataev

Subscribers: guansong, jfb, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[LibTooling] Fix build breakage from commit 7b7ce6683ee.
Yitzhak Mandelbaum [Thu, 18 Apr 2019 19:19:01 +0000 (19:19 +0000)]
[LibTooling] Fix build breakage from commit 7b7ce6683ee.

On configurations with -Werror,-Wmissing-field-initializers, the commit does not compile. This commit fixes the offending line.

Original Differential Revision: https://reviews.llvm.org/D60408

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

5 years ago[LibTooling] Extend Transformer to support multiple simultaneous changes.
Yitzhak Mandelbaum [Thu, 18 Apr 2019 17:52:24 +0000 (17:52 +0000)]
[LibTooling] Extend Transformer to support multiple simultaneous changes.

Summary: This revision allows users to specify independent changes to multiple (related) sections of the input.  Previously, only a single section of input could be selected for replacement.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: jfb, cfe-commits

Tags: #clang

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

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

5 years ago[CodeComplete] Remove obsolete isOutputBinary().
Sam McCall [Thu, 18 Apr 2019 17:35:55 +0000 (17:35 +0000)]
[CodeComplete] Remove obsolete isOutputBinary().

Summary:
It's never set to true. Its only effect would be to set stdout to binary mode.
Hopefully we have better ways of doing this by now :-)

Reviewers: hokein

Subscribers: jkorous, arphaman, kadircet, llvm-commits

Tags: #llvm

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

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

5 years ago[analyzer][NFC] Prefer binary searches in CheckerRegistry
Kristof Umann [Thu, 18 Apr 2019 17:34:45 +0000 (17:34 +0000)]
[analyzer][NFC] Prefer binary searches in CheckerRegistry

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

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

5 years ago[analyzer][NFC] Clang-format CheckerRegistry
Kristof Umann [Thu, 18 Apr 2019 17:32:51 +0000 (17:32 +0000)]
[analyzer][NFC] Clang-format CheckerRegistry

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

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

5 years ago[LibTooling] Add Stencil library for format-string style codegen.
Yitzhak Mandelbaum [Thu, 18 Apr 2019 17:23:01 +0000 (17:23 +0000)]
[LibTooling] Add Stencil library for format-string style codegen.

Summary:
This file defines the *Stencil* abstraction: a code-generating object, parameterized by named references to (bound) AST nodes.  Given a match result, a stencil can be evaluated to a string of source code.

A stencil is similar in spirit to a format string: it is composed of a series of raw text strings, references to nodes (the parameters) and helper code-generation operations.

See thread on cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling" for background.

Reviewers: sbenza

Reviewed By: sbenza

Subscribers: ilya-biryukov, mgorny, jfb, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] Fix indent of trailing raw string param after newline
Krasimir Georgiev [Thu, 18 Apr 2019 17:14:05 +0000 (17:14 +0000)]
[clang-format] Fix indent of trailing raw string param after newline

Summary:
Currently clang-format uses ContinuationIndent to indent the contents of a raw
string literal that is the last parameter of the function call. This is to
achieve formatting similar to trailing:
```
f(1, 2, R"pb(
    x: y)pb");
```
However this had the unfortunate consequence of producing format like this:
```
fffffff(1, 2,
        R"pb(
    a: b
        )pb");
```

This patch makes clang-format consider indenting a trailing raw string param
after a newline based off the start of the format delimiter, producing:
```
fffffff(1, 2,
        R"pb(
          a: b
        )pb");
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Sema][NFC] Mark DR1563 as done (List-initialization and overloaded function disambig...
Bruno Ricci [Thu, 18 Apr 2019 15:45:08 +0000 (15:45 +0000)]
[Sema][NFC] Mark DR1563 as done (List-initialization and overloaded function disambiguation)

It has been supported since at least clang 3.1 so just mark it as done.

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

5 years ago[Sema][NFC] Mark DR705 (Suppressing argument-dependent lookup via parentheses) as...
Bruno Ricci [Thu, 18 Apr 2019 15:34:03 +0000 (15:34 +0000)]
[Sema][NFC] Mark DR705 (Suppressing argument-dependent lookup via parentheses) as done

It was supported since at least clang 3 so just mark it as done.

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

5 years ago[analyzer][NFC] Use capital variable names, move methods out-of-line, rename some...
Kristof Umann [Thu, 18 Apr 2019 15:19:16 +0000 (15:19 +0000)]
[analyzer][NFC] Use capital variable names, move methods out-of-line, rename some in CheckerRegistry

There are barely any lines I haven't changed in these files, so I think I could
might as well leave it in an LLVM coding style conforming state. I also renamed
2 functions and moved addDependency out of line to ease on followup patches.

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

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

5 years ago[Serialization] Stable serialization order for OpenCLTypeExtMap and OpenCLDeclExtMap
Bruno Ricci [Thu, 18 Apr 2019 15:13:27 +0000 (15:13 +0000)]
[Serialization] Stable serialization order for OpenCLTypeExtMap and OpenCLDeclExtMap

Sort the elements of Sema::OpenCLTypeExtMap and Sema::OpenCLDeclExtMap
by TypeIDs and DeclIDs to guarantee a stable serialization order.

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

Reviewed By: Anastasia

Reviewers: Anastasia, lebedev.ri

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

5 years ago[clang-tidy] Address post-commit comments
Haojian Wu [Thu, 18 Apr 2019 14:18:14 +0000 (14:18 +0000)]
[clang-tidy] Address post-commit comments

Summary:
Also add a test to verify clang-tidy only apply the first alternative
fix.

Reviewers: alexfh

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

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

5 years ago[clang][CIndex] Use llvm::set_thread_priority
Kadir Cetinkaya [Thu, 18 Apr 2019 13:49:20 +0000 (13:49 +0000)]
[clang][CIndex] Use llvm::set_thread_priority

Reviewers: jkorous, gribozavr

Subscribers: dexonsmith, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[MSVC] Use the correct casing of HostX64/HostX86
Martin Storsjo [Thu, 18 Apr 2019 13:27:31 +0000 (13:27 +0000)]
[MSVC] Use the correct casing of HostX64/HostX86

If accessing the MSVC installation root directly on a case sensitive
filesystem, these details matter.

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

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

5 years ago[Sema] Delete unused parameters/variables
Fangrui Song [Thu, 18 Apr 2019 12:35:02 +0000 (12:35 +0000)]
[Sema] Delete unused parameters/variables

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

5 years ago[CUDA][Windows] Restrict long double device functions declarations to Windows
Evgeny Mankov [Thu, 18 Apr 2019 10:08:55 +0000 (10:08 +0000)]
[CUDA][Windows] Restrict long double device functions declarations to Windows

As agreed in D60220, make long double declarations unobservable on non-windows platforms.

[Testing]
{Windows 10, Ubuntu 16.04.5}/{Visual C++ 2017 15.9.11 & 2019 16.0.1, gcc+ 5.4.0}/CUDA {8.0, 9.0, 9.1, 9.2, 10.0, 10.1}

Reviewed by: Artem Belevich

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

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

5 years agoSplit out modules-specific declaration handling from SemaDecl.cpp into a
Richard Smith [Thu, 18 Apr 2019 00:57:02 +0000 (00:57 +0000)]
Split out modules-specific declaration handling from SemaDecl.cpp into a
new SemaModule.cpp.

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

5 years agoAdd '#pragma clang __debug module_map module.name' to dump the module
Richard Smith [Thu, 18 Apr 2019 00:57:01 +0000 (00:57 +0000)]
Add '#pragma clang __debug module_map module.name' to dump the module
map being used for the module 'module.name'.

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

5 years ago[c++2a] Improve diagnostic for use of declaration from another TU's
Richard Smith [Thu, 18 Apr 2019 00:56:58 +0000 (00:56 +0000)]
[c++2a] Improve diagnostic for use of declaration from another TU's
global module fragment.

We know that the declaration in question should have been introduced by
a '#include', so try to figure out which one and suggest it. Don't
suggest importing the global module fragment itself!

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

5 years ago[clang-format] Remove unused Environment constructor.
Alexander Kornienko [Thu, 18 Apr 2019 00:36:51 +0000 (00:36 +0000)]
[clang-format] Remove unused Environment constructor.

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

5 years agoMove the implementation of getInnermostBlockDecl to the .cpp file to fix
Akira Hatanaka [Thu, 18 Apr 2019 00:00:16 +0000 (00:00 +0000)]
Move the implementation of getInnermostBlockDecl to the .cpp file to fix
failing bots.

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

5 years agoFix test on PS4 which defaults to gnu99 which does not emit the expected warnings.
Douglas Yung [Thu, 18 Apr 2019 00:00:06 +0000 (00:00 +0000)]
Fix test on PS4 which defaults to gnu99 which does not emit the expected warnings.

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

5 years ago[Sema][ObjC] Don't warn about an implicitly retained self if the
Akira Hatanaka [Wed, 17 Apr 2019 23:14:44 +0000 (23:14 +0000)]
[Sema][ObjC] Don't warn about an implicitly retained self if the
retaining block and all of the enclosing blocks are non-escaping.

If the block implicitly retaining self doesn't escape, there is no risk
of creating retain cycles, so clang shouldn't diagnose it and force
users to add self-> to silence the diagnostic.

Also, fix a bug where clang was failing to diagnose an implicitly
retained self inside a c++ lambda nested inside a block.

rdar://problem/25059955

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

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

5 years ago[analyzer] PR41185: Fix regression where __builtin_* functions weren't recognized
Kristof Umann [Wed, 17 Apr 2019 19:56:40 +0000 (19:56 +0000)]
[analyzer] PR41185: Fix regression where __builtin_* functions weren't recognized

For the following code snippet:

void builtin_function_call_crash_fixes(char *c) {
  __builtin_strncpy(c, "", 6);
  __builtin_memset(c, '\0', (0));
  __builtin_memcpy(c, c, 0);
}
security.insecureAPI.DeprecatedOrUnsafeBufferHandling caused a regression, as it
didn't recognize functions starting with __builtin_. Fixed exactly that.

I wanted to modify an existing test file, but the two I found didn't seem like
perfect candidates. While I was there, I prettified their RUN: lines.

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

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

5 years ago[OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.
Alexey Bataev [Wed, 17 Apr 2019 16:53:08 +0000 (16:53 +0000)]
[OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.

All target-parallel-based constructs can be run in SPMD mode from now
on. Even if num_threads clauses or if clauses are used, such constructs
can be executed in SPMD mode.

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

5 years agoRemove --show-includes flag in crash reduce script
Amy Huang [Wed, 17 Apr 2019 16:20:56 +0000 (16:20 +0000)]
Remove --show-includes flag in crash reduce script

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

5 years agoExplicitly say we don't define new/delete in libc++ during Apple stage1 bootstrap
Louis Dionne [Wed, 17 Apr 2019 14:58:59 +0000 (14:58 +0000)]
Explicitly say we don't define new/delete in libc++ during Apple stage1 bootstrap

This is not necessary in stage2 because we don't even build libc++.dylib
there.

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

5 years ago[clang-tidy] Add fix descriptions to clang-tidy checks.
Haojian Wu [Wed, 17 Apr 2019 12:53:59 +0000 (12:53 +0000)]
[clang-tidy] Add fix descriptions to clang-tidy checks.

Summary:
Motivation/Context: in the code review system integrating with clang-tidy,
clang-tidy doesn't provide a human-readable description of the fix. Usually
developers have to preview a code diff (before vs after apply the fix) to
understand what the fix does before applying a fix.

This patch proposes that each clang-tidy check provides a short and
actional fix description that can be shown in the UI, so that users can know
what the fix does without previewing diff.

This patch extends clang-tidy framework to support fix descriptions (will add implementations for
existing checks in the future). Fix descriptions and fixes are emitted via diagnostic::Note (rather than
attaching the main warning diagnostic).

Before this patch:

```
void MyCheck::check(...) {
   ...
   diag(loc, "my check warning") <<  FixtItHint::CreateReplacement(...);
}
```

After:

```
void MyCheck::check(...) {
   ...
   diag(loc, "my check warning"); // Emit a check warning
   diag(loc, "fix description", DiagnosticIDs::Note) << FixtItHint::CreateReplacement(...); // Emit a diagnostic note and a fix
}
```

Reviewers: sammccall, alexfh

Reviewed By: alexfh

Subscribers: MyDeveloperDay, Eugene.Zelenko, aaron.ballman, JonasToth, xazax.hun, jdoerfert, cfe-commits

Tags: #clang-tools-extra, #clang

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

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

5 years agoclang-cl: Parse /openmp:experimental
Hans Wennborg [Wed, 17 Apr 2019 10:05:58 +0000 (10:05 +0000)]
clang-cl: Parse /openmp:experimental

It was added to the MS docs recently here:
https://github.com/MicrosoftDocs/cpp-docs/commit/3951085ab722fbb488ca40864f4a0553f7b71855

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

5 years ago[libclang] Expose ext_vector_type
Sven van Haastregt [Wed, 17 Apr 2019 09:08:50 +0000 (09:08 +0000)]
[libclang] Expose ext_vector_type

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

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

5 years ago[Driver] Simplify -g level computation and its interaction with -gsplit-dwarf
Fangrui Song [Wed, 17 Apr 2019 01:46:27 +0000 (01:46 +0000)]
[Driver] Simplify -g level computation and its interaction with -gsplit-dwarf

Summary:
When -gsplit-dwarf is used together with other -g options, in most cases
the computed debug info level is decided by the last -g option, with one
special case (see below). This patch drops that special case and thus
makes it easy to reason about:

// If a lower debug level -g comes after -gsplit-dwarf, in some cases
// -gsplit-dwarf is cancelled.
-gsplit-dwarf -g0 => 0
-gsplit-dwarf -gline-directives-only => DebugDirectivesOnly
-gsplit-dwarf -gmlt -fsplit-dwarf-inlining => 1
-gsplit-dwarf -gmlt -fno-split-dwarf-inlining => 1 + split

// If -gsplit-dwarf comes after -g options, with this patch, the net
// effect is 2 + split for all combinations
-g0 -gsplit-dwarf => 2 + split
-gline-directives-only -gsplit-dwarf => 2 + split
-gmlt -gsplit-dwarf -fsplit-dwarf-inlining => 2 + split
-gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 + split (before) 2 + split (after)

The last case has been changed. In general, if the user intends to lower
debug info level, place that -g option after -gsplit-dwarf.

Some context:

In gcc, the last of -gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-*
... decides the debug info level (-gsplit-dwarf -gdwarf-* have level 2).
It is a bit unfortunate that -gsplit-dwarf -gdwarf-* ... participate in
the level computation but that is the status quo.

Reviewers: dblaikie, echristo, probinson

Reviewed By: dblaikie, probinson

Subscribers: probinson, aprantl, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[NFC] Remove unused function (Sema::pushExternalDeclIntoScope)
Leonard Chan [Tue, 16 Apr 2019 22:59:39 +0000 (22:59 +0000)]
[NFC] Remove unused function (Sema::pushExternalDeclIntoScope)

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

5 years agoModify test to use -S instead of -c so that it works when an external assembler is...
Douglas Yung [Tue, 16 Apr 2019 22:52:05 +0000 (22:52 +0000)]
Modify test to use -S instead of -c so that it works when an external assembler is used that is not present.

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

5 years ago[FileSystemStatCache] Update test for new FileSystemStatCache API
Harlan Haskins [Tue, 16 Apr 2019 18:00:43 +0000 (18:00 +0000)]
[FileSystemStatCache] Update test for new FileSystemStatCache API

Summary: Update this test to return std::error_code instead of LookupResult.

Reviewers: arphaman

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[FileSystemStatCache] Return std::error_code from stat cache methods
Harlan Haskins [Tue, 16 Apr 2019 17:34:26 +0000 (17:34 +0000)]
[FileSystemStatCache] Return std::error_code from stat cache methods

Summary:
Previously, we would return true/false signifying if the cache/lookup
succeeded or failed. Instead, provide clients with the underlying error
that was thrown while attempting to look up in the cache.

Since clang::FileManager doesn't make use of this information, it discards the
error that's received and casts away to bool.

This change is NFC.

Reviewers: benlangmuir, arphaman

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[Test] Remove obsolete test.
Michael Kruse [Tue, 16 Apr 2019 16:44:45 +0000 (16:44 +0000)]
[Test] Remove obsolete test.

The FIXME of this test case has been addressed in r335084/r338800. Its
execution still does not succeed because of multiple syntax errors.

First, the "clang" namespace is missing on each of the 4 pragmas.
Second, the pragma for defining the vector width is "vectorize_width(4)"
instead of "vectorize(4)". Third, the pragma for defining the interleave
factor is "interleave_count(8)" instead of "interleave(8)".

The file was already using the wrong syntax when added in
r210925 2014-06-13. The file ast-print-pragmas.cpp already checks for
the correct pragma order, making this test redundant even if fixed.

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

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

5 years ago[OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.
Alexey Bataev [Tue, 16 Apr 2019 15:39:12 +0000 (15:39 +0000)]
[OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.

Combined constructs with parallel and if clauses without modifiers may
be executed in SPMD mode since if the condition is true for the target
region, it is also true for parallel region and the threads must be run
in parallel.

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

5 years ago[OPENMP]Require aarch arch for the tests, NFC.
Alexey Bataev [Tue, 16 Apr 2019 14:26:10 +0000 (14:26 +0000)]
[OPENMP]Require aarch arch for the tests, NFC.

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

5 years ago[AArch64] Implement Vector Funtion ABI name mangling.
Alexey Bataev [Tue, 16 Apr 2019 13:56:21 +0000 (13:56 +0000)]
[AArch64] Implement Vector Funtion ABI name mangling.

Summary:
The name mangling scheme is defined in section 3.5 of the "Vector function application binary interface specification for AArch64" [1].

[1] https://developer.arm.com/products/software-development-tools/hpc/arm-compiler-for-hpc/vector-function-abi

Reviewers: rengolin, ABataev

Reviewed By: ABataev

Subscribers: sdesmalen, javed.absar, kristof.beyls, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years agoRe-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function...
Hans Wennborg [Tue, 16 Apr 2019 12:13:25 +0000 (12:13 +0000)]
Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)

The original commit caused false positives from AddressSanitizer's
use-after-scope checks, which have now been fixed in r358478.

> 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@358483 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTweak test to pass when using a non-integrated assembler.
Richard Smith [Tue, 16 Apr 2019 01:44:53 +0000 (01:44 +0000)]
Tweak test to pass when using a non-integrated assembler.

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

5 years agoPR41192: fix cases where "missing ';' after class" error would
Richard Smith [Tue, 16 Apr 2019 00:47:45 +0000 (00:47 +0000)]
PR41192: fix cases where "missing ';' after class" error would
incorrectly fire.

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

5 years agoDebugInfo: Default to standalone debug when tuning for LLDB
David Blaikie [Tue, 16 Apr 2019 00:16:29 +0000 (00:16 +0000)]
DebugInfo: Default to standalone debug when tuning for LLDB

LLDB can't currently handle Clang's default (limit/no-standalone) DWARF,
so platforms that default to LLDB (Darwin) or anyone else manually
requesting LLDB tuning, should also get standalone DWARF.

That doesn't mean a user can't explicitly enable (because they have
other reasons to prefer standalone DWARF (such as that they're only
building half their application with debug info enabled, and half
without - or because they're tuning for GDB, but want to be able to use
it under LLDB too (this is the default on FreeBSD))) or disable (testing
LLDB fixes/improvements that handle no-standalone mode, building C code,
perhaps, which wouldn't have the LLDB<>no-standalone conflict, etc) the
feature regardless of the tuning.

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

5 years agoSimplify diagnosis of misplaced attributes in module-declarations.
Richard Smith [Mon, 15 Apr 2019 23:55:58 +0000 (23:55 +0000)]
Simplify diagnosis of misplaced attributes in module-declarations.

No functional change intended.

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

5 years agoTime profiler: small fixes and optimizations
Anton Afanasyev [Mon, 15 Apr 2019 21:02:47 +0000 (21:02 +0000)]
Time profiler: small fixes and optimizations

Summary: Fixes from Roman's review here: https://reviews.llvm.org/D58675#1465336

Reviewers: lebedev.ri

Subscribers: hiraditya, mgrang, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[OPENMP][NVPTX]Run parallel regions with num_threads clauses in SPMD
Alexey Bataev [Mon, 15 Apr 2019 20:38:10 +0000 (20:38 +0000)]
[OPENMP][NVPTX]Run parallel regions with num_threads clauses in SPMD
mode.

After the previous patch with the more correct handling of the number of
threads in parallel regions, the parallel regions with num_threads
clauses can be executed in SPMD mode.

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

5 years ago[clang-format] Fix -Wconversion-null warning in GCC
Reuben Thomas [Mon, 15 Apr 2019 20:13:20 +0000 (20:13 +0000)]
[clang-format] Fix -Wconversion-null warning in GCC

GCC -Wconversion-null warning appeared after 9a63380260860b657b72f07c4f0e61e382ab934a.
There was a similar problem already in the past:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131230/096230.html

Patch committed on behalf of @dendibakh

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

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

5 years agoRevert "[clang] Aligned allocation is actually supported in macosx 10.13"
Louis Dionne [Mon, 15 Apr 2019 19:08:52 +0000 (19:08 +0000)]
Revert "[clang] Aligned allocation is actually supported in macosx 10.13"

This reverts r358409, which I think broke the bots in compiler-rt.
Since I'm having trouble reproducing the failure, I'm reverting this
until I can investigate locally.

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

5 years ago[X86] Improve avx512-kconstraints-att_inline_asm.c to not be easily defeated by deadc...
Craig Topper [Mon, 15 Apr 2019 18:39:36 +0000 (18:39 +0000)]
[X86] Improve avx512-kconstraints-att_inline_asm.c to not be easily defeated by deadcode elimination. Improve CHECK lines to check IR types used. NFC

I plan to use this as the basis for backend IR test cases. We currently crash hard for using 32 or 64 bit mask registers without avx512bw.

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

5 years ago[CommandLineParser] Add DefaultOption flag
Don Hinton [Mon, 15 Apr 2019 17:18:10 +0000 (17:18 +0000)]
[CommandLineParser] Add DefaultOption flag

Summary: Add DefaultOption flag to CommandLineParser which provides a
default option or alias, but allows users to override it for some
other purpose as needed.

Also, add `-h` as a default alias to `-help`, which can be seamlessly
overridden by applications like llvm-objdump and llvm-readobj which
use `-h` as an alias for other options.

(relanding after revert, r358414)
Added DefaultOptions.clear() to reset().

Reviewers: alexfh, klimek

Reviewed By: klimek

Subscribers: kristina, MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits

Tags: #clang, #llvm

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

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

5 years ago[X86] Restore the pavg intrinsics.
Craig Topper [Mon, 15 Apr 2019 17:17:35 +0000 (17:17 +0000)]
[X86] Restore the pavg intrinsics.

The pattern we replaced these with may be too hard to match as demonstrated by
PR41496 and PR41316.

This patch restores the intrinsics and then we can start focusing
on the optimizing the intrinsics.

I've mostly reverted the original patch that removed them. Though I modified
the avx512 intrinsics to not have masking built in.

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

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

5 years agoRevert r358337: "[CommandLineParser] Add DefaultOption flag"
Ilya Biryukov [Mon, 15 Apr 2019 14:43:50 +0000 (14:43 +0000)]
Revert r358337: "[CommandLineParser] Add DefaultOption flag"

The change causes test failures under asan. Reverting to unbreak our
integrate.

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

5 years ago[clang] Aligned allocation is actually supported in macosx 10.13
Louis Dionne [Mon, 15 Apr 2019 14:14:45 +0000 (14:14 +0000)]
[clang] Aligned allocation is actually supported in macosx 10.13

Summary:
In r350649, I changed aligned allocation from being available starting
in macosx10.13 to macosx10.14. However, aligned allocation is indeed
available starting with macosx10.13, my investigation had been based
on the wrong libc++abi dylib.

This means that Clang before the fix will be more stringent when it
comes to aligned allocation -- it will not allow it when back-deploying
to macosx 10.13, when it would actually be safe to do so.

Note that a companion change will be coming to fix the libc++ tests.

Reviewers: ahatanak

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years agoclang-format vs plugin: Visual Studio 2019 support
Hans Wennborg [Mon, 15 Apr 2019 13:02:03 +0000 (13:02 +0000)]
clang-format vs plugin: Visual Studio 2019 support

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

5 years ago[MinGW] Remove some supefluous calls to MakeArgString. NFC.
Martin Storsjo [Mon, 15 Apr 2019 10:57:09 +0000 (10:57 +0000)]
[MinGW] Remove some supefluous calls to MakeArgString. NFC.

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

5 years ago[Lookup] Invisible decls should not be ambiguous when renaming.
Eric Liu [Mon, 15 Apr 2019 08:46:34 +0000 (08:46 +0000)]
[Lookup] Invisible decls should not be ambiguous when renaming.

Summary:
For example, a renamed type in a header file can conflict with declaration in
a random file that includes the header, but we should not consider the decl ambiguous if
it's not visible at the rename location. This improves consistency of generated replacements
when header file is included in different TUs.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] [PR41170] Break after return type ignored with certain comments positions
Paul Hoad [Mon, 15 Apr 2019 07:47:15 +0000 (07:47 +0000)]
[clang-format] [PR41170] Break after return type ignored with certain comments positions

Summary:
Addresses https://bugs.llvm.org/show_bug.cgi?id=41170

The AlwaysBreakAfterReturn type setting can go wrong if the line ends with a comment
```
void foo() /* comment */
```
or

```
void foo() // comment
```

It will incorrectly see such functions as Declarations and not Definitions

The following code addresses this by looking for function which end with `; <comment>` rather than just `;` or `<comment>`

Reviewers: klimek, djasper, reuk, russellmcc, owenpan, sammccall
Reviewed By: owenpan
Subscribers: lebedev.ri, cfe-commits, sammccall
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60363

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

5 years ago[c++20] Enable driver and frontend support for building and using
Richard Smith [Sun, 14 Apr 2019 11:11:37 +0000 (11:11 +0000)]
[c++20] Enable driver and frontend support for building and using
modules when -std=c++2a is specified.

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

5 years ago[c++20] Parsing support for module-declarations, import-declarations,
Richard Smith [Sun, 14 Apr 2019 08:06:59 +0000 (08:06 +0000)]
[c++20] Parsing support for module-declarations, import-declarations,
and the global and private module fragment.

For now, the private module fragment introducer is ignored, but use of
the global module fragment introducer should be properly enforced.

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

5 years ago[CommandLineParser] Add DefaultOption flag
Don Hinton [Sat, 13 Apr 2019 16:55:28 +0000 (16:55 +0000)]
[CommandLineParser] Add DefaultOption flag

Summary: Add DefaultOption flag to CommandLineParser which provides a
default option or alias, but allows users to override it for some
other purpose as needed.

Also, add `-h` as a default alias to `-help`, which can be seamlessly
overridden by applications like llvm-objdump and llvm-readobj which
use `-h` as an alias for other options.

Reviewers: alexfh, klimek

Reviewed By: klimek

Subscribers: MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits

Tags: #clang, #llvm

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

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

5 years ago[verify] Add support for location markers in directives.
Richard Smith [Sat, 13 Apr 2019 04:33:39 +0000 (04:33 +0000)]
[verify] Add support for location markers in directives.

A marker (matching /#[A-Za-z0-9_-]/) is specified by attaching a comment
containing the marker to the line at which the diagnostic is expected,
and then can be referenced from an expected-* directive after an @:

  foo // #1
  // expected-error@#1 {{undeclared identifier 'foo'}}

The intent is for markers to be used in situations where relative line
numbers are currently used, to avoid the need to renumber when the test
case is rearranged.

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

5 years ago[analyzer] Escape pointers stored into top-level parameters with destructors.
Artem Dergachev [Sat, 13 Apr 2019 02:01:45 +0000 (02:01 +0000)]
[analyzer] Escape pointers stored into top-level parameters with destructors.

Writing stuff into an argument variable is usually equivalent to writing stuff
to a local variable: it will have no effect outside of the function.
There's an important exception from this rule: if the argument variable has
a non-trivial destructor, the destructor would be invoked on
the parent stack frame, exposing contents of the otherwise dead
argument variable to the caller.

If such argument is the last place where a pointer is stored before the function
exits and the function is the one we've started our analysis from (i.e., we have
no caller context for it), we currently diagnose a leak. This is incorrect
because the destructor of the argument still has access to the pointer.
The destructor may deallocate the pointer or even pass it further.

Treat writes into such argument regions as "escapes" instead, suppressing
spurious memory leak reports but not messing with dead symbol removal.

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

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

5 years agoRelanding r357928 with fixed debuginfo check.
Amy Huang [Fri, 12 Apr 2019 20:25:30 +0000 (20:25 +0000)]
Relanding r357928 with fixed debuginfo check.

[MS] Add metadata for __declspec(allocator)

Original summary:
Emit !heapallocsite in the metadata for calls to functions marked with
__declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug
info in codeview.

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

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

5 years ago[HIP] Use -mlink-builtin-bitcode to link device library
Yaxun Liu [Fri, 12 Apr 2019 16:23:31 +0000 (16:23 +0000)]
[HIP] Use -mlink-builtin-bitcode to link device library

Use -mlink-builtin-bitcode instead of llvm-link to link
device library so that device library bitcode and user
device code can be compiled in a consistent way.

This is the same approach used by CUDA and OpenMP.

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

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

5 years ago[AST][NFC] Add const children() accessors to all AST nodes
Bruno Ricci [Fri, 12 Apr 2019 15:36:02 +0000 (15:36 +0000)]
[AST][NFC] Add const children() accessors to all AST nodes

Systematically add the const-qualified version of children()
to all statement/expression nodes. Previously the const-qualified
variant was only defined for some nodes. NFC.

Patch by: Nicolas Manichon

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

Reviewed By: riccibruno

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

5 years ago[asan] Add gcc 8's driver option -fsanitize=pointer-compare and -fsanitize=pointer...
Pierre Gousseau [Fri, 12 Apr 2019 14:14:58 +0000 (14:14 +0000)]
[asan] Add gcc 8's driver option -fsanitize=pointer-compare and -fsanitize=pointer-substract.

Disabled by default as this is still an experimental feature.

Reviewed By: thakis

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

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

5 years ago[AST] Forbid copy/move of statements/types
Bruno Ricci [Fri, 12 Apr 2019 13:26:55 +0000 (13:26 +0000)]
[AST] Forbid copy/move of statements/types

Statements, expressions and types are not supposed to be copied/moved,
and trying to do so is only going to result in tears. Someone tripped
on this a few days ago on the mailing list. NFC.

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

Reviewed By: aaron.ballman

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

5 years ago[Aarch64] Add v8.2-a half precision element extract intrinsics
Diogo N. Sampaio [Fri, 12 Apr 2019 10:43:48 +0000 (10:43 +0000)]
[Aarch64] Add v8.2-a half precision element extract intrinsics

Summary:
Implements the intrinsics define on the ACLE to extract half precision fp scalar elements from float16x4_t and float16x8_t vector types.
a.k.a:
vduph_lane_f16
vduph_laneq_f16

Reviewers: pablooliveira, olista01, LukeGeeson, DavidSpickett

Reviewed By: DavidSpickett

Subscribers: DavidSpickett, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] Use SpacesBeforeTrailingComments for "option" directive
Krasimir Georgiev [Fri, 12 Apr 2019 10:11:34 +0000 (10:11 +0000)]
[clang-format] Use SpacesBeforeTrailingComments for "option" directive

Summary:
AnnotatingParser::next() is needed to implicitly set TT_BlockComment
versus TT_LineComment.  On most other paths through
AnnotatingParser::parseLine(), all tokens are consumed to achieve that.
This change updates one place where this wasn't done.

Contributed by @dchai!

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clangd] Print template arguments helper
Kadir Cetinkaya [Fri, 12 Apr 2019 10:09:14 +0000 (10:09 +0000)]
[clangd] Print template arguments helper

Summary:
Prepares ground for printing template arguments as written in the
source code, part of re-landing rC356541 with D59599 applied.

Reviewers: ioeric, ilya-biryukov

Subscribers: mgorny, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years agoEnable frame pointer elimination for OpenBSD on x86 and mips64.
Brad Smith [Fri, 12 Apr 2019 01:29:18 +0000 (01:29 +0000)]
Enable frame pointer elimination for OpenBSD on x86 and mips64.

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

5 years agoVariable auto-init: also auto-init alloca
JF Bastien [Fri, 12 Apr 2019 00:11:27 +0000 (00:11 +0000)]
Variable auto-init: also auto-init alloca

Summary:
alloca isn’t auto-init’d right now because it’s a different path in clang that
all the other stuff we support (it’s a builtin, not an expression).
Interestingly, alloca doesn’t have a type (as opposed to even VLA) so we can
really only initialize it with memset.

<rdar://problem/49794007>

Subscribers: jkorous, dexonsmith, cfe-commits, rjmccall, glider, kees, kcc, pcc

Tags: #clang

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

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

5 years agoRevert r357610, it caused PR41471
Nico Weber [Thu, 11 Apr 2019 21:26:34 +0000 (21:26 +0000)]
Revert r357610, it caused PR41471

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

5 years ago[C++20] Implement context-sensitive header-name lexing and pp-import parsing in the...
Richard Smith [Thu, 11 Apr 2019 21:18:23 +0000 (21:18 +0000)]
[C++20] Implement context-sensitive header-name lexing and pp-import parsing in the preprocessor.

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