]> granicus.if.org Git - clang/log
clang
6 years ago[libclang] Fix cursors for functions with trailing return type
Ivan Donchevskii [Wed, 3 Jan 2018 14:35:48 +0000 (14:35 +0000)]
[libclang] Fix cursors for functions with trailing return type

This one was rolled back as follow-up to the failing commit.
Second try.

For the function declaration

auto foo5(Foo) -> Foo;
the parameter tokens were mapped to cursors representing the
FunctionDecl:

Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6
Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6
Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6
Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef
Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6
Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6
Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8
Punctuation: ";" [1:19 - 1:20]

Fix this by ensuring that the trailing return type is not visited as
first.

Patch by Nikolai Kosjar.

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

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

6 years agoRevert r321697 "[libclang] Support querying whether a declaration is invalid" and...
Hans Wennborg [Wed, 3 Jan 2018 14:20:15 +0000 (14:20 +0000)]
Revert r321697 "[libclang] Support querying whether a declaration is invalid" and follow-ups.

This broke test/Index/opencl-types.cl on several buildbots:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/3294
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/6498
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/5239

> [libclang] Support querying whether a declaration is invalid
>
> This is useful for e.g. highlighting purposes in an IDE.
>
> Patch by Nikolai Kosjar.
>
> Differential Revision: https://reviews.llvm.org/D40072

Also reverting follow-ups that otherwise caused conflicts for the
revert:

r321700 "Fix line endings."
r321701 "Fix more line endings."

r321698 "[libclang] Fix cursors for functions with trailing return type"
> For the function declaration
>
> auto foo5(Foo) -> Foo;
> the parameter tokens were mapped to cursors representing the
> FunctionDecl:
>
> Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6
> Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6
> Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6
> Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef
> Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6
> Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6
> Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8
> Punctuation: ";" [1:19 - 1:20]
>
> Fix this by ensuring that the trailing return type is not visited as
> first.
>
> Patch by Nikolai Kosjar.
>
> Differential Revision: https://reviews.llvm.org/D40561

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

6 years agoUserManual: Update with the latest clang-cl flags
Hans Wennborg [Wed, 3 Jan 2018 13:20:25 +0000 (13:20 +0000)]
UserManual: Update with the latest clang-cl flags

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

6 years agoFix more line endings.
Ivan Donchevskii [Wed, 3 Jan 2018 10:40:11 +0000 (10:40 +0000)]
Fix more line endings.

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

6 years agoFix line endings.
Ivan Donchevskii [Wed, 3 Jan 2018 10:33:21 +0000 (10:33 +0000)]
Fix line endings.

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

6 years ago[libclang] Fix cursors for functions with trailing return type
Ivan Donchevskii [Wed, 3 Jan 2018 10:04:37 +0000 (10:04 +0000)]
[libclang] Fix cursors for functions with trailing return type

For the function declaration

auto foo5(Foo) -> Foo;
the parameter tokens were mapped to cursors representing the
FunctionDecl:

Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6
Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6
Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6
Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef
Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6
Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6
Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8
Punctuation: ";" [1:19 - 1:20]

Fix this by ensuring that the trailing return type is not visited as
first.

Patch by Nikolai Kosjar.

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

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

6 years ago[libclang] Support querying whether a declaration is invalid
Ivan Donchevskii [Wed, 3 Jan 2018 09:49:31 +0000 (09:49 +0000)]
[libclang] Support querying whether a declaration is invalid

This is useful for e.g. highlighting purposes in an IDE.

Patch by Nikolai Kosjar.

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

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

6 years ago[libclang] Add clang_getFileContents to libclang.exports
Ivan Donchevskii [Wed, 3 Jan 2018 09:17:08 +0000 (09:17 +0000)]
[libclang] Add clang_getFileContents to libclang.exports

This is the follow up patch for rL319881 which introduced
the function but did not put it into .exports file.

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

6 years agoUpdate clang cc1as for createMCAsmBackend change in r321692
Alex Bradbury [Wed, 3 Jan 2018 08:53:24 +0000 (08:53 +0000)]
Update clang cc1as for createMCAsmBackend change in r321692

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

6 years ago[Sema] -Wtautological-constant-compare is too good. Cripple it.
Roman Lebedev [Wed, 3 Jan 2018 08:45:19 +0000 (08:45 +0000)]
[Sema] -Wtautological-constant-compare is too good. Cripple it.

Summary:
The diagnostic was mostly introduced in D38101 by me, as a reaction to wasting a lot of time, see [[ https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20171009/206427.html | mail ]].
However, the diagnostic is pretty dumb. While it works with no false-positives,
there are some questionable cases that are diagnosed when one would argue that they should not be.

The common complaint is that it diagnoses the comparisons between an `int` and
`long` when compiling for a 32-bit target as tautological, but not when
compiling for 64-bit targets. The underlying problem is obvious: data model.
In most cases, 64-bit target is `LP64` (`int` is 32-bit, `long` and pointer are
64-bit), and the 32-bit target is `ILP32` (`int`, `long`, and pointer are 32-bit).

I.e. the common pattern is: (pseudocode)
```
#include <limits>
#include <cstdint>
int main() {
  using T1 = long;
  using T2 = int;

  T1 r;
  if (r < std::numeric_limits<T2>::min()) {}
  if (r > std::numeric_limits<T2>::max()) {}
}
```
As an example, D39149 was trying to fix this diagnostic in libc++, and it was not well-received.

This *could* be "fixed", by changing the diagnostics logic to something like
`if the types of the values being compared are different, but are of the same size, then do diagnose`,
and i even attempted to do so in D39462, but as @rjmccall rightfully commented,
that implementation is incomplete to say the least.

So to stop causing trouble, and avoid contaminating upcoming release, lets do this workaround:
* move these three diags (`warn_unsigned_always_true_comparison`, `warn_unsigned_enum_always_true_comparison`, `warn_tautological_constant_compare`) into it's own `-Wtautological-constant-in-range-compare`
* Disable them by default
* Make them part of `-Wextra`
* Additionally, give `warn_tautological_constant_compare` it's own flag `-Wtautological-type-limit-compare`.
  I'm not happy about that name, but i can't come up with anything better.

This way all three of them can be enabled/disabled either altogether, or one-by-one.

Reviewers: aaron.ballman, rsmith, smeenai, rjmccall, rnk, mclow.lists, dim

