]> granicus.if.org Git - clang/log
clang
6 years ago[WebAssembly] Add no-prototype attribute to prototype-less C functions
Sam Clegg [Mon, 25 Jun 2018 18:47:32 +0000 (18:47 +0000)]
[WebAssembly] Add no-prototype attribute to prototype-less C functions

The WebAssembly backend in particular benefits from being
able to distinguish between varargs functions (...) and prototype-less
C functions.

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

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

6 years ago[MachineOutliner] Outline from linkonceodrs by default in LTO when -moutline is passed
Jessica Paquette [Mon, 25 Jun 2018 17:36:05 +0000 (17:36 +0000)]
[MachineOutliner] Outline from linkonceodrs by default in LTO when -moutline is passed

Pass -enable-linkonceodr-outlining by default when LTO is enabled.

The outliner shouldn't compete with any sort of linker deduplication
on linkonceodr functions when LTO is enabled. Therefore, this behaviour
should be the default.

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

6 years ago[MachineOutliner] Make last of -moutline/-mno-outline win
Jessica Paquette [Mon, 25 Jun 2018 17:27:51 +0000 (17:27 +0000)]
[MachineOutliner] Make last of -moutline/-mno-outline win

The expected behaviour of command-line flags to clang is to have
the last of -m(whatever) and -mno-(whatever) win. The outliner
didn't do that. This fixes that and updates the test.

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

6 years agoUse Triple::isMIPS() instead of enumerating all Triples. NFC
Alexander Richardson [Mon, 25 Jun 2018 16:49:52 +0000 (16:49 +0000)]
Use Triple::isMIPS() instead of enumerating all Triples. NFC

Reviewed By: atanasyan

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

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

6 years ago[clang-format] Add a default format style that can be used by users of `getStyle`
Eric Liu [Mon, 25 Jun 2018 16:29:19 +0000 (16:29 +0000)]
[clang-format] Add a default format style that can be used by users of `getStyle`

Summary:
Tools that reformat code often call `getStyle` to decide the format style
to use on a certain source file. In practice, "file" style is widely used. As a
result, many tools hardcode "file" when calling `getStyle`, which makes it hard
to control the default style in tools across a codebase when needed. This change
introduces a `DefaultFormatStyle` constant (default to "file" in upstream), which
can be modified downstream if wanted, so that all users/tools built from the same
source tree can have a consistent default format style.

This also adds an DefaultFallbackStyle that is recommended to be used by tools and can be modified downstream.

Reviewers: sammccall, djasper

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years agoRevert "[ASTImporter] Import the whole redecl chain of functions"
Gabor Marton [Mon, 25 Jun 2018 16:25:30 +0000 (16:25 +0000)]
Revert "[ASTImporter] Import the whole redecl chain of functions"

This reverts commit r335480.

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

6 years ago[OPENMP] Do not consider address constant vars as possibly
Alexey Bataev [Mon, 25 Jun 2018 15:32:05 +0000 (15:32 +0000)]
[OPENMP] Do not consider address constant vars as possibly
threadprivate.

Do not delay emission of the address constant variables in OpenMP mode
as they cannot be defined as threadprivate.

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

6 years ago[ASTImporter] Import the whole redecl chain of functions
Gabor Marton [Mon, 25 Jun 2018 14:41:58 +0000 (14:41 +0000)]
[ASTImporter] Import the whole redecl chain of functions

Summary:
With this patch when any `FunctionDecl` of a redeclaration chain is imported
then we bring in the whole declaration chain.  This involves functions and
function template specializations.  Also friend functions are affected.  The
chain is imported as it is in the "from" tu, the order of the redeclarations
are kept.  I also changed the lookup logic in order to find friends, but first
making them visible in their declaration context.  We may have long
redeclaration chains if all TU contains the same prototype, but our
measurements shows no degradation in time of CTU analysis (Tmux, Xerces,
Bitcoin, Protobuf).  Also, as further work we could squash redundant
prototypes, but first ensure that functionality is working properly; then
should we optimize.

This may seem like a huge patch, sorry about that. But, most of the changes are
new tests, changes in the production code is not that much.  I also tried to
create a smaller patch which does not affect specializations, but that patch
failed to pass some of the `clang-import-test`s because there we import
function specializations. Also very importantly, we can't just change the
import of `FunctionDecl`s without changing the import of function template
specializations because they are handled as `FunctionDecl`s.

Reviewers: a.sidorin, r.stahl, xazax.hun, balazske

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)
Hans Wennborg [Mon, 25 Jun 2018 13:23:49 +0000 (13:23 +0000)]
[clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)

With MSVC, PCH files are created along with an object file that needs to
be linked into the final library or executable. That object file
contains the code generated when building the headers. In particular, it
will include definitions of inline dllexport functions, and because they
are emitted in this object file, other files using the PCH do not need
to emit them. See the bug for an example.

This patch makes clang-cl match MSVC's behaviour in this regard, causing
significant compile-time savings when building dlls using precompiled
headers.

For example, in a 64-bit optimized shared library build of Chromium with
PCH, it reduces the binary size and compile time of
stroke_opacity_custom.obj from 9315564 bytes to 3659629 bytes and 14.6
to 6.63 s. The wall-clock time of building blink_core.dll goes from
38m41s to 22m33s. ("user" time goes from 1979m to 1142m).

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

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

6 years ago[ASTImporter] Add ms compatibility to tests which use the TestBase
Gabor Marton [Mon, 25 Jun 2018 13:04:37 +0000 (13:04 +0000)]
[ASTImporter] Add ms compatibility to tests which use the TestBase

Summary:
In order to avoid build failures on MS, we use -fms-compatibility too in
the tests which use the TestBase.  Moved the family of `testImport`
functions under a test fixture class, so we can use parameterized tests.
Refactored `testImport` and `testImportSequence`, because `for` loops over
the different compiler options is no longer needed, that is handeld by
the test framework via parameters from now on.

Reviewers: a.sidorin, r.stahl, xazax.hun

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format] Keep @message together in text protos
Krasimir Georgiev [Mon, 25 Jun 2018 12:43:12 +0000 (12:43 +0000)]
[clang-format] Keep @message together in text protos

