]> granicus.if.org Git - clang/log
clang
5 years agoFixes an assertion while instantiating a template with an incomplete typo-corrected...
Aaron Ballman [Sat, 7 Sep 2019 20:14:09 +0000 (20:14 +0000)]
Fixes an assertion while instantiating a template with an incomplete typo-corrected type.

Fixes PR35682. When a template in instantiated with an incomplete typo corrected type an assertion can trigger if the -ferror-limit is used to reduce the number of errors.

Patch by Mark de Wever.

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

5 years agoRemove stale TLI Module level pass registration
Teresa Johnson [Sat, 7 Sep 2019 03:09:46 +0000 (03:09 +0000)]
Remove stale TLI Module level pass registration

Clang patch to adapt to LLVM changes in D66428 that make the TLI
require a Function. There is no longer a module-level
TargetLibraryAnalysis, so remove its registration

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

5 years ago[clang][DependencyFileGenerator] Fix missing -MT option handling
Jan Korous [Sat, 7 Sep 2019 00:59:13 +0000 (00:59 +0000)]
[clang][DependencyFileGenerator] Fix missing -MT option handling

Targets in DependencyFileGenerator don't necessarily come from -MT option.

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

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

5 years agoFix thunks.cpp test, don't FileCheck for anon namespace id
Reid Kleckner [Sat, 7 Sep 2019 00:41:08 +0000 (00:41 +0000)]
Fix thunks.cpp test, don't FileCheck for anon namespace id

The anon namespace id is a hash of the main input path to the compiler,
which varies in the test suite because the input path is absolute.

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

5 years ago[Sema][ObjC] Mark C union fields that have non-trivial ObjC ownership
Akira Hatanaka [Sat, 7 Sep 2019 00:34:47 +0000 (00:34 +0000)]
[Sema][ObjC] Mark C union fields that have non-trivial ObjC ownership
qualifications as unavailable if the union is declared in a system
header

r365985 stopped marking those fields as unavailable, which caused the
union's NonTrivialToPrimitive* bits to be set to true. This patch
restores the behavior prior to r365985, except that users can explicitly
specify the ownership qualification of the field to instruct the
compiler not to mark it as unavailable.

rdar://problem/53420753

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

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

5 years ago[Sema] Diagnose default-initialization, destruction, and copying of
Akira Hatanaka [Sat, 7 Sep 2019 00:34:43 +0000 (00:34 +0000)]
[Sema] Diagnose default-initialization, destruction, and copying of
non-trivial C union types