Reviewed By: aaron.ballman, rsmith, dim

Subscribers: thakis, compnerd, mehdi_amini, dim, hans, cfe-commits, rjmccall

Tags: #clang

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

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

6 years agoPR35697: look at the first declaration when determining whether a function or
Richard Smith [Wed, 3 Jan 2018 02:34:35 +0000 (02:34 +0000)]
PR35697: look at the first declaration when determining whether a function or
variable is extern "C" in linkage calculations.

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

6 years agoFix and simplify handling of return type for (generic) lambda conversion function...
Richard Smith [Tue, 2 Jan 2018 23:52:42 +0000 (23:52 +0000)]
Fix and simplify handling of return type for (generic) lambda conversion function to function pointer.

Previously, we would:
 * compute the type of the conversion function and static invoker as a
   side-effect of template argument deduction for a conversion
 * re-compute the type as part of deduced return type deduction when building
   the conversion function itself

Neither of these turns out to be quite correct. There are other ways to reach a
declaration of the conversion function than in a conversion (such as an
explicit call or friend declaration), and performing auto deduction causes the
function type to be rebuilt in the context of the lambda closure type (which is
different from the context in which it originally appeared, resulting in
spurious substitution failures for constructs that are valid in one context but
not the other, such as the use of an enclosing class's "this" pointer).

This patch switches us to use a different strategy: as before, we use the
declared type of the operator() to form the type of the conversion function and
invoker, but we now populate that type as part of return type deduction for the
conversion function. And the invoker is now treated as simply being an
implementation detail of building the conversion function, and isn't given
special treatment by template argument deduction for the conversion function
any more.

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

6 years ago[analyzer] do not crash with assertion on processing locations of bodyfarmed functions
George Karpenkov [Tue, 2 Jan 2018 23:05:47 +0000 (23:05 +0000)]
[analyzer] do not crash with assertion on processing locations of bodyfarmed functions

This addresses an issue introduced in r183451: since
`removePiecesWithInvalidLocations` is called *after* `adjustCallLocations`,
it is not necessary, and in fact harmful, to have this assertion in
adjustCallLocations.

Addresses rdar://36170689

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

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

6 years ago[WinEH] Allow for multiple terminatepads
Reid Kleckner [Tue, 2 Jan 2018 21:34:16 +0000 (21:34 +0000)]
[WinEH] Allow for multiple terminatepads

Fixes verifier errors with Windows EH and OpenMP, which injects a
terminate scope around parallel blocks.

Fixes PR35778

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

6 years ago[DOXYGEN] Fix doxygen and content issues in smmintrin.h
Douglas Yung [Tue, 2 Jan 2018 20:45:29 +0000 (20:45 +0000)]
[DOXYGEN] Fix doxygen and content issues in smmintrin.h

- Fix formatting issue due to hyphenated terms at line breaks.
- Fix typo

This patch was made by Craig Flores

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

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

6 years ago[DOXYGEN] Fix doxygen and content issues in pmmintrin.h
Douglas Yung [Tue, 2 Jan 2018 20:42:53 +0000 (20:42 +0000)]
[DOXYGEN] Fix doxygen and content issues in pmmintrin.h

- Fix incorrect wording in various intrinsic descriptions. Previously the descriptions used "low-order" and "high-order" when the intended meaning was "even-indexed" and "odd-indexed".

This patch was made by Craig Flores

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

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

6 years ago[DOXYGEN] Fix doxygen and content issues in emmintrin.h
Douglas Yung [Tue, 2 Jan 2018 20:39:29 +0000 (20:39 +0000)]
[DOXYGEN] Fix doxygen and content issues in emmintrin.h

- Fixed innaccurate instruction mappings for various intrinsics.
- Fixed description of NaN handling in comparison intrinsics.
- Unify description of _mm_store_pd1 to match _mm_store1_pd.
- Fix incorrect wording in various intrinsic descriptions. Previously the descriptions used "low-order" and "high-order" when the intended meaning was "even-indexed" and "odd-indexed".
- Fix typos.
- Add missing italics command (\a) for params and fixed some parameter spellings.

This patch was made by Craig Flores

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

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

6 years agoSuppress undefined-template warnings when the pattern is declared in a system header.
Nick Lewycky [Tue, 2 Jan 2018 19:10:12 +0000 (19:10 +0000)]
Suppress undefined-template warnings when the pattern is declared in a system header.

The way to fix an undefined-template warning is to add lines to the header file that defines the template pattern. We should suppress the warnings when the template pattern is in a system header because we don't expect users to edit those.

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

6 years ago[Sema] Don't emit the -Wstrict-prototypes warning for variadic functions.
Volodymyr Sapsai [Tue, 2 Jan 2018 18:02:19 +0000 (18:02 +0000)]
[Sema] Don't emit the -Wstrict-prototypes warning for variadic functions.

rdar://problem/33251668

Reviewers: arphaman, ahatanak

Reviewed By: arphaman

Subscribers: ptitei, cfe-commits

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

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

6 years agoRevert "ASan+operator new[]: Fix operator new[] cookie poisoning"
Filipe Cabecinhas [Tue, 2 Jan 2018 13:46:12 +0000 (13:46 +0000)]
Revert "ASan+operator new[]: Fix operator new[] cookie poisoning"

This reverts r321645.

I missed a compiler-rt test that needs updating.

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

6 years agoASan+operator new[]: Fix operator new[] cookie poisoning
Filipe Cabecinhas [Tue, 2 Jan 2018 13:21:50 +0000 (13:21 +0000)]
ASan+operator new[]: Fix operator new[] cookie poisoning

Summary:
The C++ Itanium ABI says:
No cookie is required if the new operator being used is ::operator new[](size_t, void*).

We should only avoid poisoning the cookie if we're calling this
operator, not others. This is dealt with before the call to
InitializeArrayCookie.

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

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

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

6 years ago[Driver] Fix unused variables and test-writing-into-workdir after r321621
Sam McCall [Tue, 2 Jan 2018 09:35:10 +0000 (09:35 +0000)]
[Driver] Fix unused variables and test-writing-into-workdir after r321621

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

6 years agoAgain reverting an attempt to convert the DeclSpec enums into scoped enums.
Faisal Vali [Mon, 1 Jan 2018 18:23:28 +0000 (18:23 +0000)]
Again reverting an attempt to convert the DeclSpec enums into scoped enums.
  - reverts r321622, r321625, and r321626.
  - the use of bit-fields is still resulting in warnings - even though we can use static-asserts to harden the code and ensure the bit-fields are wide enough.  The bots still complain of warnings being seen.
  - to silence the warnings requires specifying the bit-fields with the underlying enum type (as opposed to the enum type itself), which then requires lots of unnecessary static casts of each enumerator within DeclSpec to the underlying-type, which even though could be seen as implementation details, it does hamper readability - and given the additional litterings, makes me question the value of the change.

So in short - I give up (for now at least).

Sorry about the noise.

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

6 years ago[Sema] Fix build with GCC
Benjamin Kramer [Mon, 1 Jan 2018 17:07:23 +0000 (17:07 +0000)]
[Sema] Fix build with GCC

tools/clang/lib/Sema/DeclSpec.cpp: In member function 'void clang::DeclSpec::Finish(clang::Sema&, const clang::PrintingPolicy&)':
tools/clang/lib/Sema/DeclSpec.cpp:1116:8: error: could not convert 'clang::DeclSpec::TSW_unspecified' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'
tools/clang/lib/Sema/DeclSpec.cpp:1117:8: error: could not convert 'clang::DeclSpec::TSW_short' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'
tools/clang/lib/Sema/DeclSpec.cpp:1118:8: error: could not convert 'clang::DeclSpec::TSW_longlong' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'
tools/clang/lib/Sema/DeclSpec.cpp:1128:8: error: could not convert 'clang::DeclSpec::TSW_long' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'

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

6 years agoUse 'unsigned int' instead of enum bit-fields to silence some warnings from r321622
Faisal Vali [Mon, 1 Jan 2018 16:36:47 +0000 (16:36 +0000)]
Use 'unsigned int' instead of enum bit-fields to silence some warnings from r321622
  - bots were complaining that the bit-field width was less than the width of the underlying type (note, underlying types of enums can not be bit-fields)
  - add static_asserts for TSS and TSW to ensure that the bit-fields can hold all the enumerators - and add comments next to the last enumerator warning not to reorder.

See https://reviews.llvm.org/rC321622 for the patch that introduced the warnings.

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

6 years agoFixed markup formatting
Serge Pavlov [Mon, 1 Jan 2018 15:53:16 +0000 (15:53 +0000)]
Fixed markup formatting

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

6 years ago[NFC] Modernize enums TypeSpecifierWidth, TypeSpecifierSign & TypeSpecifierType into...
Faisal Vali [Mon, 1 Jan 2018 15:42:13 +0000 (15:42 +0000)]
[NFC] Modernize enums TypeSpecifierWidth, TypeSpecifierSign & TypeSpecifierType into scoped enums with underlying types.
  - Since these enums are used as bit-fields - for the bit-fields to be interpreted as unsigned, the underlying type must be specified as unsigned.

Previous failed attempt - wherein I did not specify an underlying type - was the sum of:
https://reviews.llvm.org/rC321614
https://reviews.llvm.org/rC321615

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

6 years agoEnable configuration files in clang
Serge Pavlov [Mon, 1 Jan 2018 13:27:01 +0000 (13:27 +0000)]
Enable configuration files in clang

Clang is inherently a cross compiler and can generate code for any target
enabled during build. It however requires to specify many parameters in the
invocation, which could be hardcoded during configuration process in the
case of single-target compiler. The purpose of configuration files is to
make specifying clang arguments easier.

A configuration file is a collection of driver options, which are inserted
into command line before other options specified in the clang invocation.
It groups related options together and allows specifying them in simpler,
more flexible and less error prone way than just listing the options
somewhere in build scripts. Configuration file may be thought as a "macro"
that names an option set and is expanded when the driver is called.

Use of configuration files is described in `UserManual.rst`.

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

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

6 years agoRevert r321614 and r321615
Faisal Vali [Mon, 1 Jan 2018 02:49:17 +0000 (02:49 +0000)]
Revert r321614 and r321615
  - the enum changes to TypeSpecifierType are breaking some tests - and will require a more careful integration.

Sorry about rushing these changes - thought I could sneak them in prior to heading out for new years ;)

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