Summary:
In C++ code snippets of the form `@field` are common. This makes clang-format
keep them together in text protos, whereas before it would break them.

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Add new tests about templated-described swing
Gabor Marton [Mon, 25 Jun 2018 11:38:43 +0000 (11:38 +0000)]
[ASTImporter] Add new tests about templated-described swing

Summary:
Add a new test about importing a partial specialization (of a class).  Also,
this patch adds new tests about the templated-described swing, some of these
fail ATM, but subsequent patches will fix them.

Reviewers: a.sidorin, r.stahl, xazax.hun

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format] Fix end-of-file comments text proto formatting
Krasimir Georgiev [Mon, 25 Jun 2018 11:08:24 +0000 (11:08 +0000)]
[clang-format] Fix end-of-file comments text proto formatting

Summary:
The case of end-of-file comments was formatted badly:
```
key: value
    # end-of-file comment
```
This patch fixes that formatting:
```
key: value
# end-of-file comment
```

Subscribers: cfe-commits

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

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

6 years ago[CodeGen] Provide source locations for UBSan type checks when emitting constructor...
Igor Kudrin [Mon, 25 Jun 2018 05:48:04 +0000 (05:48 +0000)]
[CodeGen] Provide source locations for UBSan type checks when emitting constructor calls.

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

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

6 years ago[Coroutines] Less IR for noexcept await_resume
Brian Gesiak [Sat, 23 Jun 2018 18:57:26 +0000 (18:57 +0000)]
[Coroutines] Less IR for noexcept await_resume

Summary:
In his review of https://reviews.llvm.org/D45860, @GorNishanov suggested
avoiding generating additional exception-handling IR in the case that
the resume function was marked as 'noexcept', and exceptions could not
occur. This implements that suggestion.

Test Plan: `check-clang`

Reviewers: GorNishanov, EricWF

Reviewed By: GorNishanov

Subscribers: cfe-commits, GorNishanov

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

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

6 years ago[Sema] isValidCoroutineContext FIXME and citations
Brian Gesiak [Sat, 23 Jun 2018 18:01:02 +0000 (18:01 +0000)]
[Sema] isValidCoroutineContext FIXME and citations

Summary:
Add citations to the Coroutines TS to the `isValidCoroutineContext`
function, as well as a FIXME and test for [expr.await]p2, which states
a co_await expression cannot be used in a default argument.

Test Plan: check-clang

Reviewers: GorNishanov, EricWF

Reviewed By: GorNishanov

Subscribers: rsmith, cfe-commits

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

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

6 years agoAttempt to fix latent tablegen dependency issue
Reid Kleckner [Sat, 23 Jun 2018 17:32:51 +0000 (17:32 +0000)]
Attempt to fix latent tablegen dependency issue

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

6 years ago[Fuchsia] Enable static libc++, libc++abi, libunwind
Petr Hosek [Sat, 23 Jun 2018 03:15:07 +0000 (03:15 +0000)]
[Fuchsia] Enable static libc++, libc++abi, libunwind

This is needed for building Fuchsia drivers.

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

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