This recommits r365985, which was reverted because it broke a few
projects using unions containing non-trivial ObjC pointer fields in
system headers. We now have a patch to fix the problem (see
https://reviews.llvm.org/D65256).

Original commit message:

This patch diagnoses uses of non-trivial C unions and structs/unions
containing non-trivial C unions in the following contexts, which require
default-initialization, destruction, or copying of the union objects,
instead of disallowing fields of non-trivial types in C unions, which is
what we currently do:

- function parameters.
- function returns.
- assignments.
- compound literals.
- block captures except capturing of `__block` variables by non-escaping blocks.
- local and global variable definitions.
- lvalue-to-rvalue conversions of volatile types.

See the discussion in https://reviews.llvm.org/D62988 for more background.

rdar://problem/50679094

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

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

5 years agoUse musttail for variadic method thunks when possible
Reid Kleckner [Fri, 6 Sep 2019 22:55:26 +0000 (22:55 +0000)]
Use musttail for variadic method thunks when possible

This avoids cloning variadic virtual methods when the target supports
musttail and the return type is not covariant. I think we never
implemented this previously because it doesn't handle the covariant
case. But, in the MS ABI, there are some cases where vtable thunks must
be emitted even when the variadic method defintion is not available, so
it looks like we need to implement this. Do it for both ABIs, since it's
a nice size improvement and simplification for Itanium.

Emit an error when emitting thunks for variadic methods with a covariant
return type. This case is essentially not implementable unless the ABI
provides a way to perfectly forward variadic arguments without a tail
call.

Fixes PR43173.

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

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

5 years ago[analyzer] Add minimal support for fix-it hints.
Artem Dergachev [Fri, 6 Sep 2019 20:55:29 +0000 (20:55 +0000)]
[analyzer] Add minimal support for fix-it hints.

Allow attaching fixit hints to Static Analyzer BugReports.

Fixits are attached either to the bug report itself or to its notes
(path-sensitive event notes or path-insensitive extra notes).

Add support for fixits in text output (including the default text output that
goes without notes, as long as the fixit "belongs" to the warning).

Add support for fixits in the plist output mode.

Implement a fixit for the path-insensitive DeadStores checker. Only dead
initialization warning is currently covered.

Implement a fixit for the path-sensitive VirtualCall checker when the virtual
method is not pure virtual (in this case the "fix" is to suppress the warning
by qualifying the call).

Both fixits are under an off-by-default flag for now, because they
require more careful testing.

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

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

5 years ago[analyzer] pr43179: Make CallDescription defensive against C variadic functions.
Artem Dergachev [Fri, 6 Sep 2019 20:55:24 +0000 (20:55 +0000)]
[analyzer] pr43179: Make CallDescription defensive against C variadic functions.

Most functions that our checkers react upon are not C-style variadic functions,
and therefore they have as many actual arguments as they have formal parameters.

However, it's not impossible to define a variadic function with the same name.
This will crash any checker that relies on CallDescription to check the number
of arguments but silently assumes that the number of parameters is the same.

Change CallDescription to check both the number of arguments and the number of
parameters by default.

If we're intentionally trying to match variadic functions, allow specifying
arguments and parameters separately (possibly omitting any of them).
For now we only have one CallDescription which would make use of those,
namely __builtin_va_start itself.

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

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

5 years agoUpdate comment for <template-param-decl> mangling to match extended mangling rule...
Richard Smith [Fri, 6 Sep 2019 20:32:01 +0000 (20:32 +0000)]
Update comment for <template-param-decl> mangling to match extended mangling rule in r371004.

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

5 years ago[clang][Index][NFC] Put IndexingOptions to a separate header
Jan Korous [Fri, 6 Sep 2019 20:08:32 +0000 (20:08 +0000)]
[clang][Index][NFC] Put IndexingOptions to a separate header

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

5 years ago[LifetimeAnalysis] don't use raw string literals in macros
Matthias Gehre [Fri, 6 Sep 2019 19:15:02 +0000 (19:15 +0000)]
[LifetimeAnalysis] don't use raw string literals in macros

They broke the AArch64 bots (gcc does not support it)

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

5 years ago[NFCI] Unbreak buildbots
David Bolvansky [Fri, 6 Sep 2019 16:30:44 +0000 (16:30 +0000)]
[NFCI] Unbreak buildbots

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

5 years ago[NFC] Added new tests for r371222
David Bolvansky [Fri, 6 Sep 2019 16:18:18 +0000 (16:18 +0000)]
[NFC] Added new tests for r371222

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

5 years ago[Diagnostics] Refactor code for -Wsizeof-pointer-div, catch more cases; also add...
David Bolvansky [Fri, 6 Sep 2019 16:12:48 +0000 (16:12 +0000)]
[Diagnostics] Refactor code for -Wsizeof-pointer-div, catch more cases; also add -Wsizeof-array-div

Previously, -Wsizeof-pointer-div failed to catch:
const int *r;
sizeof(r) / sizeof(int);

Now fixed.
Also introduced -Wsizeof-array-div which catches bugs like:
sizeof(r) / sizeof(short);

(Array element type does not match type of sizeof operand).

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

5 years ago[NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): pass a vector to EmitCheck()
Roman Lebedev [Fri, 6 Sep 2019 14:19:04 +0000 (14:19 +0000)]
[NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): pass a vector to EmitCheck()

Will be easier to add a new 'check' in a follow-up.

This was originally part of https://reviews.llvm.org/D67122

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

5 years ago[NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): refactor EmitGEPOffsetInBytes() helper
Roman Lebedev [Fri, 6 Sep 2019 14:18:57 +0000 (14:18 +0000)]
[NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): refactor EmitGEPOffsetInBytes() helper

It shouldn't really be inlined into the EmitCheckedInBoundsGEP().
Refactoring it beforehand will make follow-up changes more obvious.

This was originally part of https://reviews.llvm.org/D67122

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

5 years ago[NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): add some comments to pointer-overflow...
Roman Lebedev [Fri, 6 Sep 2019 14:18:49 +0000 (14:18 +0000)]
[NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): add some comments to pointer-overflow check

It's rather eye-twiching, some comments may help here..

This was originally part of https://reviews.llvm.org/D67122

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

5 years agolibclang depends on ClangDriverOptions since r352803
Nico Weber [Fri, 6 Sep 2019 13:57:12 +0000 (13:57 +0000)]
libclang depends on ClangDriverOptions since r352803

Without this, the build would sometimes fail with

    In file included from clang/tools/libclang/CIndexer.cpp:17:
    In file included from clang/include/clang/Driver/Driver.h:15:
    clang/include/clang/Driver/Options.h:44:10: fatal error:
        'clang/Driver/Options.inc' file not found
    #include "clang/Driver/Options.inc"
             ^~~~~~~~~~~~~~~~~

if Options.inc wasn't generated before libclang was built
by coincidence.

(In the GN build, this works because lib/Driver there declares
the dep on tablegen as a public_dep since the generated file
is part of Driver's public interface, and then things work out
automatically without every client of Driver having to be careful.)

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

5 years agoReland [LifetimeAnalysis] Support more STL idioms (template forward declaration and...
Matthias Gehre [Fri, 6 Sep 2019 08:56:30 +0000 (08:56 +0000)]
Reland [LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)

Reland after https://reviews.llvm.org/D66806 fixed the false-positive diagnostics.

Summary:
This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator
on the template is a DependentNameType - we can only put the gsl::Pointer attribute
on the underlaying record after instantiation)

inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared,
we added the gsl::Pointer on the canonical decl (the forward decl), and later when the
template was instantiated, there was no attribute on the definition so it was not instantiated).

and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to
a incomplete instantiation, and then another was copied from the template definition
when the instantiation was completed).

We now add the attributes to all redeclarations to fix thos issues and make their usage easier.

Reviewers: gribozavr

Subscribers: Szelethus, xazax.hun, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Prevent passing vectors of __int128 as <X x i128> in llvm IR
Craig Topper [Fri, 6 Sep 2019 06:02:13 +0000 (06:02 +0000)]
[X86] Prevent passing vectors of __int128 as <X x i128> in llvm IR

As far as I can tell, gcc passes 256/512 bit vectors __int128 in memory. And passes a vector of 1 _int128 in an xmm register. The backend considers <X x i128> as an illegal type and will scalarize any arguments with that type. So we need to coerce the argument types in the frontend to match to avoid the illegal type.

I'm restricting this to change to Linux and NetBSD based on the
how similar ABI changes have been handled in the past.
PS4, FreeBSD, and Darwin are unaffected. I've also added a
new -fclang-abi-compat version to restore the old behavior.

This issue was identified in PR42607. Though even with the types changed, we still seem to be doing some unnecessary stack realignment.

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

5 years ago[X86] Pre-commit vector of __int128 test cases for D64672.
Craig Topper [Fri, 6 Sep 2019 06:02:06 +0000 (06:02 +0000)]
[X86] Pre-commit vector of __int128 test cases for D64672.

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

5 years agoImplement Microsoft-compatible mangling for decomposition declarations.
Nico Weber [Thu, 5 Sep 2019 21:08:50 +0000 (21:08 +0000)]
Implement Microsoft-compatible mangling for decomposition declarations.

Match cl.exe's mangling for decomposition declarations.