6 years agoAdd scope specifiers to updated scoped-enums (that I somehow missed in r321614)
Faisal Vali [Mon, 1 Jan 2018 02:35:43 +0000 (02:35 +0000)]
Add scope specifiers to updated scoped-enums (that I somehow missed in r321614)

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

6 years ago[NFC] Modernize enums TypeSpecifierWidth, TypeSpecifierSign & TypeSpecifierType into...
Faisal Vali [Mon, 1 Jan 2018 02:19:52 +0000 (02:19 +0000)]
[NFC] Modernize enums TypeSpecifierWidth, TypeSpecifierSign & TypeSpecifierType into scoped enums.

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

6 years ago[Sema] Improve diagnostics for const- and ref-qualified member functions
Jacob Bandes-Storch [Sun, 31 Dec 2017 18:27:29 +0000 (18:27 +0000)]
[Sema] Improve diagnostics for const- and ref-qualified member functions

(Re-submission of D39937 with fixed tests.)

Adjust wording for const-qualification mismatch to be a little more clear.

Also add another diagnostic for a ref qualifier mismatch, which previously produced a useless error (this error path is simply very old; see rL119336):

Before:
  error: cannot initialize object parameter of type 'X0' with an expression of type 'X0'

After:
  error: 'this' argument to member function 'rvalue' is an lvalue, but function has rvalue ref-qualifier

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: lebedev.ri, cfe-commits

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

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

6 years agoReverted 321592: [Sema] Improve diagnostics for const- and ref-qualified member functions
Jacob Bandes-Storch [Sun, 31 Dec 2017 05:13:03 +0000 (05:13 +0000)]
Reverted 321592: [Sema] Improve diagnostics for const- and ref-qualified member functions

A few tests need to be fixed

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

6 years ago[Sema] Improve diagnostics for const- and ref-qualified member functions
Jacob Bandes-Storch [Sun, 31 Dec 2017 04:49:39 +0000 (04:49 +0000)]
[Sema] Improve diagnostics for const- and ref-qualified member functions