6 years ago[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %zu/%zi on Darwin
JF Bastien [Fri, 22 Jun 2018 21:54:40 +0000 (21:54 +0000)]
[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %zu/%zi on Darwin

Summary:
Pick D42933 back up, and make NSInteger/NSUInteger with %zu/%zi specifiers on Darwin warn only in pedantic mode. The default -Wformat recently started warning for the following code because of the added support for analysis for the '%zi' specifier.

     NSInteger i = NSIntegerMax;
     NSLog(@"max NSInteger = %zi", i);

The problem is that on armv7 %zi is 'long', and NSInteger is typedefed to 'int' in Foundation. We should avoid this warning as it's inconvenient to our users: it's target specific (happens only on armv7 and not arm64), and breaks their existing code. We should also silence the warning for the '%zu' specifier to ensure consistency. This is acceptable because Darwin guarantees that, despite the unfortunate choice of typedef, sizeof(size_t) == sizeof(NS[U]Integer), the warning is therefore noisy for pedantic reasons. Once this is in I'll update public documentation.

Related discussion on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2018-May/058050.html

<rdar://36874921&40501559>

Reviewers: ahatanak, vsapsai, alexshap, aaron.ballman, javed.absar, jfb, rjmccall

Subscribers: kristof.beyls, aheejin, cfe-commits

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

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

6 years agoRe-land "[LTO] Enable module summary emission by default for regular LTO"
Tobias Edler von Koch [Fri, 22 Jun 2018 20:23:21 +0000 (20:23 +0000)]
Re-land "[LTO] Enable module summary emission by default for regular LTO"

Since we are now producing a summary also for regular LTO builds, we
need to run the NameAnonGlobals pass in those cases as well (the
summary cannot handle anonymous globals).

See https://reviews.llvm.org/D34156 for details on the original change.

This reverts commit 6c9ee4a4a438a8059aacc809b2dd57128fccd6b3.

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

6 years agoReinstate quotes around the path to python that I accidentaly removed in r335330
Benjamin Kramer [Fri, 22 Jun 2018 20:03:32 +0000 (20:03 +0000)]
Reinstate quotes around the path to python that I accidentaly removed in r335330

This broke users with spaces in the path, like C:\Program Files\Python

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

6 years agoRestore pre-r335182 behavior for naming inherited constructors as
Richard Smith [Fri, 22 Jun 2018 19:50:19 +0000 (19:50 +0000)]
Restore pre-r335182 behavior for naming inherited constructors as
members of dependent contexts.

This permits cases where the names before and after the '::' in a
dependent inherited constructor using-declaration do not match, but
where we can nonetheless tell when parsing the template that a
constructor is being named. Under (open) core language DR 2070, such
cases will probably be ill-formed, but r335182 does not quite give
that result and didn't intend to change this, so restore the old
behavior for now.

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

6 years agoFix BUILD_SHARED_LIBS=1 build of libclangHandleLLVM
Sam Clegg [Fri, 22 Jun 2018 19:44:48 +0000 (19:44 +0000)]
Fix BUILD_SHARED_LIBS=1 build of libclangHandleLLVM

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

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

6 years ago[OPENMP, NVPTX] Fix reduction of the big data types/structures.
Alexey Bataev [Fri, 22 Jun 2018 19:10:38 +0000 (19:10 +0000)]
[OPENMP, NVPTX] Fix reduction of the big data types/structures.

If the shuffle is required for the reduced structures/big data type,
current code may cause compiler crash because of the loading of the
aggregate values. Patch fixes this problem.

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

6 years agoRe-apply: Warning for framework headers using double quote includes
Bruno Cardoso Lopes [Fri, 22 Jun 2018 18:05:17 +0000 (18:05 +0000)]
Re-apply: Warning for framework headers using double quote includes

Introduce -Wquoted-include-in-framework-header, which should fire a warning
whenever a quote include appears in a framework header and suggest a fix-it.
For instance, for header A.h added in the tests, this is how the warning looks
like:

./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "A0.h"
         ^~~~~~
         <A/A0.h>
./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "B.h"
         ^~~~~
         <B.h>

This helps users to prevent frameworks from using local headers when in fact
they should be targetting system level ones.

The warning is off by default.

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

rdar://problem/37077034

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

6 years agoImplemented proto to LLVM conversion and LLVM fuzz target
Emmett Neyman [Fri, 22 Jun 2018 18:05:00 +0000 (18:05 +0000)]
Implemented proto to LLVM conversion and LLVM fuzz target
Differential Revision: https://reviews.llvm.org/D48106

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

6 years ago[NFC] Fix AttributeList allocated_size for ParsedType.
Erich Keane [Fri, 22 Jun 2018 17:34:44 +0000 (17:34 +0000)]
[NFC] Fix AttributeList allocated_size for ParsedType.

This if/elseif structure seems to be missing this case.
Previously, this would report a size of 1 pointer too small.
This didn't really change anything besides failing to reclaim
a very small amount of memory.

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

6 years agoAdd const qualifier on FieldChainInfoComparator::operator()
Steven Wu [Fri, 22 Jun 2018 16:51:17 +0000 (16:51 +0000)]
Add const qualifier on FieldChainInfoComparator::operator()

libcxx has user defined warning to check for non const call operator.
Silence the warning by adding the const on operator().

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

6 years ago[OpenCL] Fixed parsing of address spaces for C++.
Anastasia Stulova [Fri, 22 Jun 2018 16:20:21 +0000 (16:20 +0000)]
[OpenCL] Fixed parsing of address spaces for C++.

Added address space tokens to C++ parsing code to be able
to parse declarations that start from an address space keyword.

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

6 years ago[Sema] Updated note for address spaces to print the type.
Anastasia Stulova [Fri, 22 Jun 2018 15:45:08 +0000 (15:45 +0000)]
[Sema] Updated note for address spaces to print the type.

This allows to reuse the same diagnostic for OpenCL or CUDA.

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

6 years ago[Driver] Make scudo compatible with -fsanitize-minimal-runtime
Kostya Kortchinsky [Fri, 22 Jun 2018 14:31:30 +0000 (14:31 +0000)]
[Driver] Make scudo compatible with -fsanitize-minimal-runtime

Summary:
This is the clang side of the change, there is a compiler-rt counterpart.

Scudo works with UBSan using `-fsanitize=scudo,integer` for example, and to do
so it embeds UBSan runtime. This makes it not compatible with the UBSan minimal
runtime, but this is something we want for production purposes.

The idea is to have a Scudo minimal runtime on the compiler-rt side that will
not embed UBSan. This is basically the runtime that is currently in use for
Fuchsia, without coverage, stacktraces or symbolization. With this, Scudo
becomes compatible with `-fsanitize-minimal-runtime`.

If this approach is suitable, I'll add the tests as well, otherwise I am open
to other options.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, cfe-commits

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

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

6 years ago[X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR
Gabor Buella [Fri, 22 Jun 2018 11:59:16 +0000 (11:59 +0000)]
[X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR

Summary:
Lowering some vector comparision builtins to fcmp IR instructions.
This ignores the signaling behaviour specified in the predicate
argument of said builtins.

Affected AVX512 builtins:

__builtin_ia32_cmpps128_mask
__builtin_ia32_cmpps256_mask
__builtin_ia32_cmpps512_mask
__builtin_ia32_cmppd128_mask
__builtin_ia32_cmppd256_mask
__builtin_ia32_cmppd512_mask

Reviewers: craig.topper, uriel.k, RKSimon, andrew.w.kaylor, spatel, scanon, efriedma

Reviewed By: craig.topper, spatel, efriedma

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

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

6 years ago[clang-format] Add AlwaysBreakBeforeMultilineString tests
Jacek Olesiak [Fri, 22 Jun 2018 11:57:55 +0000 (11:57 +0000)]
[clang-format] Add AlwaysBreakBeforeMultilineString tests

Summary: Followup to D47393.

Reviewers: stephanemoore

Reviewed By: stephanemoore

Subscribers: benhamilton, cfe-commits

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

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

6 years ago[hmaptool] Turn %hmaptool into a proper substitution
Benjamin Kramer [Fri, 22 Jun 2018 09:46:40 +0000 (09:46 +0000)]
[hmaptool] Turn %hmaptool into a proper substitution

This is still super ugly, but at least it doesn't require working
directories to just line up perfectly for python to find the tool.

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

6 years ago[x86] Fix a tiny bug in my test case in r335309 by marking that we don't
Chandler Carruth [Thu, 21 Jun 2018 23:52:36 +0000 (23:52 +0000)]
[x86] Fix a tiny bug in my test case in r335309 by marking that we don't
expect any diagnostics.

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

6 years ago[x86] Teach the builtin argument range check to allow invalid ranges in
Chandler Carruth [Thu, 21 Jun 2018 23:46:09 +0000 (23:46 +0000)]
[x86] Teach the builtin argument range check to allow invalid ranges in
dead code.

This is important for C++ templates that essentially compute the valid
input in a way that is constant and will cause all the invalid cases to
be dead code that is deleted. Code in the wild actually does this and
GCC also accepts these kinds of patterns so it is important to support
it.

To make this work, we provide a non-error path to diagnose these issues,
and use a default-error warning instead. This keeps the relatively
strict handling but prevents nastiness like SFINAE on these errors. It
also allows us to safely use the system to diagnose this only when it
occurs at runtime (in emitted code).

Entertainingly, this required fixing the syntax in various other ways
for the x86 test because we never bothered to diagnose that the returns
were invalid.

Since debugging these compile failures was super confusing, I've also
improved the diagnostic to actually say what the value was. Most of the
checks I've made ignore this to simplify maintenance, but I've checked
it in a few places to make sure the diagnsotic is working.

Depends on D48462. Without that, we might actually crash some part of
the compiler after bypassing the error here.

Thanks to Richard, Ben Kramer, and especially Craig Topper for all the
help here.

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

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

6 years ago[X86] Update handling in CGBuiltin to be tolerant of out of range immediates.
Craig Topper [Thu, 21 Jun 2018 23:39:47 +0000 (23:39 +0000)]
[X86] Update handling in CGBuiltin to be tolerant of out of range immediates.

D48464 contains changes that will loosen some of the range checks in SemaChecking to a DefaultError warning that can be disabled.

This patch adds explicit masking to avoid using the upper bits of immediates to gracefully handle the warning being disabled.

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

6 years agoIgnore blacklist when generating __cfi_check_fail.
Evgeniy Stepanov [Thu, 21 Jun 2018 23:22:37 +0000 (23:22 +0000)]
Ignore blacklist when generating __cfi_check_fail.

Summary: Fixes PR37898.

Reviewers: pcc, vlad.tsyrklevich

Subscribers: cfe-commits

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

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

6 years agoTest commit, made a minor change to a comment
Emmett Neyman [Thu, 21 Jun 2018 22:08:20 +0000 (22:08 +0000)]
Test commit, made a minor change to a comment

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

6 years agoRe-apply: Add python tool to dump and construct header maps
Bruno Cardoso Lopes [Thu, 21 Jun 2018 21:45:24 +0000 (21:45 +0000)]
Re-apply: Add python tool to dump and construct header maps

Header maps are binary files used by Xcode, which are used to map
header names or paths to other locations. Clang has support for
those since its inception, but there's not a lot of header map
testing around.

Since it's a binary format, testing becomes pretty much brittle
and its hard to even know what's inside if you don't have the
appropriate tools.

Add a python based tool that allows creating and dumping header
maps based on a json description of those. While here, rewrite
tests to use the tool and remove the binary files from the tree.

This tool was initially written by Daniel Dunbar.

Thanks to Stella Stamenova for helping make this work on Windows.

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

rdar://problem/39994722

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

6 years agoRevert "[LTO] Enable module summary emission by default for regular LTO"
Tobias Edler von Koch [Thu, 21 Jun 2018 21:24:30 +0000 (21:24 +0000)]
Revert "[LTO] Enable module summary emission by default for regular LTO"

This is breaking a couple of buildbots. We need to run the
NameAnonGlobal pass for regular LTO now as well (since we're producing a
summary). I'll post a separate patch for review to make this happen and
then re-commit.

This reverts commit c0759b7b1f4a81ff9021b952aa38a222d5fa4dfd.

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

6 years agoAMDGPU: Remove amdgpu-debugger-reserve-regs feature
Konstantin Zhuravlyov [Thu, 21 Jun 2018 20:27:47 +0000 (20:27 +0000)]
AMDGPU: Remove amdgpu-debugger-reserve-regs feature

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

6 years ago[OPENMP, NVPTX] Fix globalization of the variables passed to orphaned
Alexey Bataev [Thu, 21 Jun 2018 20:26:33 +0000 (20:26 +0000)]
[OPENMP, NVPTX] Fix globalization of the variables passed to orphaned
parallel region.

If the current construct requires sharing of the local variable in the
inner parallel region, this variable must be globalized to avoid
runtime crash.

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

6 years ago[LTO] Enable module summary emission by default for regular LTO
Tobias Edler von Koch [Thu, 21 Jun 2018 20:20:41 +0000 (20:20 +0000)]
[LTO] Enable module summary emission by default for regular LTO

Summary:
With D33921, we gained the ability to have module summaries in regular
LTO modules without triggering ThinLTO compilation. Module summaries in
regular LTO allow garbage collection (dead stripping) before LTO
compilation and thus open up additional optimization opportunities.

This patch enables summary emission in regular LTO for all targets
except ld64-based ones (which use the legacy LTO API).

Reviewers: pcc, tejohnson, mehdi_amini

Subscribers: inglorion, eraman, cfe-commits

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

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

6 years ago[bindings] Fix most Python binding unittests on Windows
Jonathan Coe [Thu, 21 Jun 2018 20:07:03 +0000 (20:07 +0000)]
[bindings] Fix most Python binding unittests on Windows

Summary:
This fixes all but one of the test cases for Windows. TestCDB will
take more work to debug, as CompilationDatabase seems not to work correctly.

Reviewers: bkramer, wanders, jbcoe

Reviewed By: bkramer, jbcoe

Subscribers: cfe-commits

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

Patch written by ethanhs (Ethan)

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

6 years ago[X86] Correct the inline assembly implementations of __movsb/w/d/q and __stosw/d...
Craig Topper [Thu, 21 Jun 2018 18:56:30 +0000 (18:56 +0000)]
[X86] Correct the inline assembly implementations of __movsb/w/d/q and __stosw/d/q to mark registers/memory as modified

The inline assembly for these didn't mark that edi, esi, ecx are modified by movs/stos instruction. It also didn't mark that memory is modified.

This issue was reported to llvm-dev last year http://lists.llvm.org/pipermail/cfe-dev/2017-November/055863.html but no bug was ever filed.

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

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

6 years ago[Intrinsics] Add/move some builtin declarations in intrin.h to get ms-intrinsics...
Craig Topper [Thu, 21 Jun 2018 17:07:04 +0000 (17:07 +0000)]
[Intrinsics] Add/move some builtin declarations in intrin.h to get ms-intrinsics.c to not issue warnings

ud2 and int2c were missing declarations entirely. And the bitscans were only under x86_64, but they seem to be in BuiltinsARM.def as well and are tested by ms_intrinsics.c

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

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

6 years ago[DebugInfo] Inline for without DebugLocation
Anastasis Grammenos [Thu, 21 Jun 2018 16:53:48 +0000 (16:53 +0000)]
[DebugInfo] Inline for without DebugLocation

Summary:
This test is a strip down version of a function inside the
amalgamated sqlite source. When converted to IR clang produces
a phi instruction without debug location.

This patch fixes the above issue.

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

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

6 years ago[X86] Rewrite the add/mul/or/and reduction intrinsics to make better use of other...
Craig Topper [Thu, 21 Jun 2018 16:41:28 +0000 (16:41 +0000)]
[X86] Rewrite the add/mul/or/and reduction intrinsics to make better use of other intrinsics and remove undef shuffle indices.

Similar to what was done to max/min recently.

These already reduced the vector width to 256 and 128 bit as we go unlike the original max/min code.

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

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

6 years ago[liblang] Remove DOS line endings in libclang.exports
Rainer Orth [Thu, 21 Jun 2018 13:40:50 +0000 (13:40 +0000)]
[liblang] Remove DOS line endings in libclang.exports

Undefined                       first referenced
 symbol                             in file
clang_getCompletionFixIt           /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenLocation             /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getToken                     /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTemplateCursorKind        /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTUResourceUsageName       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkKind       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkText       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getSpellingLocation          /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionParent          /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkCompletionString /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionPriority        /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionNumFixIts       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenExtent               /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionNumAnnotations  /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenKind                 /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
make[2]: *** [tools/clang/tools/libclang/CMakeFiles/libclang.dir/build.make:651: lib/libclang.so.7] Error 1

It turns out that this is caused by https://reviews.llvm.org/D46862: it added a
couple of CRs (^M) to some lines.  Solaris ld takes them to be part of the symbol
names, which of course are missing from the input objects.  GNU ld handles this
just fine.  Fixed by removing the CRs.

Bootstrapped on i386-pc-solaris2.11.  I guess this is obvious.

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

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

6 years agoFix line endings in recently updated test file
Ivan Donchevskii [Thu, 21 Jun 2018 12:39:24 +0000 (12:39 +0000)]
Fix line endings in recently updated test file

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

6 years ago[Sema] Fix overloaded static functions for templates
Ivan Donchevskii [Thu, 21 Jun 2018 08:34:50 +0000 (08:34 +0000)]
[Sema] Fix overloaded static functions for templates

Apply almost the same fix as https://reviews.llvm.org/D36390 but for templates.

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

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

6 years ago[X86] Remove masking from the 512-bit floating point max/min builtins. Use select...
Craig Topper [Thu, 21 Jun 2018 05:01:01 +0000 (05:01 +0000)]
[X86] Remove masking from the 512-bit floating point max/min builtins. Use select in IR instead.

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

6 years agoRevert "Add python tool to dump and construct header maps"
Bruno Cardoso Lopes [Thu, 21 Jun 2018 01:23:58 +0000 (01:23 +0000)]
Revert "Add python tool to dump and construct header maps"

This reverts commit fcfa2dd517ec1a6045a81e8247e346d630a22618.

Broke bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoRevert "Warning for framework headers using double quote includes"
Bruno Cardoso Lopes [Thu, 21 Jun 2018 01:23:51 +0000 (01:23 +0000)]
Revert "Warning for framework headers using double quote includes"

This reverts commit 9b5ff2db7e31c4bb11a7d468260b068b41c7c285.

Broke bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoRevert "Fix hmaptool cmake file to work on Windows"
Bruno Cardoso Lopes [Thu, 21 Jun 2018 01:23:42 +0000 (01:23 +0000)]
Revert "Fix hmaptool cmake file to work on Windows"

This reverts commit 63711c3cd337a0d22617579a904af07481139611, due to
breaking bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoASan docs: no_sanitize("address") works on globals.
Evgeniy Stepanov [Thu, 21 Jun 2018 00:16:32 +0000 (00:16 +0000)]
ASan docs: no_sanitize("address") works on globals.

Summary: Mention that no_sanitize attribute can be used with globals.

Reviewers: alekseyshl

Subscribers: cfe-commits

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

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

6 years agoWhen a dependent alignas is applied to a non-dependent typedef,
Richard Smith [Wed, 20 Jun 2018 23:36:55 +0000 (23:36 +0000)]
When a dependent alignas is applied to a non-dependent typedef,
prioritize the error for the bad subject over the error for the
dependent / non-dependent mismatch.

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

6 years agoFix hmaptool cmake file to work on Windows
Bruno Cardoso Lopes [Wed, 20 Jun 2018 23:08:43 +0000 (23:08 +0000)]
Fix hmaptool cmake file to work on Windows

Unbreak a few windows buildbots:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoUse cast instead of dyn_cast_or_null.
Akira Hatanaka [Wed, 20 Jun 2018 22:56:59 +0000 (22:56 +0000)]
Use cast instead of dyn_cast_or_null.

This addresses John's post-commit review feedback.

https://reviews.llvm.org/rC335021#inline-2038

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

6 years agoWarning for framework headers using double quote includes
Bruno Cardoso Lopes [Wed, 20 Jun 2018 22:11:59 +0000 (22:11 +0000)]
Warning for framework headers using double quote includes

Introduce -Wquoted-include-in-framework-header, which should fire a warning
whenever a quote include appears in a framework header and suggest a fix-it.
For instance, for header A.h added in the tests, this is how the warning looks
like:

./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "A0.h"
         ^~~~~~
         <A/A0.h>
./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "B.h"
         ^~~~~
         <B.h>

This helps users to prevent frameworks from using local headers when in fact
they should be targetting system level ones.

The warning is off by default.

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

rdar://problem/37077034

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

6 years agoRelated to PR37768: improve diagnostics for class name shadowing.
Richard Smith [Wed, 20 Jun 2018 21:58:20 +0000 (21:58 +0000)]
Related to PR37768: improve diagnostics for class name shadowing.

Diagnose the name of the class being shadowed by using declarations, and
improve the diagnostics for the case where the name of the class is
shadowed by a non-static data member in a class with constructors.  In
the latter case, we now always give the "member with the same name as
its class" diagnostic regardless of the relative order of the member and
the constructor, rather than giving an inscrutible diagnostic if the
constructor appears second.

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

6 years agoAdd python tool to dump and construct header maps
Bruno Cardoso Lopes [Wed, 20 Jun 2018 21:16:37 +0000 (21:16 +0000)]
Add python tool to dump and construct header maps

Header maps are binary files used by Xcode, which are used to map
header names or paths to other locations. Clang has support for
those since its inception, but there's not a lot of header map
testing around.

Since it's a binary format, testing becomes pretty much brittle
and its hard to even know what's inside if you don't have the
appropriate tools.

Add a python based tool that allows creating and dumping header
maps based on a json description of those. While here, rewrite
tests to use the tool and remove the binary files from the tree.

This tool was initially written by Daniel Dunbar.

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

rdar://problem/39994722

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

6 years ago[MS] Make sure __GetExceptionInfo works on types with no linkage
Reid Kleckner [Wed, 20 Jun 2018 21:12:20 +0000 (21:12 +0000)]
[MS] Make sure __GetExceptionInfo works on types with no linkage

Fixes PR36327

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

6 years ago[CUDA] Removed unused __nvvm_* builtins with non-generic pointers.
Artem Belevich [Wed, 20 Jun 2018 20:34:04 +0000 (20:34 +0000)]
[CUDA] Removed unused __nvvm_* builtins with non-generic pointers.

They were hot even hooked into CGBuiltin's machinery. Even if they were,
CUDA does not support AS-specific pointers, so there would be no legal way
no way to call these builtins.

This came up in D47154.

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

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

6 years agoFixed test in prior build where FileCheck tried to match against
Leonard Chan [Wed, 20 Jun 2018 19:34:05 +0000 (19:34 +0000)]
Fixed test in prior build where FileCheck tried to match against
`common` when declaring a global variable when we primarily care about
the value assigned in the test.

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

6 years agoFixed test that failed when checking what variable a value was stored
Leonard Chan [Wed, 20 Jun 2018 18:48:05 +0000 (18:48 +0000)]
Fixed test that failed when checking what variable a value was stored
in for fixed point types.

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

6 years ago[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
Leonard Chan [Wed, 20 Jun 2018 17:19:40 +0000 (17:19 +0000)]
[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal.

Fixed point literals are declared using the suffixes

```
hr: short _Fract
uhr: unsigned short _Fract
r: _Fract
ur: unsigned _Fract
lr: long _Fract
ulr: unsigned long _Fract
hk: short _Accum
uhk: unsigned short _Accum
k: _Accum
uk: unsigned _Accum
```
Errors are also thrown for illegal literal values

```
unsigned short _Accum u_short_accum = 256.0uhk;   // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
```

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

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

6 years agoSimplify. No behavior change.
Nico Weber [Wed, 20 Jun 2018 15:57:38 +0000 (15:57 +0000)]
Simplify. No behavior change.

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

6 years ago[analyzer] Optimize constraint generation when the range is a concrete value
Mikhail R. Gadelha [Wed, 20 Jun 2018 11:42:12 +0000 (11:42 +0000)]
[analyzer] Optimize constraint generation when the range is a concrete value

Summary:
If a constraint is something like:
```
$0 = [1,1]
```
it'll now be created as:
```
assert($0 == 1)
```
instead of:
```
assert($0 >= 1 && $0 <= 1)
```

In general, ~3% speedup when solving per query in my machine. Biggest improvement was when verifying sqlite3, total time went down from 3000s to 2200s.

I couldn't create a test for this as there is no way to dump the formula yet. D48221 adds a method to dump the formula but there is no way to do it from the command line.

Also, a test that prints the formula will most likely fail in the future, as different solvers print the formula in different formats.

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[SPIR] Prevent SPIR targets from using half conversion intrinsics
Sjoerd Meijer [Wed, 20 Jun 2018 09:49:40 +0000 (09:49 +0000)]
[SPIR] Prevent SPIR targets from using half conversion intrinsics

The SPIR target currently allows for half precision floating point types to be
emitted using the LLVM intrinsic functions which convert half types to floats
and doubles. However, this is illegal in SPIR as the only intrinsic allowed by
SPIR is memcpy, as per section 3 of the SPIR specification. Currently this is
leading to an assert being hit in the Clang CodeGen when attempting to emit a
constant or literal _Float16 type in a comparison operation on a SPIR or SPIR64
target. This assert stems from the CodeGen attempting to emit a constant half
value as an integer because the backend has specified that it is using these
half conversion intrinsics (which represents half as i16). This patch prevents
SPIR targets from using these intrinsics by overloading the responsible target
info method, marks SPIR targets as having a legal half type and provides
additional regression testing for the _Float16 type on SPIR targets.

Patch by: Stephen McGroarty

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

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

6 years ago[Sema] Allow creating types with multiple of the same addrspace.
Alexey Bader [Wed, 20 Jun 2018 08:31:24 +0000 (08:31 +0000)]
[Sema] Allow creating types with multiple of the same addrspace.

Summary:
The comment with the OpenCL clause about this clearly
says: "No type shall be qualified by qualifiers for
two or more different address spaces."

This must mean that two or more qualifiers for the
_same_ address space is allowed. However, it is
likely unintended by the programmer, so emit a
warning.

For dependent address space types, reject them like
before since we cannot know what the address space
will be.

Patch by Bevin Hansson (ebevhan).

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: bader, cfe-commits

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

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

6 years agoAdd a test to verify the x86 intrinsic headers compile cleanly with no warnings or...
Douglas Yung [Wed, 20 Jun 2018 01:05:09 +0000 (01:05 +0000)]
Add a test to verify the x86 intrinsic headers compile cleanly with no warnings or errors.

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

6 years ago[X86] Undefine _mm512_mask_reduce_operator macro in avx512fintrin.h before redefining it.
Craig Topper [Wed, 20 Jun 2018 00:31:39 +0000 (00:31 +0000)]
[X86] Undefine _mm512_mask_reduce_operator macro in avx512fintrin.h before redefining it.

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

6 years agoAppend new attributes to the end of an AttributeList.
Michael Kruse [Tue, 19 Jun 2018 23:46:52 +0000 (23:46 +0000)]
Append new attributes to the end of an AttributeList.

... instead of prepending it at the beginning (the original behavior
since implemented in r122535 2010-12-23). This builds up an
AttributeList in the the order in which the attributes appear in the
source.

The reverse order caused nodes for attributes in the AST (e.g. LoopHint)
to be in the reverse, and therefore printed in the wrong order by
-ast-dump. Some TODO comments mention this. The order was explicitly
reversed for enable_if attribute overload resolution and name mangling,
which is not necessary anymore with this patch.

The change unfortunately has some secondary effects, especially for
diagnostic output. In the simplest cases, the CHECK lines or expected
diagnostic were changed to the the new output. If the kind of
error/warning changed, the attribute's order was changed instead.

It also causes some 'previous occurrence here' hints to be textually
after the main marker. This typically happens when attributes are
merged, but are incompatible. Interchanging the role of the the main
and note SourceLocation will also cause the case where two different
declaration's attributes (in contrast to multiple attributes of the
same declaration) are merged to be reversed. There is no easy fix
because sometimes previous attributes are merged into a new
declaration's attribute list, sometimes new attributes are added to a
previous declaration's attribute list. Since 'previous occurrence here'
pointing to locations after the main marker is not rare, I left the
markers as-is; it is only relevant when the attributes are declared in
the same declaration anyway, which often is on the same line.

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

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

6 years agoclang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at least...
Nico Weber [Tue, 19 Jun 2018 23:19:34 +0000 (23:19 +0000)]
clang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).

Diagnostics for narrowing conversions in initializer lists are currently
DefaultIgnored in Microsoft mode. But MSVC 2015 did add warnings about
narrowing conversions (C2397), so clang-cl can remove its special case code if
MSCompatibilityVersion is new enough.

(In MSVC, C2397 is just a warning and in clang it's default-mapped to an error,
but it can be remapped, and disabled with -Wno-c++11-narrowing, so that should
be fine.)

Fixes PR37314.
https://reviews.llvm.org/D48296

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

6 years agoRecommit r335063: [Darwin] Add a warning for missing include path for libstdc++
Alex Lorenz [Tue, 19 Jun 2018 22:47:53 +0000 (22:47 +0000)]
Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

The recommit ensures that the tests that failed on bots don't trigger the warning.

Xcode 10 removes support for libstdc++, but the users just get a confusing
include not file warning when including an STL header (when building for iOS6
which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include
path was not found to ensure that the user is more aware of why the error occurs.

rdar://40830462

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

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

6 years agoRecommit r335070 "[X86] Rewrite the max and min reduction intrinsics to make better...
Craig Topper [Tue, 19 Jun 2018 21:00:30 +0000 (21:00 +0000)]
Recommit r335070 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.""

Test has been updated to reflect the IRGen.

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

6 years agoRevert r335063 as it causes bot failures
Alex Lorenz [Tue, 19 Jun 2018 19:43:07 +0000 (19:43 +0000)]
Revert r335063 as it causes bot failures

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

6 years agoRevert r335070 "[X86] Rewrite the max and min reduction intrinsics to make better...
Craig Topper [Tue, 19 Jun 2018 19:37:07 +0000 (19:37 +0000)]
Revert r335070 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible."

The test changes are failing the buildbot and its going to take me some time to fix it.

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

6 years ago[X86] Rewrite the max and min reduction intrinsics to make better use of other functi...
Craig Topper [Tue, 19 Jun 2018 19:13:54 +0000 (19:13 +0000)]
[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.

We only need to use 512 bit vectors all the way through v8i64 reductions since those max instructions are new to avx512f and only available in 512 bits until SKX.

For v16i32 and floating point we have legacy 128/256 bit instructions we can use.

I've tried to use other intrinsics to reduce the verbosity of the code and avoid having to mention all the shuffles. I've also removed all the -1 shuffle indices so the output sequence is fully specified and not left to backend optimization.

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

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

6 years ago[Darwin] Add a warning for missing include path for libstdc++
Alex Lorenz [Tue, 19 Jun 2018 17:56:03 +0000 (17:56 +0000)]
[Darwin] Add a warning for missing include path for libstdc++

Xcode 10 removes support for libstdc++, but the users just get a confusing
include not file warning when including an STL header (when building for iOS6
which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include
path was not found to ensure that the user is more aware of why the error occurs.

rdar://40830462

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

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

6 years agoImplement semantic checking for __builtin_signbit.
Aaron Ballman [Tue, 19 Jun 2018 14:59:11 +0000 (14:59 +0000)]
Implement semantic checking for __builtin_signbit.

r242675 changed the signature for the signbit builtin but did not introduce proper semantic checking to ensure the arguments are as-expected. This patch groups the signbit builtin along with the other fp classification builtins. Fixes PR28172.

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

6 years agoReverting due to line ending changes; will reapply after addressing that.
Aaron Ballman [Tue, 19 Jun 2018 14:53:20 +0000 (14:53 +0000)]
Reverting due to line ending changes; will reapply after addressing that.

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

6 years agoImplement semantic checking for __builtin_signbit.
Aaron Ballman [Tue, 19 Jun 2018 14:36:04 +0000 (14:36 +0000)]
Implement semantic checking for __builtin_signbit.

r242675 changed the signature for the signbit builtin but did not introduce proper semantic checking to ensure the arguments are as-expected. This patch groups the signbit builtin along with the other fp classification builtins. Fixes PR28172.

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

6 years ago[analyzer] Made a buildbot happy.
Kristof Umann [Tue, 19 Jun 2018 08:35:02 +0000 (08:35 +0000)]
[analyzer] Made a buildbot happy.

Since `isPrimitiveType` was only used in an assert, a builbot with `-Werror`
and no asserts enabled failed to build it as it was unused.

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

6 years agoRevert r335019 "Update NRVO logic to support early return (Attempt 2)"
Taiju Tsuiki [Tue, 19 Jun 2018 05:35:30 +0000 (05:35 +0000)]
Revert r335019 "Update NRVO logic to support early return (Attempt 2)"

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

6 years ago[Sema] Produce diagnostics for attribute 'trivial_abi' that appears
Akira Hatanaka [Tue, 19 Jun 2018 05:04:44 +0000 (05:04 +0000)]
[Sema] Produce diagnostics for attribute 'trivial_abi' that appears
after the closing brace of a class declaration.

Merge the two call sites of checkIllFormedTrivialABIStruct and sink it
into CheckCompletedCXXClass so that it is called after the attribute has
been attached to the CXXRecordDecl.

rdar://problem/40873297

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

6 years agoUpdate NRVO logic to support early return (Attempt 2)
Taiju Tsuiki [Tue, 19 Jun 2018 04:39:07 +0000 (04:39 +0000)]
Update NRVO logic to support early return (Attempt 2)

Summary:
This is the second attempt of r333500 (Update NRVO logic to support early return).
The previous one was reverted for a miscompilation for an incorrect NRVO set up on templates such as:
```
struct Foo {};

template <typename T>
T bar() {
  T t;
  if (false)
    return T();
  return t;
}
```

Where, `t` is marked as non-NRVO variable before its instantiation. However, while its instantiation, it's left an NRVO candidate, turned into an NRVO variable later.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years agoIRgen: Mark aliases of ctors and dtors as unnamed_addr.
Peter Collingbourne [Mon, 18 Jun 2018 20:58:54 +0000 (20:58 +0000)]
IRgen: Mark aliases of ctors and dtors as unnamed_addr.

This is not only semantically correct but ensures that they will not
be marked as address-significant once D48155 lands.

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

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

6 years agoDon't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time...
Nico Weber [Mon, 18 Jun 2018 18:50:35 +0000 (18:50 +0000)]
Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.

The test makes %t.fake a symlink to %t.real by running `ln -sf %t.real
%t.fake`. If %t.fake already is a symlink to %t.real when this runs (e.g. if
the test has run before), then this effectively becomes `ln -sf %t.real %t.real`,
symlinking the directory to itself. At least on my mac, this leads to the
directory containing itself.

As fix, just remove %t.fake before creating the symlink. To clean up build dirs
on bots, also remove %t.real for a while.

https://reviews.llvm.org/D48224

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

6 years ago[analyzer] Remove accidentally committed lines.
George Karpenkov [Mon, 18 Jun 2018 17:59:03 +0000 (17:59 +0000)]
[analyzer] Remove accidentally committed lines.

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

6 years agoFix a bug introduced by rL334850
Tomasz Krupa [Mon, 18 Jun 2018 17:57:05 +0000 (17:57 +0000)]
Fix a bug introduced by rL334850

Summary: All *_sqrt_round_s[s|d] intrinsics should execute a square root on
zeroth element from B (Ops[1]) and insert in to A (Ops[0]), not the other way around.

Reviewers: itaraban, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

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

6 years ago[OPENMP, NVPTX] Emit simple reduction if requested.
Alexey Bataev [Mon, 18 Jun 2018 17:11:45 +0000 (17:11 +0000)]
[OPENMP, NVPTX] Emit simple reduction if requested.

If simple reduction is requested, use the simple reduction instead of
the runtime functions calls.

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

6 years agoUpdate copyright year to 2018.
Paul Robinson [Mon, 18 Jun 2018 12:22:17 +0000 (12:22 +0000)]
Update copyright year to 2018.

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

6 years ago[analyzer] Checker for uninitialized C++ objects
Kristof Umann [Mon, 18 Jun 2018 11:50:17 +0000 (11:50 +0000)]
[analyzer] Checker for uninitialized C++ objects

This checker analyzes C++ constructor calls, and reports uninitialized fields.

Due to the nature of this problem (uninitialized fields after an object
construction), this checker doesn't search for bugs, but rather is a tool to
enforce a specific programming model where every field needs to be initialized.

This checker lands in alpha for now, and a number of followup patches will be
made to reduce false negatives and to make it easier for the user to understand
what rules the checker relies on, eg. whether a derived class' constructor is
responsible for initializing inherited data members or whether it should be
handled in the base class' constructor.

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

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

6 years ago[ASTMatchers] Add support for matching the type of a friend decl.
David L. Jones [Mon, 18 Jun 2018 09:23:08 +0000 (09:23 +0000)]
[ASTMatchers] Add support for matching the type of a friend decl.

This allows matchers like:

  friendDecl(hasType(cxxRecordDecl(...)))
  friendDecl(hasType(asString(...)))

It seems that hasType is probably the most reasonable narrowing matcher to
overload, since it is already used to narrow to other declaration kinds.

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

Reviewers: klimek, aaron.ballman

Subscribers: cfe-commits

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

6 years ago[ASTMatchers] Don't assert-fail in specifiesTypeLoc().
David L. Jones [Mon, 18 Jun 2018 08:59:16 +0000 (08:59 +0000)]
[ASTMatchers] Don't assert-fail in specifiesTypeLoc().

The specifiesTypeLoc() matcher narrows a nestedNameSpecifier matcher based on a
typeloc within the NNS. However, the matcher does not guard against NNS which
are a namespace, and cause getTypeLoc to assert-fail.

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

6 years ago[analyzer] Add method to the generic SMT API to dump the SMT formula
Mikhail R. Gadelha [Sat, 16 Jun 2018 14:36:17 +0000 (14:36 +0000)]
[analyzer] Add method to the generic SMT API to dump the SMT formula

Summary:
New method dump the SMT formula and the Z3 implementation.

There is no test because I only used it for debugging.

However, if requested, I can add an option to the static analyzer to dump the formula (whole program? per path?), maybe something like the trimmed graph but for SMT formulas.

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years agoAdd RUN line for amdgcn to lit test conditional-temporaries.cpp
Yaxun Liu [Sat, 16 Jun 2018 12:28:51 +0000 (12:28 +0000)]
Add RUN line for amdgcn to lit test conditional-temporaries.cpp

This is partial re-commit of r332982.

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