Decomposition declarations are considered to be anonymous structs,
and use the same convention as for anonymous struct/union declarations.

Naming confirmed to match https://godbolt.org/z/K2osJa

Patch from Eric Astor <epastor@google.com>!

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

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

5 years ago[Diagnostics] Minor improvements for -Wxor-used-as-pow
David Bolvansky [Thu, 5 Sep 2019 20:50:48 +0000 (20:50 +0000)]
[Diagnostics] Minor improvements for -Wxor-used-as-pow

Extracted from D66397; implemented suggestion for 2^64; tests revisited.

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

5 years ago[clang][Index] Replace CodegenNameGenerator with ASTNameGenerator
Jan Korous [Thu, 5 Sep 2019 20:33:52 +0000 (20:33 +0000)]
[clang][Index] Replace CodegenNameGenerator with ASTNameGenerator

Follow-up to: 3ff8c3b73f6d5d15b4c1fd

Should be NFC since the original patch just moved the code.

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

5 years agoRevert: [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them...
Alexandre Ganea [Thu, 5 Sep 2019 20:12:20 +0000 (20:12 +0000)]
Revert: [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them as artificial

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

5 years ago[AST][NFC] Doc comments for ASTNameGenerator
Jan Korous [Thu, 5 Sep 2019 20:04:11 +0000 (20:04 +0000)]
[AST][NFC] Doc comments for ASTNameGenerator

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

5 years ago[DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them as artif...
Alexandre Ganea [Thu, 5 Sep 2019 15:24:49 +0000 (15:24 +0000)]
[DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them as artificial

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

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

5 years ago[ARM] Add support for the s,j,x,N,O inline asm constraints
David Candler [Thu, 5 Sep 2019 15:17:25 +0000 (15:17 +0000)]
[ARM] Add support for the s,j,x,N,O inline asm constraints

A number of inline assembly constraints are currently supported by LLVM, but rejected as invalid by Clang:

Target independent constraints:

s: An integer constant, but allowing only relocatable values

ARM specific constraints:

j: An immediate integer between 0 and 65535 (valid for MOVW)
x: A 32, 64, or 128-bit floating-point/SIMD register: s0-s15, d0-d7, or q0-q3
N: An immediate integer between 0 and 31 (Thumb1 only)
O: An immediate integer which is a multiple of 4 between -508 and 508. (Thumb1 only)

This patch adds support to Clang for the missing constraints along with some checks to ensure that the constraints are used with the correct target and Thumb mode, and that immediates are within valid ranges (at least where possible). The constraints are already implemented in LLVM, but just a couple of minor corrections to checks (V8M Baseline includes MOVW so should work with 'j', 'N' and 'O' shouldn't be valid in Thumb2) so that Clang and LLVM are in line with each other and the documentation.

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

Change-Id: I18076619e319bac35fbb60f590c069145c9d9a0a

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

5 years agoAdd -m(no)-spe to clang
Justin Hibbits [Thu, 5 Sep 2019 13:38:46 +0000 (13:38 +0000)]
Add -m(no)-spe to clang

Summary:
r337347 added support for the Signal Processing Engine (SPE) to LLVM.
This follows that up with the clang side.

This adds -mspe and -mno-spe, to match GCC.

Subscribers: nemanjai, kbarton, cfe-commits

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

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

5 years ago[OpenCL] Add image type handling for builtins
Sven van Haastregt [Thu, 5 Sep 2019 10:01:24 +0000 (10:01 +0000)]
[OpenCL] Add image type handling for builtins

Image types were previously available, but not working.  This patch
adds image type handling.

Rename the image type definitions in the .td file to make them
consistent with other type names.  Use abstract types to represent the
unqualified types.  Instantiate access-qualified image types at the
point of use using, e.g. `ImageType<Image2d, "RO">`.

Add/update TableGen definitions for the read_image/write_image
builtin functions.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

5 years ago[libclang] Refactored SharedParsedRegionsStorage
Dmitri Gribenko [Thu, 5 Sep 2019 09:48:39 +0000 (09:48 +0000)]
[libclang] Refactored SharedParsedRegionsStorage

Summary:
Removed the `PPRegionSetTy` typedef because it is only used 3 times, and
obscures code more than it helps.

Renamed SharedParsedRegionsStorage to ThreadSafeParsedRegions, because
that better reflects the reason for this type to exist.

Replaced the `copyTo()` method that had an out parameter with a getter.

Renamed the `merge()` method to `addParsedRegions()`.

Renamed `ParsedSrcLocationsTracker::ParsedRegions` to
`ParsedRegionsSnapshot`, which better reflects its role.

Subscribers: arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[Sema] Refactor LookupVisibleDecls. NFC
Ilya Biryukov [Thu, 5 Sep 2019 08:59:06 +0000 (08:59 +0000)]
[Sema] Refactor LookupVisibleDecls. NFC

Summary:
We accumulated some configuration parameters for LookupVisibleDecls that
are being passed unchanged to recursive calls, e.g. LoadExternal and
IncludeDependentBases.

At the same time, there is a bunch of parameters that can change in the
recursive invocations.

It is hard to tell the difference between those groups, making the code
hard to follow.

This change introduces a helper struct and factors out the non-changing
bits into fields, making recursive calls in the implementation code easier
to read.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: riccibruno, doug.gregor, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years agoRevert r361885 "[Driver] Fix -working-directory issues"
Hans Wennborg [Thu, 5 Sep 2019 08:43:00 +0000 (08:43 +0000)]
Revert r361885 "[Driver] Fix -working-directory issues"

This made clang unable to open files using relative paths on network shares on
Windows (PR43204). On the bug it was pointed out that createPhysicalFileSystem()
is not terribly mature, and using it is risky. Reverting for now until there's
a clear way forward.

> Currently the `-working-directory` option does not actually impact the working
> directory for all of the clang driver, it only impacts how files are looked up
> to make sure they exist.  This means that that clang passes the wrong paths
> to -fdebug-compilation-dir and -coverage-notes-file.
>
> This patch fixes that by changing all the places in the driver where we convert
> to absolute paths to use the VFS, and then calling setCurrentWorkingDirectory on
> the VFS.  This also changes the default VFS for `Driver` to use a virtualized
> working directory, instead of changing the process's working directory.
>
> Differential Revision: https://reviews.llvm.org/D62271

This also revertes the part of r369938 which checked that -working-directory works.

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

5 years agoRename of constants in ASTImporterVisibilityTest. NFC.
Balazs Keri [Thu, 5 Sep 2019 07:59:45 +0000 (07:59 +0000)]
Rename of constants in ASTImporterVisibilityTest. NFC.

Reviewers: martong, a.sidorin, shafik

Reviewed By: shafik

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

Tags: #clang

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

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

5 years agoAMDGPU: Add builtins for is_shared/is_private
Matt Arsenault [Thu, 5 Sep 2019 03:00:43 +0000 (03:00 +0000)]
AMDGPU: Add builtins for is_shared/is_private

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

5 years ago[c++20] Fix some ambiguities in our mangling of lambdas with explicit
Richard Smith [Thu, 5 Sep 2019 01:23:47 +0000 (01:23 +0000)]
[c++20] Fix some ambiguities in our mangling of lambdas with explicit
template parameters.

This finishes the implementation of the proposal described in
https://github.com/itanium-cxx-abi/cxx-abi/issues/31. (We already
implemented the <lambda-sig> extensions, but didn't take them into
account when computing mangling numbers, and didn't deal properly with
expanded parameter packs, and didn't disambiguate between different
levels of template parameters in manglings.)

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

5 years ago[analyzer] scan-build: handle --sysroot=/path in addition to --sysroot /path.
Artem Dergachev [Thu, 5 Sep 2019 00:44:56 +0000 (00:44 +0000)]
[analyzer] scan-build: handle --sysroot=/path in addition to --sysroot /path.

Current code assumes flags in CompilerLinkerOptionMap don't use =,
which isn't always true.

Patch by Chris Laplante!

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

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

5 years agoFor PR43213, track whether template parameters are implicit through
Richard Smith [Wed, 4 Sep 2019 22:14:50 +0000 (22:14 +0000)]
For PR43213, track whether template parameters are implicit through
template instantiation so we know whether to mangle them in
lambda-expressions.

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

5 years ago[www] Fix hyperlink syntax in attribute reference.
Richard Smith [Wed, 4 Sep 2019 21:31:22 +0000 (21:31 +0000)]
[www] Fix hyperlink syntax in attribute reference.

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

5 years ago[www] Update attribute reference for 'constinit'.
Richard Smith [Wed, 4 Sep 2019 21:31:21 +0000 (21:31 +0000)]
[www] Update attribute reference for 'constinit'.

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

5 years agoDiagnose _Atomic as a C11 extension.
Aaron Ballman [Wed, 4 Sep 2019 21:01:57 +0000 (21:01 +0000)]
Diagnose _Atomic as a C11 extension.

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

5 years ago[DebugInfo] Emit DW_TAG_enumeration_type for referenced global enumerator.
Yuanfang Chen [Wed, 4 Sep 2019 20:58:15 +0000 (20:58 +0000)]
[DebugInfo] Emit DW_TAG_enumeration_type for referenced global enumerator.

This essentially reverts changes from r361400 while keeping behavior for
CodeView.

Reviewers: akhuang, rnk, probinson

Reviewed by: rnk

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[c++20] P1143R2: Add support for the C++20 'constinit' keyword.
Richard Smith [Wed, 4 Sep 2019 20:30:37 +0000 (20:30 +0000)]
[c++20] P1143R2: Add support for the C++20 'constinit' keyword.

This is mostly the same as the
[[clang::require_constant_initialization]] attribute, but has a couple
of additional syntactic and semantic restrictions.

In passing, I added a warning for the attribute form being added after
we have already seen the initialization of the variable (but before we
see the definition); that case previously slipped between the cracks and
the attribute was silently ignored.

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

5 years ago[NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes
Leonard Chan [Wed, 4 Sep 2019 20:30:29 +0000 (20:30 +0000)]
[NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes

This patch merges the sancov module and funciton passes into one module pass.

The reason for this is because we ran into an out of memory error when
attempting to run asan fuzzer on some protobufs (pc.cc files). I traced the OOM
error to the destructor of SanitizerCoverage where we only call
appendTo[Compiler]Used which calls appendToUsedList. I'm not sure where precisely
in appendToUsedList causes the OOM, but I am able to confirm that it's calling
this function *repeatedly* that causes the OOM. (I hacked sancov a bit such that
I can still create and destroy a new sancov on every function run, but only call
appendToUsedList after all functions in the module have finished. This passes, but
when I make it such that appendToUsedList is called on every sancov destruction,
we hit OOM.)

I don't think the OOM is from just adding to the SmallSet and SmallVector inside
appendToUsedList since in either case for a given module, they'll have the same
max size. I suspect that when the existing llvm.compiler.used global is erased,
the memory behind it isn't freed. I could be wrong on this though.

This patch works around the OOM issue by just calling appendToUsedList at the
end of every module run instead of function run. The same amount of constants
still get added to llvm.compiler.used, abd we make the pass usage and logic
simpler by not having any inter-pass dependencies.

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

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

5 years agoGenerate parent context id from Decl* instead of DeclContext*.
Aaron Ballman [Wed, 4 Sep 2019 20:30:00 +0000 (20:30 +0000)]
Generate parent context id from Decl* instead of DeclContext*.

Because of multiple inheritance, a DeclContext pointer does not produce
the same pointer representation as a Decl pointer that references the
same AST Node.

When dumping the parentDeclContextId field of a node, convert the pointer
to Decl* first, so the id can be used to find the AST node it references.

Patch by Bert Belder.

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

5 years ago[OpenMP][Docs] Provide implementation status details
Johannes Doerfert [Wed, 4 Sep 2019 17:15:37 +0000 (17:15 +0000)]
[OpenMP][Docs] Provide implementation status details

This adds a more fine-grained list of OpenMP features with their
implementation status and associated reviews/commits.

Reviewers: kkwli0, ABataev, RaviNarayanaswamy, gtbercea, Hahnfeld

Subscribers: bollu, guansong, jfb, hfinkel, cfe-commits

Tags: #clang

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

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

5 years agoAvoid assemble step in verbose-output-quoting.c
Yuanfang Chen [Wed, 4 Sep 2019 17:10:18 +0000 (17:10 +0000)]
Avoid assemble step in verbose-output-quoting.c

Reviewers: hans

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[X86] Add support for avx512bf16 for __builtin_cpu_supports and compiler-rt's cpu...
Craig Topper [Wed, 4 Sep 2019 16:01:43 +0000 (16:01 +0000)]
[X86] Add support for avx512bf16 for __builtin_cpu_supports and compiler-rt's cpu indicator.

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

5 years ago[PowerPC][Altivec][Clang] Check compile-time constant for vec_dst*
Jinsong Ji [Wed, 4 Sep 2019 15:22:26 +0000 (15:22 +0000)]
[PowerPC][Altivec][Clang] Check compile-time constant for vec_dst*

Summary:
This is follow up of https://reviews.llvm.org/D66699.
We might get ISEL ICE if we call vec_dss with non const 3rd arg.

```
Cannot select: intrinsic %llvm.ppc.altivec.dst
```

We should check the constraints in clang and generate better error
messages.

Reviewers: nemanjai, hfinkel, echristo, #powerpc, wuzish

Reviewed By: #powerpc, wuzish

Subscribers: wuzish, kbarton, MaskRay, shchenz, cfe-commits

Tags: #clang

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

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

5 years ago[Driver] Use shared singleton instance of DriverOptTable
Ilya Biryukov [Wed, 4 Sep 2019 14:26:28 +0000 (14:26 +0000)]
[Driver] Use shared singleton instance of DriverOptTable

Summary:
This significantly reduces the time required to run clangd tests, by
~10%.

Should also have an effect on other tests that run command-line parsing
multiple times inside a single invocation.

Reviewers: gribozavr, sammccall

Reviewed By: sammccall

Subscribers: kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Added visibility context check for TypedefNameDecl.
Balazs Keri [Wed, 4 Sep 2019 14:12:18 +0000 (14:12 +0000)]
[ASTImporter] Added visibility context check for TypedefNameDecl.

Summary:
ASTImporter makes now difference between typedefs and type aliases
with same name in different translation units
if these are not visible outside.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: martong, shafik

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

Tags: #clang

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

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

5 years ago[PowerPC][Altivec] Fix constant argument for vec_dss
Jinsong Ji [Wed, 4 Sep 2019 14:01:47 +0000 (14:01 +0000)]
[PowerPC][Altivec] Fix constant argument for vec_dss

Summary:
This is similar to vec_ct* in https://reviews.llvm.org/rL304205.

The argument must be a constant, otherwise instruction selection
will fail. always_inline is not enough for isel to always fold
everything away at -O0.

The fix is to turn the function into macros in altivec.h.

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

Reviewers: nemanjai, hfinkel, #powerpc, wuzish

Reviewed By: #powerpc, wuzish

Subscribers: wuzish, kbarton, MaskRay, shchenz, cfe-commits

Tags: #clang

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

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

5 years agoRevert "[Clang Interpreter] Initial patch for the constexpr interpreter"
Roman Lebedev [Wed, 4 Sep 2019 10:57:06 +0000 (10:57 +0000)]
Revert "[Clang Interpreter] Initial patch for the constexpr interpreter"

Breaks BUILD_SHARED_LIBS build, introduces cycles in library dependency
graphs. (clangInterp depends on clangAST which depends on clangInterp)

This reverts r370839, which is an yet another recommit of D64146.

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

5 years agoRe-commit r363191 "[MS] Pretend constexpr variable template specializations are inline"
Hans Wennborg [Wed, 4 Sep 2019 08:19:30 +0000 (08:19 +0000)]
Re-commit r363191 "[MS] Pretend constexpr variable template specializations are inline"

While the next Visual Studio update (16.3) will fix this issue, that hasn't
shipped yet. Until then Clang wouldn't work with MSVC's headers which seems
unfortunate. Let's keep this in until VS 16.3 ships. (See also PR42843.)

> Fixes link errors with clang and the latest Visual C++ 14.21.27702
> headers, which was reported as PR42027.
>
> I chose to intentionally make these things linkonce_odr, i.e.
> discardable, so that we don't emit definitions of these things in every
> translation unit that includes STL headers.
>
> Note that this is *not* what MSVC does: MSVC has not yet implemented C++
> DR2387, so they emit fully specialized constexpr variable templates with
> static / internal linkage.
>
> Reviewers: rsmith
>
> Differential Revision: https://reviews.llvm.org/D63175

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Wed, 4 Sep 2019 05:49:41 +0000 (05:49 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[libclang][test][NFC] Split off fixture from tests.
Jan Korous [Tue, 3 Sep 2019 22:01:46 +0000 (22:01 +0000)]
[libclang][test][NFC] Split off fixture from tests.

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

5 years ago[AMDGPU] Set default flat work group size to (1,256) for HIP
Yaxun Liu [Tue, 3 Sep 2019 18:50:24 +0000 (18:50 +0000)]
[AMDGPU] Set default flat work group size to (1,256) for HIP

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

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

5 years agoUnbreak the build after r370798
Benjamin Kramer [Tue, 3 Sep 2019 18:24:56 +0000 (18:24 +0000)]
Unbreak the build after r370798

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

5 years agoDisable stack exhaustion test on NetBSD, where either the detection or
Richard Smith [Tue, 3 Sep 2019 18:00:44 +0000 (18:00 +0000)]
Disable stack exhaustion test on NetBSD, where either the detection or
recovery mechanism does not appear to work.

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

5 years ago[analyzer] NonNullParamChecker and CStringChecker parameter number in checker message
Kristof Umann [Tue, 3 Sep 2019 17:57:01 +0000 (17:57 +0000)]
[analyzer] NonNullParamChecker and CStringChecker parameter number in checker message

There are some functions which can't be given a null pointer as parameter either
because it has a nonnull attribute or it is declared to have undefined behavior
(e.g. strcmp()). Sometimes it is hard to determine from the checker message
which parameter is null at the invocation, so now this information is included
in the message.

This commit fixes https://bugs.llvm.org/show_bug.cgi?id=39358

Reviewed By: NoQ, Szelethus, whisperity

Patch by Tibor Brunner!

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

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

5 years ago[www] Mark items complete in Clang 9 as 'Clang 9' rather than 'SVN'.
Richard Smith [Tue, 3 Sep 2019 17:49:51 +0000 (17:49 +0000)]
[www] Mark items complete in Clang 9 as 'Clang 9' rather than 'SVN'.

Don't turn the boxes green yet, since Clang 9 hasn't been released.

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

5 years ago[CUDA] Use activemask.b32 instruction to implement __activemask w/ CUDA-9.2+
Artem Belevich [Tue, 3 Sep 2019 17:31:58 +0000 (17:31 +0000)]
[CUDA] Use activemask.b32 instruction to implement __activemask w/ CUDA-9.2+

vote.ballot instruction is gone in recent CUDA versions and
vote.sync.ballot can not be used because it needs a thread mask parameter.
Fortunately PTX 6.2 (introduced with CUDA-9.2) provides activemask.b32
instruction for this.

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

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

5 years agoclang: default to DWARF 4 for FreeBSD 12.0 and later
Ed Maste [Tue, 3 Sep 2019 16:30:21 +0000 (16:30 +0000)]
clang: default to DWARF 4 for FreeBSD 12.0 and later

Older FreeBSD versions included GDB 6.1 and had other tools that were
unable to handle debug information newer than DWARF 2.  Those tools have
since been updated.  (An old version of GDB is still kept for kernel
crash handling, but the kernel is compiled with an explicit -gdwarf2.)

Reviewed by: dim
Differential Revision: https://reviews.llvm.org/D66760

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

5 years ago[LifetimeAnalysis] Fix some false positives
Gabor Horvath [Tue, 3 Sep 2019 16:17:24 +0000 (16:17 +0000)]
[LifetimeAnalysis] Fix some false positives

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

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

5 years ago[analyzer] Add a checker option to detect nested dead stores
Kristof Umann [Tue, 3 Sep 2019 15:22:43 +0000 (15:22 +0000)]
[analyzer] Add a checker option to detect nested dead stores

Enables the users to specify an optional flag which would warn for more dead
stores.
Previously it ignored if the dead store happened e.g. in an if condition.

if ((X = generate())) { // dead store to X
}

This patch introduces the `WarnForDeadNestedAssignments` option to the checker,
which is `false` by default - so this change would not affect any previous
users.
I have updated the code, tests and the docs as well. If I missed something, tell
me.

I also ran the analysis on Clang which generated 14 more reports compared to the
unmodified version. All of them seemed reasonable for me.

Related previous patches:
rGf224820b45c6847b91071da8d7ade59f373b96f3

Reviewers: NoQ, krememek, Szelethus, baloghadamsoftware

Reviewed By: Szelethus

Patch by Balázs Benics!

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

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

5 years ago[OpenCL] Drop spurious semicolon in generated file; NFC
Sven van Haastregt [Tue, 3 Sep 2019 11:23:24 +0000 (11:23 +0000)]
[OpenCL] Drop spurious semicolon in generated file; NFC

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

5 years agoFixit for -Wfinal-dtor-non-final-class
David Bolvansky [Tue, 3 Sep 2019 10:54:25 +0000 (10:54 +0000)]
Fixit for -Wfinal-dtor-non-final-class

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

5 years agoAdded fixit notes for -Wfinal-dtor-non-final-class
David Bolvansky [Tue, 3 Sep 2019 10:32:21 +0000 (10:32 +0000)]
Added fixit notes for -Wfinal-dtor-non-final-class

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

5 years ago[ARM NEON] Avoid duplicated decarations
Diogo N. Sampaio [Tue, 3 Sep 2019 09:16:44 +0000 (09:16 +0000)]
[ARM NEON] Avoid duplicated decarations

Summary:
The declaration of arm neon intrinsics that are
"big endian safe" print the same code for big
and small endian targets.
This patch avoids duplicates by checking if an
intrinsic is safe to have a single definition.
(decreases header 11k lines out of 73k).

Reviewers: t.p.northover, ostannard, labrinea

Reviewed By: ostannard

Subscribers: kristof.beyls, cfe-commits, olista01

Tags: #clang

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

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

5 years ago[RISCV] Correct Logic around ilp32e macros
Sam Elliott [Tue, 3 Sep 2019 08:47:58 +0000 (08:47 +0000)]
[RISCV] Correct Logic around ilp32e macros

Summary:
GCC seperates the `__riscv_float_abi_*` macros and the
`__riscv_abi_rve` macro. If the chosen abi is ilp32e, `gcc -march=rv32i
-mabi=ilp32i -E -dM` shows that both `__riscv_float_abi_soft` and
`__riscv_abi_rve` are set.

This patch corrects the compiler logic around these defines.

At the moment, this patch will not change clang's behaviour, because we do not
accept the `ilp32e` abi yet.

Reviewers: luismarques, asb

Reviewed By: luismarques

Subscribers: rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, cfe-commits

Tags: #clang

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

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

5 years ago[x86] Fix bugs of some intrinsic functions in CLANG : _mm512_stream_ps, _mm512_stream...
Pengfei Wang [Tue, 3 Sep 2019 02:06:15 +0000 (02:06 +0000)]
[x86] Fix bugs of some intrinsic functions in CLANG : _mm512_stream_ps, _mm512_stream_pd, _mm512_stream_si512

Reviewers: craig.topper, pengfei, LuoYuanke, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Patch by Bing Yu (yubing)

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

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

5 years agoRename -Wc++20-designator to -Wc++2a-designator for consistency and add
Richard Smith [Mon, 2 Sep 2019 23:27:54 +0000 (23:27 +0000)]
Rename -Wc++20-designator to -Wc++2a-designator for consistency and add
some test coverage for the flag.

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

5 years agoSplit -Wreorder into different warnings for reordering a constructor
Richard Smith [Mon, 2 Sep 2019 23:17:32 +0000 (23:17 +0000)]
Split -Wreorder into different warnings for reordering a constructor
mem-initializer list and for reordering a designated initializer list.

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

5 years ago[Wdocumentation] fixes an assertion failure with typedefed function and block pointer
Dmitri Gribenko [Mon, 2 Sep 2019 18:24:33 +0000 (18:24 +0000)]
[Wdocumentation] fixes an assertion failure with typedefed function and block pointer

Summary:
The assertion happens when compiling with -Wdocumentation with variable declaration to a typedefed function pointer. I not too familiar with the ObjC syntax but first two tests assert without this patch.

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

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoThinLTO: Document the option BOOTSTRAP_LLVM_ENABLE_LTO
Sylvestre Ledru [Mon, 2 Sep 2019 15:34:53 +0000 (15:34 +0000)]
ThinLTO: Document the option BOOTSTRAP_LLVM_ENABLE_LTO

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

5 years ago[unittests][AST] CommentParser: don't name variable 'DEBUG'
Roman Lebedev [Mon, 2 Sep 2019 12:34:21 +0000 (12:34 +0000)]
[unittests][AST] CommentParser: don't name variable 'DEBUG'

It's may be an already-defined macro name,
resulting in compilation errors.

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Mon, 2 Sep 2019 11:34:47 +0000 (11:34 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370636 (git commit 8327fed9475a14c3376b4860c75370c730e08f33)

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

5 years ago[AST] AST structural equivalence to work internally with pairs.
Balazs Keri [Mon, 2 Sep 2019 11:01:09 +0000 (11:01 +0000)]
[AST] AST structural equivalence to work internally with pairs.

Summary:
The structural equivalence check stores now pairs of nodes in the
'from' and 'to' context instead of only the node in 'from' context
and a corresponding one in 'to' context. This is needed to handle
cases when a Decl in the 'from' context is to be compared with
multiple Decls in the 'to' context.

Reviewers: martong, a_sidorin

Reviewed By: martong, a_sidorin

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

Tags: #clang

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

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Mon, 2 Sep 2019 10:38:08 +0000 (10:38 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] At import of records re-order indirect fields too.
Balazs Keri [Mon, 2 Sep 2019 07:17:01 +0000 (07:17 +0000)]
[ASTImporter] At import of records re-order indirect fields too.

Summary:
Correct order of fields and indirect fields in imported RecordDecl
is needed for correct work of record layout calculations.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: martong, a_sidorin

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

Tags: #clang

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

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

5 years agoFix variable HasArrayDesignator set but not used warning. NFCI.
Simon Pilgrim [Sun, 1 Sep 2019 13:10:08 +0000 (13:10 +0000)]
Fix variable HasArrayDesignator set but not used warning. NFCI.

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

5 years ago[clang] Devirtualization for classes with destructors marked as 'final'
David Bolvansky [Sat, 31 Aug 2019 18:52:44 +0000 (18:52 +0000)]
[clang] Devirtualization for classes with destructors marked as 'final'

A class with a destructor marked final cannot be derived from, so it should afford the same devirtualization opportunities as marking the entire class final.

Patch by logan-5 (Logan Smith)
Reviewed by rsmith

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

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

5 years ago[NFC] Fix for rL370594
David Bolvansky [Sat, 31 Aug 2019 18:35:44 +0000 (18:35 +0000)]
[NFC] Fix for rL370594

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

5 years ago[clang] Warning for non-final classes with final destructors
David Bolvansky [Sat, 31 Aug 2019 18:31:19 +0000 (18:31 +0000)]
[clang] Warning for non-final classes with final destructors

Marking a class' destructor final prevents the class from being inherited from. However, it is a subtle and awkward way to express that at best, and unintended at worst. It may also generate worse code (in other compilers) than marking the class itself final. For these reasons, this revision adds a warning for nonfinal classes with final destructors, with a note to suggest marking the class final to silence the warning.

See https://reviews.llvm.org/D66621 for more background.

Patch by logan-5 (Logan Smith)

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

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Sat, 31 Aug 2019 15:15:39 +0000 (15:15 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370584 (git commit afcb3de117265a69d21e5673356e925a454d7d02)

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Sat, 31 Aug 2019 15:00:38 +0000 (15:00 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years agoIntroduce a DirectoryEntryRef that stores both a reference and an
Alex Lorenz [Sat, 31 Aug 2019 01:26:04 +0000 (01:26 +0000)]
Introduce a DirectoryEntryRef that stores both a reference and an
accessed name to the directory entry

This commit introduces a parallel API that returns a DirectoryEntryRef
to the FileManager, similar to the parallel FileEntryRef API. All
uses will have to be update in follow-up patches. The immediate use of the new API in this
patch fixes the issue where a file manager was reused in clang-scan-deps,
but reported an different file path whenever a framework lookup was done through a symlink.

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

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

5 years ago[c++20] Add support for designated direct-list-initialization syntax.
Richard Smith [Sat, 31 Aug 2019 01:00:37 +0000 (01:00 +0000)]
[c++20] Add support for designated direct-list-initialization syntax.

This completes the implementation of P0329R4.

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

5 years ago[WebAssembly] Add SIMD QFMA/QFMS
Thomas Lively [Sat, 31 Aug 2019 00:12:29 +0000 (00:12 +0000)]
[WebAssembly] Add SIMD QFMA/QFMS

Summary:
Adds clang builtins and LLVM intrinsics for these experimental
instructions. They are not implemented in engines yet, but that is ok
because the user must opt into using them by calling the builtins.

Reviewers: aheejin, dschuff

Reviewed By: aheejin

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

Tags: #clang, #llvm

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

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

5 years ago[c++20] Disallow template argument deduction from a braced-init-list
Richard Smith [Sat, 31 Aug 2019 00:05:50 +0000 (00:05 +0000)]
[c++20] Disallow template argument deduction from a braced-init-list
containing designators. The C++20 wording doesn't actually say what
happens in this case, but treating this as a non-deduced context seems
like the most natural behavior.

(We might want to consider deducing through array designators as an
extension in the future, but will need to be careful to deduce the array
bound properly if we do so. That's not permitted herein.)

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

5 years agoASTReader: Bypass overridden files when reading PCHs
Duncan P. N. Exon Smith [Fri, 30 Aug 2019 22:59:25 +0000 (22:59 +0000)]
ASTReader: Bypass overridden files when reading PCHs

If contents of a file that is part of a PCM are overridden when reading
it, but weren't overridden when the PCM was being built, the ASTReader
will emit an error.  Now it creates a separate FileEntry for recovery,
bypassing the overridden content instead of discarding it.  The
pre-existing testcase clang/test/PCH/remap-file-from-pch.cpp confirms
that the new recovery method works correctly.

This resolves a long-standing FIXME to avoid hypothetically invalidating
another precompiled module that's already using the overridden contents.

This also removes ContentCache-related API that would be unsafe to use
across `CompilerInstance`s in an implicit modules build.  This helps to
unblock us sinking it from SourceManager into FileManager in the future,
which would allow us to delete `InMemoryModuleCache`.

https://reviews.llvm.org/D66710

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

5 years ago[c++20] Implement semantic restrictions for C++20 designated
Richard Smith [Fri, 30 Aug 2019 22:52:55 +0000 (22:52 +0000)]
[c++20] Implement semantic restrictions for C++20 designated
initializers.

This has some interesting interactions with our existing extensions to
support C99 designated initializers as an extension in C++. Those are
resolved as follows:

 * We continue to permit the full breadth of C99 designated initializers
   in C++, with the exception that we disallow a partial overwrite of an
   initializer with a non-trivially-destructible type. (Full overwrite
   is OK, because we won't run the first initializer at all.)

 * The C99 extensions are disallowed in SFINAE contexts and during
   overload resolution, where they could change the meaning of valid
   programs.

 * C++20 disallows reordering of initializers. We only check for that for
   the simple cases that the C++20 rules permit (designators of the form
   '.field_name =' and continue to allow reordering in other cases).
   It would be nice to improve this behavior in future.

 * All C99 designated initializer extensions produce a warning by
   default in C++20 mode. People are going to learn the C++ rules based
   on what Clang diagnoses, so it's important we diagnose these properly
   by default.

 * In C++ <= 17, we apply the C++20 rules rather than the C99 rules, and
   so still diagnose C99 extensions as described above. We continue to
   accept designated C++20-compatible initializers in C++ <= 17 silently
   by default (but naturally still reject under -pedantic-errors).

This is not a complete implementation of P0329R4. In particular, that
paper introduces new non-C99-compatible syntax { .field { init } }, and
we do not support that yet.

This is based on a previous patch by Don Hinton, though I've made
substantial changes when addressing the above interactions.

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

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 21:32:00 +0000 (21:32 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370531 (git commit d4c1002e0bbbbab50f6891cdd2f5bd3a8f3a3584)

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 21:17:03 +0000 (21:17 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[clang-scan-deps] NFC, remove outdated implementation comment
Alex Lorenz [Fri, 30 Aug 2019 17:34:22 +0000 (17:34 +0000)]
[clang-scan-deps] NFC, remove outdated implementation comment

There's no need to purge symlinked entries in the FileManager,
as the new FileEntryRef API allows us to compute dependencies more
accurately when the FileManager is reused.

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

5 years agoFileManager: Remove ShouldCloseOpenFile argument from getBufferForFile, NFC
Duncan P. N. Exon Smith [Fri, 30 Aug 2019 16:56:26 +0000 (16:56 +0000)]
FileManager: Remove ShouldCloseOpenFile argument from getBufferForFile, NFC

Remove this dead code.  We always close it.

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 15:41:45 +0000 (15:41 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370476 (git commit a5590950549719d0d9ea69ed164b0c8c0f4e02e6)

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 15:02:09 +0000 (15:02 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Do not look up lambda classes
Gabor Marton [Fri, 30 Aug 2019 10:55:41 +0000 (10:55 +0000)]
[ASTImporter] Do not look up lambda classes

Summary:
Consider this code:
```
      void f() {
        auto L0 = [](){};
        auto L1 = [](){};
      }

```
First we import `L0` then `L1`. Currently we end up having only one
CXXRecordDecl for the two different lambdas. And that is a problem if
the body of their op() is different. This happens because when we import
`L1` then lookup finds the existing `L0` and since they are structurally
equivalent we just map the imported L0 to be the counterpart of L1.

We have the same problem in this case:
```
      template <typename F0, typename F1>
      void f(F0 L0 = [](){}, F1 L1 = [](){}) {}

```

In StructuralEquivalenceContext we could distinquish lambdas only by
their source location in these cases. But we the lambdas are actually
structrually equivalent they differn only by the source location.

Thus, the  solution is to disable lookup completely if the decl in
the "from" context is a lambda.
However, that could have other problems: what if the lambda is defined
in a header file and included in several TUs? I think we'd have as many
duplicates as many includes we have. I think we could live with that,
because the lambda classes are TU local anyway, we cannot just access
them from another TU.

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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