Summary:
Adjust wording for const-qualification mismatch to be a little more clear.

Also add another diagnostic for a ref qualifier mismatch, which previously produced a useless error (this error path is simply very old; see rL119336):

Before:
  error: cannot initialize object parameter of type 'X0' with an expression of type 'X0'

After:
  error: 'this' argument to member function 'rvalue' is an lvalue, but function has rvalue ref-qualifier

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: lebedev.ri, aaron.ballman, cfe-commits

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

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

6 years ago[NFC] Modernize enum DeclSpecContext into a scoped enum.
Faisal Vali [Sun, 31 Dec 2017 00:06:40 +0000 (00:06 +0000)]
[NFC] Modernize enum DeclSpecContext into a scoped enum.

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

6 years agoReverted 321587: Enable configuration files in clang
Serge Pavlov [Sat, 30 Dec 2017 18:38:44 +0000 (18:38 +0000)]
Reverted 321587: Enable configuration files in clang

Need to check targets in tests more carefully.

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

6 years agoEnable configuration files in clang
Serge Pavlov [Sat, 30 Dec 2017 17:59:26 +0000 (17:59 +0000)]
Enable configuration files in clang

Clang is inherently a cross compiler and can generate code for any target
enabled during build. It however requires to specify many parameters in the
invocation, which could be hardcoded during configuration process in the
case of single-target compiler. The purpose of configuration files is to
make specifying clang arguments easier.

A configuration file is a collection of driver options, which are inserted
into command line before other options specified in the clang invocation.
It groups related options together and allows specifying them in simpler,
more flexible and less error prone way than just listing the options
somewhere in build scripts. Configuration file may be thought as a "macro"
that names an option set and is expanded when the driver is called.

Use of configuration files is described in `UserManual.rst`.

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

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

6 years ago[NFC] Modernize enum 'UnqualifiedId::IdKind' into a scoped enum UnqualifiedIdKind.
Faisal Vali [Sat, 30 Dec 2017 04:15:27 +0000 (04:15 +0000)]
[NFC] Modernize enum 'UnqualifiedId::IdKind' into a scoped enum UnqualifiedIdKind.

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

6 years ago[docs] Added description of `-f[no]-openmp-simd` option to UsersManual.
Alexey Bataev [Fri, 29 Dec 2017 18:27:00 +0000 (18:27 +0000)]
[docs] Added description of `-f[no]-openmp-simd` option to UsersManual.

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

6 years ago[docs] Updated ReleaseNotes for OpenMP part.
Alexey Bataev [Fri, 29 Dec 2017 18:23:12 +0000 (18:23 +0000)]
[docs] Updated ReleaseNotes for OpenMP part.

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

6 years ago[OPENMP] Support for -fopenmp-simd option with compilation of simd loops
Alexey Bataev [Fri, 29 Dec 2017 18:07:07 +0000 (18:07 +0000)]
[OPENMP] Support for -fopenmp-simd option with compilation of simd loops
only.

Added support for -fopenmp-simd option that allows compilation of
simd-based constructs without emission of OpenMP runtime calls.

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

6 years ago[driver][darwin] Take the OS version from -m<os>-version-min argument when
Alex Lorenz [Fri, 29 Dec 2017 17:42:40 +0000 (17:42 +0000)]
[driver][darwin] Take the OS version from -m<os>-version-min argument when
-target has no OS version

This ensures that Clang won't warn about redundant -m<os>-version-min
argument for an invocation like
`-target x86_64-apple-macos -mmacos-version-min=10.11`

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

6 years ago[OPENMP] Initial support for `-fopenmp-simd` option.
Alexey Bataev [Fri, 29 Dec 2017 17:36:15 +0000 (17:36 +0000)]
[OPENMP] Initial support for `-fopenmp-simd` option.

Added basic support for `-fopenmp-simd` options.

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

6 years agoRevert r321504 "[X86] Don't accidentally enable PKU on cannon lake and icelake or...
Craig Topper [Fri, 29 Dec 2017 06:39:16 +0000 (06:39 +0000)]
Revert r321504 "[X86] Don't accidentally enable PKU on cannon lake and icelake or CLWB on cannonlake."

I based that commit on what was in Intel's public documentation here https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

Which specifically said CLWB wasn't until Icelake.

But I've since cross checked with SDE and it thinks these features exist on CNL and ICL. So now I don't know what to believe.

I've added test coverage of the current behavior as part of the revert so at least now have proof of what we're doing.

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

6 years ago[NFC] Modernize enum Declarator::TheContext to a type-safe scoped enum.
Faisal Vali [Fri, 29 Dec 2017 05:41:00 +0000 (05:41 +0000)]
[NFC] Modernize enum Declarator::TheContext to a type-safe scoped enum.

Note, we don't do any bitwise manipulations when using them.

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

6 years agoAvoid int to string conversion in Twine or raw_ostream contexts.
Benjamin Kramer [Thu, 28 Dec 2017 16:58:54 +0000 (16:58 +0000)]
Avoid int to string conversion in Twine or raw_ostream contexts.

Some output changes from uppercase hex to lowercase hex, no other functionality change intended.

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

6 years ago[Frontend] Correctly handle instantiating ctors with skipped bodies
Ilya Biryukov [Thu, 28 Dec 2017 13:05:46 +0000 (13:05 +0000)]
[Frontend] Correctly handle instantiating ctors with skipped bodies

Summary:
Previsouly clang tried instantiating member initializers even if ctor
body was skipped, this caused spurious errors (see the test).

Reviewers: sepavloff, klimek

Reviewed By: sepavloff

Subscribers: cfe-commits

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

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

6 years ago-fsanitize=vptr warnings on bad static types in dynamic_cast and typeid
Stephan Bergmann [Thu, 28 Dec 2017 12:45:41 +0000 (12:45 +0000)]
-fsanitize=vptr warnings on bad static types in dynamic_cast and typeid

...when such an operation is done on an object during con-/destruction.

This is the cfe part of a patch covering both cfe and compiler-rt.

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

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

6 years ago[X86] Don't accidentally enable PKU on cannon lake and icelake or CLWB on cannonlake.
Craig Topper [Wed, 27 Dec 2017 22:26:01 +0000 (22:26 +0000)]
[X86] Don't accidentally enable PKU on cannon lake and icelake or CLWB on cannonlake.

We have cannonlake and icelake inheriting from skylake server in a switch using fallthroughs. But they aren't perfect supersets of skylake server.

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

6 years ago[X86] Test that -march=skx enables PKU.
Craig Topper [Wed, 27 Dec 2017 22:26:00 +0000 (22:26 +0000)]
[X86] Test that -march=skx enables PKU.

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

6 years ago[X86] Enable avx512vpopcntdq and clwb for icelake.
Craig Topper [Wed, 27 Dec 2017 22:25:59 +0000 (22:25 +0000)]
[X86] Enable avx512vpopcntdq and clwb for icelake.

Per table 1-1 of the October 2017 edition of Intel® Architecture Instruction Set Extensions and Future Features Programming Reference

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

6 years ago[OPENMP] Support for `depend` clauses on `target enter|exit data`.
Alexey Bataev [Wed, 27 Dec 2017 18:49:38 +0000 (18:49 +0000)]
[OPENMP] Support for `depend` clauses on `target enter|exit data`.

Added codegen for `depend` clauses on `target enter|exit data` directives.

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

6 years ago[NFC] Small const correctness fix
Hamza Sood [Wed, 27 Dec 2017 18:05:29 +0000 (18:05 +0000)]
[NFC] Small const correctness fix

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

6 years ago[OPENMP] Support for `depend` clauses on `target data update`.
Alexey Bataev [Wed, 27 Dec 2017 17:58:32 +0000 (17:58 +0000)]
[OPENMP] Support for `depend` clauses on `target data update`.

Added codegen for `depend` clauses on `target data update` directives.

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

6 years ago[ASTImporter] Support importing FunctionTemplateDecl and CXXDependentScopeMemberExpr
Aleksei Sidorin [Wed, 27 Dec 2017 17:04:42 +0000 (17:04 +0000)]
[ASTImporter] Support importing FunctionTemplateDecl and CXXDependentScopeMemberExpr

* Also introduces ImportTemplateArgumentListInfo facility (A. Sidorin)

This re-commits r320942 after fixing the behaviour on '-fdelayed-template-parsing'
option and adding additional checks.

Patch by Peter Szecsi!

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

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

6 years ago[x86][icelake][vbmi2]
Coby Tayree [Wed, 27 Dec 2017 11:25:07 +0000 (11:25 +0000)]
[x86][icelake][vbmi2]
added vbmi2 feature recognition
added intrinsics support for vbmi2 instructions
_mm[128,256,512]_mask[z]_compress_epi[16,32]
_mm[128,256,512]_mask_compressstoreu_epi[16,32]
_mm[128,256,512]_mask[z]_expand_epi[16,32]
_mm[128,256,512]_mask[z]_expandloadu_epi[16,32]
_mm[128,256,512]_mask[z]_sh[l,r]di_epi[16,32,64]
_mm[128,256,512]_mask_sh[l,r]dv_epi[16,32,64]
matching a similar work on the backend (D40206)
Differential Revision: https://reviews.llvm.org/D41557

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

6 years ago[OpenMP] Further adjustments of nvptx runtime functions
Jonas Hahnfeld [Wed, 27 Dec 2017 10:39:56 +0000 (10:39 +0000)]
[OpenMP] Further adjustments of nvptx runtime functions

Pass in default value of 1, similar to previous commit r318836.

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

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

6 years ago[x86][icelake][vnni]
Coby Tayree [Wed, 27 Dec 2017 10:37:51 +0000 (10:37 +0000)]
[x86][icelake][vnni]
added vnni feature recognition
added intrinsics support for VNNI instructions
_mm256_mask_dpbusd_epi32
_mm256_maskz_dpbusd_epi32
_mm256_dpbusd_epi32
_mm256_mask_dpbusds_epi32
_mm256_maskz_dpbusds_epi32
_mm256_dpbusds_epi32
_mm256_mask_dpwssd_epi32
_mm256_maskz_dpwssd_epi32
_mm256_dpwssd_epi32
_mm256_mask_dpwssds_epi32
_mm256_maskz_dpwssds_epi32
_mm256_dpwssds_epi32
_mm128_mask_dpbusd_epi32
_mm128_maskz_dpbusd_epi32
_mm128_dpbusd_epi32
_mm128_mask_dpbusds_epi32
_mm128_maskz_dpbusds_epi32
_mm128_dpbusds_epi32
_mm128_mask_dpwssd_epi32
_mm128_maskz_dpwssd_epi32
_mm128_dpwssd_epi32
_mm128_mask_dpwssds_epi32
_mm128_maskz_dpwssds_epi32
_mm128_dpwssds_epi32
_mm512_mask_dpbusd_epi32
_mm512_maskz_dpbusd_epi32
_mm512_dpbusd_epi32
_mm512_mask_dpbusds_epi32
_mm512_maskz_dpbusds_epi32
_mm512_dpbusds_epi32
_mm512_mask_dpwssd_epi32
_mm512_maskz_dpwssd_epi32
_mm512_dpwssd_epi32
_mm512_mask_dpwssds_epi32
_mm512_maskz_dpwssds_epi32
_mm512_dpwssds_epi32
matching a similar work on the backend (D40208)
Differential Revision: https://reviews.llvm.org/D41558

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

6 years ago[x86][icelake][bitalg]
Coby Tayree [Wed, 27 Dec 2017 10:01:00 +0000 (10:01 +0000)]
[x86][icelake][bitalg]
added bitalg feature recognition
added intrinsics support for bitalg instructions
_mm512_popcnt_epi16
_mm512_mask_popcnt_epi16
_mm512_maskz_popcnt_epi16
_mm512_popcnt_epi8
_mm512_mask_popcnt_epi8
_mm512_maskz_popcnt_epi8
_mm512_mask_bitshuffle_epi64_mask
_mm512_bitshuffle_epi64_mask
_mm256_popcnt_epi16
_mm256_mask_popcnt_epi16
_mm256_maskz_popcnt_epi16
_mm128_popcnt_epi16
_mm128_mask_popcnt_epi16
_mm128_maskz_popcnt_epi16
_mm256_popcnt_epi8
_mm256_mask_popcnt_epi8
_mm256_maskz_popcnt_epi8
_mm128_popcnt_epi8
_mm128_mask_popcnt_epi8
_mm128_maskz_popcnt_epi8
_mm256_mask_bitshuffle_epi32_mask
_mm256_bitshuffle_epi32_mask
_mm128_mask_bitshuffle_epi16_mask
_mm128_bitshuffle_epi16_mask
matching a similar work on the backend (D40222)
Differential Revision: https://reviews.llvm.org/D41564

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

6 years ago[hotfix]
Coby Tayree [Wed, 27 Dec 2017 09:22:34 +0000 (09:22 +0000)]
[hotfix]
fixinig test failures as seen here:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/22791/steps/test/logs/stdio
which resulted by rL321480

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

6 years ago[x86][icelake][vpclmulqdq]
Coby Tayree [Wed, 27 Dec 2017 09:00:31 +0000 (09:00 +0000)]
[x86][icelake][vpclmulqdq]
added vpclmulqdq feature recognition
added intrinsics support for vpclmulqdq instructions
  _mm256_clmulepi64_epi128
  _mm512_clmulepi64_epi128
matching a similar work on the backend (D40101)
Differential Revision: https://reviews.llvm.org/D41573

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

6 years ago[x86][icelake][gfni]
Coby Tayree [Wed, 27 Dec 2017 08:37:47 +0000 (08:37 +0000)]
[x86][icelake][gfni]
added gfni feature recognition
added intrinsics support for gfni instructions
  _mm_gf2p8affineinv_epi64_epi8
  _mm_mask_gf2p8affineinv_epi64_epi8
  _mm_maskz_gf2p8affineinv_epi64_epi8
  _mm256_gf2p8affineinv_epi64_epi8
  _mm256_mask_gf2p8affineinv_epi64_epi8
  _mm256_maskz_gf2p8affineinv_epi64_epi8
  _mm512_gf2p8affineinv_epi64_epi8
  _mm512_mask_gf2p8affineinv_epi64_epi8
  _mm512_maskz_gf2p8affineinv_epi64_epi8
  _mm_gf2p8affine_epi64_epi8
  _mm_mask_gf2p8affine_epi64_epi8
  _mm_maskz_gf2p8affine_epi64_epi8
  _mm256_gf2p8affine_epi64_epi8
  _mm256_mask_gf2p8affine_epi64_epi8
  _mm256_maskz_gf2p8affine_epi64_epi8
  _mm512_gf2p8affine_epi64_epi8
  _mm512_mask_gf2p8affine_epi64_epi8
  _mm512_maskz_gf2p8affine_epi64_epi8
  _mm_gf2p8mul_epi8
  _mm_mask_gf2p8mul_epi8
  _mm_maskz_gf2p8mul_epi8
  _mm256_gf2p8mul_epi8
  _mm256_mask_gf2p8mul_epi8
  _mm256_maskz_gf2p8mul_epi8
  _mm512_gf2p8mul_epi8
  _mm512_mask_gf2p8mul_epi8
  _mm512_maskz_gf2p8mul_epi8
matching a similar work on the backend (D40373)
Differential Revision: https://reviews.llvm.org/D41582

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

6 years ago[x86][icelake][vaes]
Coby Tayree [Wed, 27 Dec 2017 08:16:54 +0000 (08:16 +0000)]
[x86][icelake][vaes]
added vaes feature recognition
added intrinsics support for vaes instructions, matching a similar work on the backend (D40078)
  _mm256_aesenc_epi128
  _mm512_aesenc_epi128
  _mm256_aesenclast_epi128
  _mm512_aesenclast_epi128
  _mm256_aesdec_epi128
  _mm512_aesdec_epi128
  _mm256_aesdeclast_epi128
  _mm512_aesdeclast_epi128

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

6 years agoFix comment typo in r321312.
Paul Robinson [Tue, 26 Dec 2017 18:01:19 +0000 (18:01 +0000)]
Fix comment typo in r321312.
Post-commit review by Kim Grasman!

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

6 years agoAdd a fixit for attributes incorrectly placed prior to 'struct/class/enum' keyword.
Faisal Vali [Mon, 25 Dec 2017 22:23:20 +0000 (22:23 +0000)]
Add a fixit for attributes incorrectly placed prior to 'struct/class/enum' keyword.

Suggest moving the following erroneous attrib list (based on location)
[[]] struct X;
to
struct [[]] X;

Additionally, added a fixme for the current implementation that diagnoses misplaced attributes to consider using the newly introduced diagnostic (that I think is more user-friendly).

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

6 years ago[AST] Inline CompoundStmt contents into the parent allocation.
Benjamin Kramer [Sun, 24 Dec 2017 16:24:20 +0000 (16:24 +0000)]
[AST] Inline CompoundStmt contents into the parent allocation.

Saves a pointer on every CompoundStmt.

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

6 years ago[AST] Convert AttributedStmt to llvm::TrailingObjects.
Benjamin Kramer [Sun, 24 Dec 2017 16:24:11 +0000 (16:24 +0000)]
[AST] Convert AttributedStmt to llvm::TrailingObjects.

No functionality change intended.

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

6 years ago[OPENMP] Fix the tests for 32bits targets, NFC.
Alexey Bataev [Sun, 24 Dec 2017 14:18:33 +0000 (14:18 +0000)]
[OPENMP] Fix the tests for 32bits targets, NFC.

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

6 years agoMake helpers static. No functionality change.
Benjamin Kramer [Sun, 24 Dec 2017 12:46:22 +0000 (12:46 +0000)]
Make helpers static. No functionality change.

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

6 years ago[Index] Reduce size of SymbolInfo struct.
Sam McCall [Sat, 23 Dec 2017 19:31:24 +0000 (19:31 +0000)]
[Index] Reduce size of SymbolInfo struct.

Summary:
This is currently 16 bytes, the patch reduces it to 4.
(Building with clang on linux x84, I guess others are similar)

The only subfield that might need a bigger type is SymbolPropertySet,
I've moved it to the end of the struct so if it grows, SymbolInfo will
only be 8 bytes.

With a full index of namespace-scope symbols from the LLVM project (200k)
loaded into clangd, this saves ~2MB of RAM.

Reviewers: akyrtzi

Subscribers: ilya-biryukov, cfe-commits

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

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

6 years ago[NFC] Remove a cast rendered unnecessary by r321409
Faisal Vali [Sat, 23 Dec 2017 19:27:07 +0000 (19:27 +0000)]
[NFC] Remove a cast rendered unnecessary by r321409

See https://reviews.llvm.org/rC321409 for additional context.

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

6 years ago[NFC] Update the template-parameter parsers and analyzers to return NamedDecl (vs...
Faisal Vali [Sat, 23 Dec 2017 18:56:34 +0000 (18:56 +0000)]
[NFC] Update the template-parameter parsers and analyzers to return NamedDecl (vs Decl)

This patch addresses a FIXME and has the template-parameter processing functions return a more derived common type NamedDecl (as opposed to a type needlessly higher up in the inheritance hierarchy : Decl).

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

6 years ago[ODRHash] Disable hashing on methods.
Richard Trieu [Sat, 23 Dec 2017 01:35:32 +0000 (01:35 +0000)]
[ODRHash] Disable hashing on methods.

Turn off hashing for class methods, but leave it on for other functions.  This
should get the buildbot to green for the time being.

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

6 years ago[ODRHash] Support ODR violation detection in functions.
Richard Trieu [Sat, 23 Dec 2017 00:41:01 +0000 (00:41 +0000)]
[ODRHash] Support ODR violation detection in functions.

Extend the hashing to functions, which allows detection of function definition
mismatches across modules.  This is a re-commit of r320230.

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

6 years agoAdd an explicit `LLVM_FALLTHROUGH` annotation to an intentional
Chandler Carruth [Fri, 22 Dec 2017 23:29:49 +0000 (23:29 +0000)]
Add an explicit `LLVM_FALLTHROUGH` annotation to an intentional
fallthrough. Fixes GCC and Clang warnings about this.

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

6 years ago[OPENMP] Captured arguments of the capturable clauses by value.
Alexey Bataev [Fri, 22 Dec 2017 21:01:52 +0000 (21:01 +0000)]
[OPENMP] Captured arguments of the capturable clauses by value.

If the clause is applied to the combined construct and has captured
expression, try to capture this expression by value rather than by
reference.

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

6 years agoUnit tests for TBAA metadata generation.
Serge Pavlov [Fri, 22 Dec 2017 15:22:45 +0000 (15:22 +0000)]
Unit tests for TBAA metadata generation.

Now tests for metadata created by clang involve compiling code snippets
placed into c/c++ source files and matching interesting patterns in the
obtained textual representation of IR. Writting such tests is a painful
process as metadata often form complex tree-like structures but textual
representation of IR contains only a pile of metadata at the module end.

This change implements IR matchers that may be used to match required
patterns in the binary IR representation. In this case the metadata
structure is not broken and creation of match patterns is easier.

The change adds unit tests for TBAA metadata generation.

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

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

6 years ago[CodeGen] Represent array members in new-format TBAA type descriptors
Ivan A. Kosarev [Fri, 22 Dec 2017 09:57:24 +0000 (09:57 +0000)]
[CodeGen] Represent array members in new-format TBAA type descriptors

Now that in the new TBAA format we allow access types to be of
any object types, including aggregate ones, it becomes critical
to specify types of all sub-objects such aggregates comprise as
their members. In order to meet this requirement, this patch
enables generation of field descriptors for members of array
types.

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

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

6 years ago[CodeGen] Support generation of TBAA info in the new format
Ivan A. Kosarev [Fri, 22 Dec 2017 09:54:23 +0000 (09:54 +0000)]
[CodeGen] Support generation of TBAA info in the new format

Now that the MDBuilder helpers generating TBAA type and access
descriptors in the new format are in place, we can teach clang to
use them when requested.

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

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

6 years agoFix unused variable warning in SemaTemplate. NFC
Sam McCall [Fri, 22 Dec 2017 07:09:51 +0000 (07:09 +0000)]
Fix unused variable warning in SemaTemplate. NFC

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

6 years ago[X86] Add missing check lines for the silvermont cases in predefined-arch-macros...
Craig Topper [Fri, 22 Dec 2017 05:09:38 +0000 (05:09 +0000)]
[X86] Add missing check lines for the silvermont cases in predefined-arch-macros.c test.

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

6 years ago[Modules] Map missing private submodules from Foo.Private to Foo_Private
Bruno Cardoso Lopes [Fri, 22 Dec 2017 05:04:43 +0000 (05:04 +0000)]
[Modules] Map missing private submodules from Foo.Private to Foo_Private

In case `@import Foo.Private` fails because the submodule doesn't exist,
look for `Foo_Private` (if available) and build/load that module
instead. In that process emit a warning and tell the user about the
assumption.

The intention here is to assist all existing private modules owners
(in ObjC and Swift) to migrate to the new `Foo_Private` syntax.

rdar://problem/36023940

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

6 years ago[X86] Add 'prfchw' to the correct CPUs to match the backend.
Craig Topper [Fri, 22 Dec 2017 04:51:00 +0000 (04:51 +0000)]
[X86] Add 'prfchw' to the correct CPUs to match the backend.

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

6 years agoDiagnose the various invalid decl-specifiers on nontype template parameters.
Faisal Vali [Fri, 22 Dec 2017 03:50:55 +0000 (03:50 +0000)]
Diagnose the various invalid decl-specifiers on nontype template parameters.

The standard correctly forbids various decl-specifiers that dont make sense on non-type template parameters - such as the extern in:
    template<extern int> struct X;

This patch implements those restrictions (in a fashion similar to the corresponding checks on function parameters within ActOnParamDeclarator).

Credit goes to miyuki (Mikhail Maltsev) for drawing attention to this issue,  authoring the initial versions of this patch, and supporting the effort to re-engineer it slightly.  Thank you!

For details of how this patch evolved please see: https://reviews.llvm.org/D40705

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

6 years ago[Modules] Change private modules rules and warnings
Bruno Cardoso Lopes [Fri, 22 Dec 2017 02:53:30 +0000 (02:53 +0000)]
[Modules] Change private modules rules and warnings

We used to advertise private modules to be declared as submodules
(Foo.Private). This has proven to not scale well since private headers
might carry several dependencies, introducing unwanted content into the
main module and often causing dep cycles.

Change the canonical way to name it to Foo_Private, forcing private
modules as top level ones, and provide warnings under -Wprivate-module
to suggest fixes for other private naming. Update documentation to
reflect that.

rdar://problem/31173501

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

6 years ago[CUDA] More fixes for __shfl_* intrinsics.
Artem Belevich [Thu, 21 Dec 2017 23:52:09 +0000 (23:52 +0000)]
[CUDA] More fixes for __shfl_* intrinsics.

* __shfl_{up,down}* uses unsigned int for the third parameter.
* added [unsigned] long overloads for non-sync shuffles.

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

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

6 years ago[X86] Allow _mm_prefetch (both the header implementation and the builtin) to accept...
Craig Topper [Thu, 21 Dec 2017 23:50:22 +0000 (23:50 +0000)]
[X86] Allow _mm_prefetch (both the header implementation and the builtin) to accept bit 2 which is supposed to indicate the prefetched addresses will be written to

Add the appropriate _MM_HINT_ET0/ET1 defines to match gcc.

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

6 years agoCorrect hasFeature/isValidFeatureName's handling of shstk/adx/mwaitx
Erich Keane [Thu, 21 Dec 2017 23:27:36 +0000 (23:27 +0000)]
Correct hasFeature/isValidFeatureName's handling of shstk/adx/mwaitx

https://bugs.llvm.org/show_bug.cgi?id=35721 reports that x86intrin.h
is issuing a few warnings. This is because attribute target is using
isValidFeatureName for its source. It was also discovered that two of
these were missing from hasFeature.

Additionally, shstk is and ibu are reordered alphabetically, as came
up during code review.

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

6 years agoDelete dead code.
Adrian Prantl [Thu, 21 Dec 2017 23:03:05 +0000 (23:03 +0000)]
Delete dead code.

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

6 years ago[analyzer] Add Javascript to analyzer HTML output to allow keyboard navigation.
George Karpenkov [Thu, 21 Dec 2017 22:57:51 +0000 (22:57 +0000)]
[analyzer] Add Javascript to analyzer HTML output to allow keyboard navigation.

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

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

6 years ago[ODRHash] Canonicalize Decl's before processing.
Richard Trieu [Thu, 21 Dec 2017 22:38:29 +0000 (22:38 +0000)]
[ODRHash] Canonicalize Decl's before processing.

Canonicalizing the Decl before processing it as part of the hash should reduce
issues with non-canonical types showing up as mismatches.

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

6 years agoSuppress "redundant parens" warning for "A (::B())".
Richard Smith [Thu, 21 Dec 2017 22:26:47 +0000 (22:26 +0000)]
Suppress "redundant parens" warning for "A (::B())".

This is a slightly odd construct (it's more common to see "A (::B)()") but can
happen in friend declarations, and the parens are not redundant as they prevent
the :: binding to the left.

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

6 years ago[CMake][Fuchsia] Enable assertions
Petr Hosek [Thu, 21 Dec 2017 22:10:27 +0000 (22:10 +0000)]
[CMake][Fuchsia] Enable assertions

Enable assertions in both stages.
Release+Asserts is fast enough.
No need to let insanity through.

Patch By: mcgrathr

Reviewers: phosek

Reviewed By: phosek

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

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

6 years ago[scudo] Add -fsanitize=scudo option to Fuchsia
Petr Hosek [Thu, 21 Dec 2017 22:04:31 +0000 (22:04 +0000)]
[scudo] Add -fsanitize=scudo option to Fuchsia

Apparently the -fsanitize flag hadn't been added for Scudo upstream yet.

Patch By: flowerhack

Reviewers: cryptoad, alekseyshl, mcgrathr, phosek

Reviewed By: mcgrathr, phosek

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

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

6 years ago[AST] Incorrectly qualified unscoped enumeration as template actual parameter.
Paul Robinson [Thu, 21 Dec 2017 21:47:22 +0000 (21:47 +0000)]
[AST] Incorrectly qualified unscoped enumeration as template actual parameter.

An unscoped enumeration used as template argument, should not have any
qualified information about its enclosing scope, as its visibility is
global.

In the case of scoped enumerations, they must include information
about their enclosing scope.

Patch by Carlos Alberto Enciso!

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

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

6 years agoRe-commit r321223, which adds a printing policy to the ASTDumper.
Aaron Ballman [Thu, 21 Dec 2017 21:42:42 +0000 (21:42 +0000)]
Re-commit r321223, which adds a printing policy to the ASTDumper.

This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms.

Fixes the -Wreorder issue and fixes the ast-dump-color.cpp test.

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

6 years agoRevert "[CodeGen] Fix crash when a function taking transparent union is redeclared."
Volodymyr Sapsai [Thu, 21 Dec 2017 20:52:59 +0000 (20:52 +0000)]
Revert "[CodeGen] Fix crash when a function taking transparent union is redeclared."

This reverts commit r321296. It caused performance regressions
FAIL: imp.execution_time
FAIL: 2007-01-04-KNR-Args.execution_time
FAIL: sse_expandfft.execution_time
FAIL: sse_stepfft.execution_time

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

6 years agoDon't produce redundant parentheses warning for "A (::B);" and the like.
Richard Smith [Thu, 21 Dec 2017 20:50:39 +0000 (20:50 +0000)]
Don't produce redundant parentheses warning for "A (::B);" and the like.

The parentheses here are not redundant as they affect the binding of the
'::' token.

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

6 years ago[AArch64] Enable fp16 data type for the Builtin for AArch64 only.
Abderrazek Zaafrani [Thu, 21 Dec 2017 20:10:03 +0000 (20:10 +0000)]
[AArch64] Enable fp16 data type for the Builtin for AArch64 only.

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

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

6 years agoRevert "Fix for PR32990"
Reid Kleckner [Thu, 21 Dec 2017 19:44:23 +0000 (19:44 +0000)]
Revert "Fix for PR32990"

This reverts commit r321239. It broke the Chromium DLL build:

[8834/50217] LINK(DLL) icui18n.dll icui18n.dll.lib icui18n.dll.pdb
FAILED: icui18n.dll icui18n.dll.lib icui18n.dll.pdb
zrule.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: void __cdecl icu_60::UnicodeString::`vbase destructor'(void)"
(__imp_??_DUnicodeString@icu_60@@QEAAXXZ)

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