]> granicus.if.org Git - clang/log
clang
6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 22 Feb 2018 22:35:17 +0000 (22:35 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[OpenMP] Limit reduction support for pragma 'distribute' when combined with pragma...
Carlo Bertolli [Thu, 22 Feb 2018 19:38:14 +0000 (19:38 +0000)]
[OpenMP] Limit reduction support for pragma 'distribute' when combined with pragma 'simd'

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

This is a bug fix that removes the emission of reduction support for pragma 'distribute' when found alone or in combinations without simd.
Pragma 'distribute' does not have a reduction clause, but when combined with pragma 'simd' we need to emit the support for simd's reduction clause as part of code generation for distribute. This guard is similar to the one used for reduction support earlier in the same code gen function.

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

6 years ago[CUDA] Added missing functions.
Artem Belevich [Thu, 22 Feb 2018 18:40:52 +0000 (18:40 +0000)]
[CUDA] Added missing functions.

Initial commit missed sincos(float), llabs() and few atomics that we
used to pull in from device_functions.hpp, which we no longer include.

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

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

6 years ago[OPENMP] Require valid SourceLocation in function call, NFC.
Alexey Bataev [Thu, 22 Feb 2018 18:33:31 +0000 (18:33 +0000)]
[OPENMP] Require valid SourceLocation in function call, NFC.

Removed default empty SourceLocation argument from `emitCall` function
and require valid location.

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

6 years ago[docs] Regenerate command line reference
Jonas Hahnfeld [Thu, 22 Feb 2018 17:10:28 +0000 (17:10 +0000)]
[docs] Regenerate command line reference

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

6 years ago[docs] Improve help for OpenMP options, NFC.
Jonas Hahnfeld [Thu, 22 Feb 2018 17:06:35 +0000 (17:06 +0000)]
[docs] Improve help for OpenMP options, NFC.

 * Add HelpText for -fopenmp so that it appears in clang --help.
 * Hide -fno-openmp-simd, only list the positive option.
 * Hide -fopenmp-relocatable-target and -fopenmp-use-tls from
   clang --help and from ClangCommandLineReference.
 * Improve MetaVarName for -Xopenmp-target=<...>.

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

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

6 years ago[docs] Fix duplicate arguments for JoinedAndSeparate
Jonas Hahnfeld [Thu, 22 Feb 2018 17:06:27 +0000 (17:06 +0000)]
[docs] Fix duplicate arguments for JoinedAndSeparate

We can't see how many arguments are in the meta var name, so just
assume that it is the right number.

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

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

6 years ago[OpenCL] Add '-cl-uniform-work-group-size' compile option
Alexey Sotkin [Thu, 22 Feb 2018 11:54:14 +0000 (11:54 +0000)]
[OpenCL] Add '-cl-uniform-work-group-size' compile option

Summary:
OpenCL 2.0 specification defines '-cl-uniform-work-group-size' option,
which requires that the global work-size be a multiple of the work-group
size specified to clEnqueueNDRangeKernel and allows optimizations that
are made possible by this restriction.

The patch introduces the support of this option.

To keep information about whether an OpenCL kernel has uniform work
group size or not, clang generates 'uniform-work-group-size' function
attribute for every kernel:
- "uniform-work-group-size"="true" for OpenCL 1.2 and lower,
- "uniform-work-group-size"="true" for OpenCL 2.0 and higher if
 '-cl-uniform-work-group-size' option was specified,
- "uniform-work-group-size"="false" for OpenCL 2.0 and higher if no
 '-cl-uniform-work-group-size' options was specified.

If the function is not an OpenCL kernel, 'uniform-work-group-size'
attribute isn't generated.

Patch by: krisb

Reviewers: yaxunl, Anastasia, b-sumner

Reviewed By: yaxunl, Anastasia

Subscribers: nhaehnle, yaxunl, Anastasia, cfe-commits

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

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

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Thu, 22 Feb 2018 07:49:13 +0000 (07:49 +0000)]
[NFC] fix trivial typos in comments

"a a"->"a"

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

6 years agoRevert part of D43378 in this file
Kamil Rytarowski [Thu, 22 Feb 2018 07:00:29 +0000 (07:00 +0000)]
Revert part of D43378 in this file

It causes failure on clang-x86_64-debian-fast.

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

6 years agoRevert part of r. 325746 D43378
Kamil Rytarowski [Thu, 22 Feb 2018 06:48:34 +0000 (06:48 +0000)]
Revert part of r. 325746 D43378

test/Driver/XRay/xray-shared-noxray.cpp fails on !Linux hosts.

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

6 years agoFreeBSD driver / Xray flags moving pthread to compile flags.
Kamil Rytarowski [Thu, 22 Feb 2018 06:31:40 +0000 (06:31 +0000)]
FreeBSD driver / Xray flags moving pthread to compile flags.

Summary:
- Using -lpthread instead, with -pthread the linkage does not work.
-Warning about the -fxray-instrument usage outside of the working cases.

Patch by: David CARLIER

Reviewers: krytarowski, vitalybuka, dberris, emaste

Reviewed By: krytarowski, emaste

Subscribers: srhines, emaste, cfe-commits

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

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

6 years ago[ODRHash] Fix hashing for friend functions.
Richard Trieu [Thu, 22 Feb 2018 05:50:29 +0000 (05:50 +0000)]
[ODRHash] Fix hashing for friend functions.

When hashing a templated function, use the hash of the function it was
instantiated from.

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

6 years ago[ODRHash] Handle some template weirdness.
Richard Trieu [Thu, 22 Feb 2018 05:32:25 +0000 (05:32 +0000)]
[ODRHash] Handle some template weirdness.

Build the index off of DeclarationName instead of Decl pointers.  When finding
an UnresolvedLookupExprClass, hash it as if it were a DeclRefExpr.  This will
allow methods to be hashed.

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

6 years ago[Driver] Generate .eh_frame_hdr for static executables too.
Dan Albert [Wed, 21 Feb 2018 22:36:51 +0000 (22:36 +0000)]
[Driver] Generate .eh_frame_hdr for static executables too.

Summary: libgcc won't unwind without an .eh_frame_hdr section.

Reviewers: srhines, chandlerc

Reviewed By: chandlerc

Subscribers: chandlerc, cfe-commits

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

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

6 years agoCodeGen: handle blocks correctly when inalloca'ed
Saleem Abdulrasool [Wed, 21 Feb 2018 21:47:51 +0000 (21:47 +0000)]
CodeGen: handle blocks correctly when inalloca'ed

When using blocks with C++ on Windows x86, it is possible to have the
block literal be pushed into the inalloca'ed parameters.  Teach IRGen to
handle the case properly by extracting the block literal from the
inalloca parameter.  This fixes the use of blocks with C++ on Windows
x86.

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

6 years ago[clang-format] Fix regression when getStyle() called with empty filename
Ben Hamilton [Wed, 21 Feb 2018 21:27:27 +0000 (21:27 +0000)]
[clang-format] Fix regression when getStyle() called with empty filename

Summary:
D43522 caused an assertion failure when getStyle() was called with
an empty filename:

P8065

This adds a test to reproduce the failure and fixes the issue by
ensuring we never pass an empty filename to
Environment::CreateVirtualEnvironment().

Test Plan: New test added. Ran test with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
  Before diff, test failed with P8065. Now, test passes.

Reviewers: vsapsai, jolesiak, krasimir

Reviewed By: vsapsai

Subscribers: klimek, cfe-commits

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

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

6 years agoReplace incorrect usage of isInvalidDecl with intended setInvalidDecl
Erich Keane [Wed, 21 Feb 2018 20:29:05 +0000 (20:29 +0000)]
Replace incorrect usage of isInvalidDecl with intended setInvalidDecl

This typo would cause an attempt to multiversion 'main' to issue an
error, but not mark the function as invalid.  This patch fixes it.

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

6 years ago[analyzer] Prevent AnalyzerStatsChecker from crash
Peter Szecsi [Wed, 21 Feb 2018 16:06:56 +0000 (16:06 +0000)]
[analyzer] Prevent AnalyzerStatsChecker from crash

The checker marks the locations where the analyzer creates sinks. However, it
can happen that the sink was created because of a loop which does not contain
condition statement, only breaks in the body. The exhausted block is the block
which should contain the condition but empty, in this case.
This change only emits this marking in order to avoid the undefined behavior.

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

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

6 years agoRemove use of the 'gmlt' term from the -fsplit-dwarf-inlining flag description to...
David Blaikie [Wed, 21 Feb 2018 16:00:50 +0000 (16:00 +0000)]
Remove use of the 'gmlt' term from the -fsplit-dwarf-inlining flag description to make it more readily legible

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

6 years ago[clang-format] New API guessLanguage()
Ben Hamilton [Wed, 21 Feb 2018 15:54:31 +0000 (15:54 +0000)]
[clang-format] New API guessLanguage()

Summary:
For clients which don't have a filesystem, calling getStyle() doesn't
make much sense (there's no .clang-format files to search for).

In this diff, I hoist out the language-guessing logic from getStyle()
and move it into a new API guessLanguage().

I also added support for guessing the language of files which have no
extension (they could be C++ or ObjC).

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, krasimir

Reviewed By: jolesiak, krasimir

Subscribers: klimek, cfe-commits, sammccall

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

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

6 years ago[ASTMatchers] Regenerate documentation after r325678
Eric Liu [Wed, 21 Feb 2018 14:22:42 +0000 (14:22 +0000)]
[ASTMatchers] Regenerate documentation after r325678

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

6 years ago[ASTMatchers] isTemplateInstantiation: also match explicit instantiation declaration.
Eric Liu [Wed, 21 Feb 2018 13:51:27 +0000 (13:51 +0000)]
[ASTMatchers] isTemplateInstantiation: also match explicit instantiation declaration.

Summary:
Example:
template <typename T> class X {}; class A {};
// Explicit instantiation declaration.
extern template class X<A>;

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

6 years ago[Sema] Classify conversions from enum to float as narrowing
Mikhail Maltsev [Wed, 21 Feb 2018 10:08:18 +0000 (10:08 +0000)]
[Sema] Classify conversions from enum to float as narrowing

Summary:
According to [dcl.init.list]p7:
  A narrowing conversion is an implicit conversion
  - ...
  - from an integer type or unscoped enumeration type to a
    floating-point type, except where the source is a constant
    expression and the actual value after conversion will fit into
    the target type and will produce the original value when
    converted back to the original type, or
  - ...

Currently clang does not handle the 'unscoped enumeration' case. This
patch fixes the corresponding check.

Reviewers: faisalv, rsmith, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, cfe-commits

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

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

6 years ago[Fuchsia] Include libClang and clang-include-fixer in the toolchain
Petr Hosek [Wed, 21 Feb 2018 04:39:15 +0000 (04:39 +0000)]
[Fuchsia] Include libClang and clang-include-fixer in the toolchain

libClang is used by other Clang based tools such as cquery while
clang-include-fixer is generally a useful tool.

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

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

6 years agoIn C++14 onwards, it is permitted to read mutable members in constant
Richard Smith [Wed, 21 Feb 2018 03:38:30 +0000 (03:38 +0000)]
In C++14 onwards, it is permitted to read mutable members in constant
expressions, if their lifetime began during the evaluation of the expression.

This is technically not allowed in C++11, though we could consider permitting
it there too, as an extension.

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

6 years agoClean up use of C allocation functions
Serge Pavlov [Wed, 21 Feb 2018 02:02:39 +0000 (02:02 +0000)]
Clean up use of C allocation functions

If the value returned by `malloc`, `calloc` or `realloc` is not checked
for null pointer, this change replaces them for `safe_malloc`,
`safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`.
These function report fatal error on out of memory.

In the plain C files, assertion statements are added to ensure that memory
is successfully allocated.

The aim of this change is to get better diagnostics of OOM on Windows.

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

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

6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 21 Feb 2018 01:45:26 +0000 (01:45 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[X86] Disable CLWB in Cannon Lake
Craig Topper [Wed, 21 Feb 2018 00:16:50 +0000 (00:16 +0000)]
[X86] Disable CLWB in Cannon Lake

Cannon Lake does not support CLWB, therefore it
does not include all features listed under SKX.

Patch by Gabor Buella

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

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

6 years ago[mips] Spectre variant two mitigation for MIPSR2
Simon Dardis [Wed, 21 Feb 2018 00:05:05 +0000 (00:05 +0000)]
[mips] Spectre variant two mitigation for MIPSR2

This patch provides mitigation for CVE-2017-5715, Spectre variant two,
which affects the P5600 and P6600. It provides the option
-mindirect-jump=hazard, which instructs the LLVM backend to replace
indirect branches with their hazard barrier variants.

This option is accepted when targeting MIPS revision two or later.

The migitation strategy suggested by MIPS for these processors is to
use two hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are used with the option -mindirect-jump=hazard
when branching indirectly and for indirect function calls.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

Implementation note: I've opted to provide this as an
-mindirect-jump={hazard,...} style option in case alternative
mitigation methods are required for other implementations of the MIPS
ISA in future, e.g. retpoline style solutions.

Reviewers: atanasyan

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

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

6 years agoFix assert when template argument deduction's original call arg checking triggers...
Richard Smith [Tue, 20 Feb 2018 23:47:12 +0000 (23:47 +0000)]
Fix assert when template argument deduction's original call arg checking triggers class template instantiation.

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

6 years agoWhen multiple sanitizers are enabled (ubsan + something else), use all relevant black...
Richard Smith [Tue, 20 Feb 2018 23:17:41 +0000 (23:17 +0000)]
When multiple sanitizers are enabled (ubsan + something else), use all relevant blacklists.

Ideally, we'd only use the ubsan blacklist for ubsan sanitizers, and only use
the other-sanitizer blacklist for its sanitizers, but this at least enables the
intended suppressions.

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

6 years ago[NFC] In Multiversion Check function, switch to return Diag
Erich Keane [Tue, 20 Feb 2018 22:25:28 +0000 (22:25 +0000)]
[NFC] In Multiversion Check function, switch to return Diag

This function did a lot of 'Diag, return true' stuff.  This resulted in needing
to introduce scopes in quite a few places.  This patch replaces useages of a
single "S.Diag" followed by return true with simply "return S.Diag".

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

6 years ago[CUDA] Added missing __threadfence_system() function for CUDA9.
Artem Belevich [Tue, 20 Feb 2018 21:25:30 +0000 (21:25 +0000)]
[CUDA] Added missing __threadfence_system() function for CUDA9.

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

6 years agoCorrect multiversion unsupported target behavior, add a test.
Erich Keane [Tue, 20 Feb 2018 18:44:50 +0000 (18:44 +0000)]
Correct multiversion unsupported target behavior, add a test.

Multiversioning SEMA failed to set the declaration as invalid on unsupported
targets.  This patch does that.

Additionally, I noticed that there is no test to validate this error message.
This patch adds one, and uses 'mips' as the test architecture.

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

6 years agoPR36442: Correct description of -fsplit-dwarf-inlining
David Blaikie [Tue, 20 Feb 2018 16:35:08 +0000 (16:35 +0000)]
PR36442: Correct description of -fsplit-dwarf-inlining

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

6 years agoStop linking sanitized applications with -lutil and -lkvm on NetBSD
Kamil Rytarowski [Tue, 20 Feb 2018 16:27:28 +0000 (16:27 +0000)]
Stop linking sanitized applications with -lutil and -lkvm on NetBSD

The proper approach is to rebuild libutil and libkvm with a desired sanitizer.
An alternative approach to reimplement these functions (and other ones like
curses(3), editline(3) etc) does not scale and enforces linkage every single
binary with these libraries.

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

6 years agoRevert r325375 "[MS] Make constexpr static data members implicitly inline"
Hans Wennborg [Tue, 20 Feb 2018 12:43:02 +0000 (12:43 +0000)]
Revert r325375 "[MS] Make constexpr static data members implicitly inline"

This broke Clang bootstrap on Windows, PR36453.

> This handles them exactly the same way that we handle const integral
> static data members with inline definitions, which is what MSVC does.
>
> As a follow-up, now that we have a way to mark variables inline in the
> AST, we should consider marking them implicitly inline there instead of
> only treating them as inline in CodeGen. Unfortunately, this breaks a
> lot of dllimport test cases, so that is future work for now.
>
> Fixes PR36125.

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

6 years ago[CodeGen] Fix generation of TBAA tags for may-alias accesses
Ivan A. Kosarev [Tue, 20 Feb 2018 12:33:04 +0000 (12:33 +0000)]
[CodeGen] Fix generation of TBAA tags for may-alias accesses

This patch fixes creating TBAA access descriptors for
may_alias-marked access types. Currently, for such types we
generate ordinary descriptors with char as its access type. The
patch changes this to produce proper may-alias descriptors.

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

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

6 years agoclang-cl: Make /d1PP an alias for -dD (PR36446)
Hans Wennborg [Tue, 20 Feb 2018 10:47:14 +0000 (10:47 +0000)]
clang-cl: Make /d1PP an alias for -dD (PR36446)

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

6 years agoclang-format plugin: Add missing semicolon in list of file extensions (PR36383)
Hans Wennborg [Tue, 20 Feb 2018 09:26:38 +0000 (09:26 +0000)]
clang-format plugin: Add missing semicolon in list of file extensions (PR36383)

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

6 years ago[X86] Remove mask from 512 bit pmulhrsw/pmulhw/pmulhuw builtins.
Craig Topper [Tue, 20 Feb 2018 07:28:18 +0000 (07:28 +0000)]
[X86] Remove mask from 512 bit pmulhrsw/pmulhw/pmulhuw builtins.

We now use a vselect node in IR around an unmasked builtin. This makes it consistent with the 128 and 256 bit versions.

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

6 years ago[Sema] Fix -Wunused-variable
Sam McCall [Tue, 20 Feb 2018 07:21:56 +0000 (07:21 +0000)]
[Sema] Fix -Wunused-variable

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

6 years agoFix some -Wexceptions false positives.
Richard Smith [Tue, 20 Feb 2018 02:32:30 +0000 (02:32 +0000)]
Fix some -Wexceptions false positives.

Reimplement the "noexcept function actually throws" warning to properly handle
nested try-blocks. In passing, change 'throw;' handling to treat any enclosing
try block as being sufficient to suppress the warning rather than requiring a
'catch (...)'; the warning is intended to be conservatively-correct.

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

6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 20 Feb 2018 02:16:28 +0000 (02:16 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoFix test failure on target where size_t is long long.
Richard Smith [Mon, 19 Feb 2018 22:50:50 +0000 (22:50 +0000)]
Fix test failure on target where size_t is long long.

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

6 years agoAdd several more attributes to be parsed in C with [[]] when -fdouble-square-bracket...
Aaron Ballman [Mon, 19 Feb 2018 17:32:07 +0000 (17:32 +0000)]
Add several more attributes to be parsed in C with [[]] when -fdouble-square-bracket-attributes is specified.

Also flags a few attributes that should not be available with the C spelling as they only matter in C++.

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

6 years ago[clang-format] Fix text proto extension scope opening detection
Krasimir Georgiev [Mon, 19 Feb 2018 16:00:21 +0000 (16:00 +0000)]
[clang-format] Fix text proto extension scope opening detection

Summary:
This fixes the detection of scope openers in text proto extensions; previously
they were not detected correctly leading to instances like:
```
msg {
  [aa.bb
] {
key: value
}
}
```

Subscribers: klimek, cfe-commits

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

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

6 years ago[clang-format] Fixup a case of text proto message attributes
Krasimir Georgiev [Mon, 19 Feb 2018 15:31:25 +0000 (15:31 +0000)]
[clang-format] Fixup a case of text proto message attributes

Summary: This patch fixes a case where a proto message attribute is wrongly identified as an text proto extension.

Subscribers: klimek, cfe-commits

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

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

6 years ago[CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFC
Ilya Biryukov [Mon, 19 Feb 2018 13:53:49 +0000 (13:53 +0000)]
[CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFC

CodeCompletionContext had declarations of field and enum inside, both named 'Kind'.
It caused gcc 4.8 to give an incorrent warning when refering to enum as
`enum CodeCompletionContext::Kind`.

Avoid that warning by renaming the private field to CCKind.

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

6 years ago[ARM] disable FPU features when using soft floating point.
Keith Walker [Mon, 19 Feb 2018 12:40:26 +0000 (12:40 +0000)]
[ARM] disable FPU features when using soft floating point.

To be compatible with GCC if soft floating point is in effect any FPU
specified is effectively ignored, eg,

  -mfloat-abi=soft -fpu=neon

If any floating point features which require FPU hardware are enabled
they must be disable.

There was some support for doing this for NEON, but it did not handle
VFP, nor did it prevent the backend from emitting the build attribute
Tag_FP_arch describing the generated code as using the floating point
hardware if a FPU was specified (even though soft float does not use
the FPU).

Disabling the hardware floating point features for targets which are
compiling for soft float has meant that some tests which were incorrectly
checking for hardware support also needed to be updated. In such cases,
where appropriate the tests have been updated to check compiling for
soft float and a non-soft float variant (usually softfp). This was
usually because the target specified in the test defaulted to soft float.

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

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

6 years ago[CodeComplete] Add a helper to print CodeCompletionContext::Kind
Ilya Biryukov [Mon, 19 Feb 2018 12:35:33 +0000 (12:35 +0000)]
[CodeComplete] Add a helper to print CodeCompletionContext::Kind

Summary: Will be used in clangd. See D43377.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, cfe-commits

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

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

6 years agoclang-format: [JS] fix `of` detection.
Martin Probst [Mon, 19 Feb 2018 12:32:13 +0000 (12:32 +0000)]
clang-format: [JS] fix `of` detection.

Summary:
`of` is only a keyword when after an identifier, but not when after
an actual keyword.

Before:
    return of (a, b, c);
After:
    return of(a, b, c);

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

6 years ago[AVR] Set the program address space in the data layout
Dylan McKay [Mon, 19 Feb 2018 10:46:16 +0000 (10:46 +0000)]
[AVR] Set the program address space in the data layout

This is accompanied by r325481 in LLVM.

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

6 years ago[CodeGen] Initialize large arrays by copying from a global
Ivan A. Kosarev [Mon, 19 Feb 2018 09:49:11 +0000 (09:49 +0000)]
[CodeGen] Initialize large arrays by copying from a global

Currently, clang compiles explicit initializers for array
elements into series of store instructions. For large arrays of
built-in types this results in bloated output code and
significant amount of time spent on the instruction selection
phase. This patch fixes the issue by initializing such arrays
with global constants that store the binary image of the
initializer.

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

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

6 years ago[cxx_dr_status] Tests for CWG issues 641-687.
Richard Smith [Mon, 19 Feb 2018 09:05:48 +0000 (09:05 +0000)]
[cxx_dr_status] Tests for CWG issues 641-687.

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

6 years ago[Analyzer] Move UnexploredFirstStack into an anonymous namespace.
Benjamin Kramer [Sun, 18 Feb 2018 19:08:27 +0000 (19:08 +0000)]
[Analyzer] Move UnexploredFirstStack into an anonymous namespace.

No functionality change intended.

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

6 years ago[X86] Add 'sahf' CPU feature to frontend
Dimitry Andric [Sat, 17 Feb 2018 21:04:35 +0000 (21:04 +0000)]
[X86] Add 'sahf' CPU feature to frontend

Summary:
Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
`+sahf` feature for the backend, for bug 36028 (Incorrect use of
pushf/popf enables/disables interrupts on amd64 kernels).  This was
originally submitted in bug 36037 by Jonathan Looney
<jonlooney@gmail.com>.

As described there, GCC also uses `-msahf` for this feature, and the
backend already recognizes the `+sahf` feature. All that is needed is to
teach clang to pass this on to the backend.

The mapping of feature support onto CPUs may not be complete; rather, it
was chosen to match LLVM's idea of which CPUs support this feature (see
lib/Target/X86/X86.td).

I also updated the affected test case (CodeGen/attr-target-x86.c) to
match the emitted output.

Reviewers: craig.topper, coby, efriedma, rsmith

Reviewed By: craig.topper

Subscribers: emaste, cfe-commits

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

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

6 years ago[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 16 Feb 2018 23:40:07 +0000 (23:40 +0000)]
[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[ThinLTO] Allow indexing to request backend to ignore the module
Vitaly Buka [Fri, 16 Feb 2018 23:38:22 +0000 (23:38 +0000)]
[ThinLTO] Allow indexing to request backend to ignore the module

Summary:
Gold plugin does not add pass to ThinLTO modules without useful symbols.
In this case ThinLTO can't create corresponding index file and some features, like CFI,
cannot be processes by backed correctly without index.
Given that we don't need the backed output we can request it to avoid
processing the module. This is implemented by this patch using new
"SkipModuleByDistributedBackend" flag.

Reviewers: pcc, tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

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

6 years ago[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set
Vitaly Buka [Fri, 16 Feb 2018 23:34:16 +0000 (23:34 +0000)]
[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set

Summary:
ThinLTO compilation may decide not to split module and keep at as regular LTO.
In this can this module already processed during indexing and already a part of
merged object file. So here we can just skip it.

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

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

6 years ago[OPENMP] Do not emit messages for templates in declare target
Alexey Bataev [Fri, 16 Feb 2018 21:23:23 +0000 (21:23 +0000)]
[OPENMP] Do not emit messages for templates in declare target
constructs.

The compiler may emit some extra warnings for functions, that are
implicit specialization of the templates, declared in the target region.

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

6 years ago[MS] Make constexpr static data members implicitly inline
Reid Kleckner [Fri, 16 Feb 2018 19:44:47 +0000 (19:44 +0000)]
[MS] Make constexpr static data members implicitly inline

This handles them exactly the same way that we handle const integral
static data members with inline definitions, which is what MSVC does.

As a follow-up, now that we have a way to mark variables inline in the
AST, we should consider marking them implicitly inline there instead of
only treating them as inline in CodeGen. Unfortunately, this breaks a
lot of dllimport test cases, so that is future work for now.

Fixes PR36125.

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

6 years ago[OPENMP] Fix PR35873: Fix data-sharing attributes for const variables.
Alexey Bataev [Fri, 16 Feb 2018 19:16:54 +0000 (19:16 +0000)]
[OPENMP] Fix PR35873: Fix data-sharing attributes for const variables.

Compiler erroneously returned wrong data-sharing attributes for the
constant variables if they have explictly specified attributes.

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

6 years ago[OPENMP] Fix parsing of the directives with inner directives.
Alexey Bataev [Fri, 16 Feb 2018 18:36:44 +0000 (18:36 +0000)]
[OPENMP] Fix parsing of the directives with inner directives.

The parsing may lead to compiler hanging because of the incorrect
processing of inner OpenMP pragmas.

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

6 years agoClean up 'target' attribute diagnostics
Erich Keane [Fri, 16 Feb 2018 17:31:59 +0000 (17:31 +0000)]
Clean up 'target' attribute diagnostics

There were a few issues previously with the target
attribute diagnostics implementation that lead to the
attribute being added to the AST despite having an error
in it.

This patch changes that, and adds a test to ensure it
does not get added to the AST.

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

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

6 years agoUse Token::isOneOf method in Parser.
Frederich Munch [Fri, 16 Feb 2018 16:07:33 +0000 (16:07 +0000)]
Use Token::isOneOf method in Parser.

Summary: Easier to read and possibly optimize.

Reviewers: rsmith, sepavloff

Reviewed By: sepavloff

Subscribers: sepavloff, cfe-commits

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

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

6 years ago[ARM] Add tests for the vcvtr builtins
Sjoerd Meijer [Fri, 16 Feb 2018 16:01:08 +0000 (16:01 +0000)]
[ARM] Add tests for the vcvtr builtins

This adds Sema and Codegen tests for the vcvtr builtins
(because they were missing).

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

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

6 years ago[Coroutines] Use target-agnostic size_t in test
Brian Gesiak [Fri, 16 Feb 2018 14:11:27 +0000 (14:11 +0000)]
[Coroutines] Use target-agnostic size_t in test

Summary:
Fix a test failure on ARM hosts that was caused by a difference in the type of
size_t, by using a target-agnostic definiton.

Test Plan:
```
clang -cc1 -internal-isystem build/lib/clang/7.0.0/include -nostdsysteminc \
      -std=c++14 -fcoroutines-ts -verify clang/test/SemaCXX/coroutines.cpp \
      -fcxx-exceptions -fexceptions \
      -triple armeb-none-eabi
```

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

6 years ago[clang-format] Enable google text proto formatting in R"proto('s
Krasimir Georgiev [Fri, 16 Feb 2018 12:10:06 +0000 (12:10 +0000)]
[clang-format] Enable google text proto formatting in R"proto('s

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

6 years agoRevert r325321 "[Sema] Take into account the current context when checking the"
Hans Wennborg [Fri, 16 Feb 2018 12:06:32 +0000 (12:06 +0000)]
Revert r325321 "[Sema] Take into account the current context when checking the"

This broke the Chromium build, see https://crbug.com/813017

> accessibility of a class member.
>
> This fixes PR32898.
>
> rdar://problem/33737747
>
> Differential revision: https://reviews.llvm.org/D36918

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

6 years ago[Sema] Take into account the current context when checking the
Akira Hatanaka [Fri, 16 Feb 2018 08:47:37 +0000 (08:47 +0000)]
[Sema] Take into account the current context when checking the
accessibility of a class member.

This fixes PR32898.

rdar://problem/33737747

Differential revision: https://reviews.llvm.org/D36918

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

6 years ago[Coverage] Handle break/continue outside of loop bodies
Vedant Kumar [Fri, 16 Feb 2018 07:59:43 +0000 (07:59 +0000)]
[Coverage] Handle break/continue outside of loop bodies

Teach the coverage mapping logic to handle break or continue statements
within for loop increments.

Fixes llvm.org/PR36406.

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

6 years ago[DOXYGEN] There was a request in the review D41507 to change the notation for hex...
Ekaterina Romanova [Fri, 16 Feb 2018 03:11:35 +0000 (03:11 +0000)]
[DOXYGEN] There was a request in the review D41507 to change the notation for hex numbers in doxygen documentation from <...>h to 0x<...>. Both of these notations were used in x86 intrinsics documentation. I promised to change them to 0x<...> for consistency.

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

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

6 years ago[Modules] Extend -fmodule-name semantic for frameworks with private modules
Bruno Cardoso Lopes [Fri, 16 Feb 2018 00:12:57 +0000 (00:12 +0000)]
[Modules] Extend -fmodule-name semantic for frameworks with private modules

Assume Foo.framework with two module maps and two modules Foo and
Foo_Private.

Framework authors need to skip building both Foo and Foo_Private when
using -fmodule-name=Foo, since both are part of the framework and used
interchangeably during compilation.

rdar://problem/37500098

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

6 years ago[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.
Alexey Bataev [Thu, 15 Feb 2018 23:39:43 +0000 (23:39 +0000)]
[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.

Codegen for ordered with doacross construct might produce incorrect code
because of missing cleanup scope for the construct. Without this scope
the final runtime function call could be emitted in the wrong order that
leads to incorrect codegen.

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

6 years ago[OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with depend sink...
Alexey Bataev [Thu, 15 Feb 2018 22:42:57 +0000 (22:42 +0000)]
[OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with depend sink|source clause.

Patch fixes compiler crash on standalone #pragmas ordered with
depend(sink|source) clauses.

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

6 years agoSilence a -Wparentheses warning; NFC.
Aaron Ballman [Thu, 15 Feb 2018 21:03:39 +0000 (21:03 +0000)]
Silence a -Wparentheses warning; NFC.

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

6 years agoSilence some -Wunused-variable warnings; NFC.
Aaron Ballman [Thu, 15 Feb 2018 20:56:19 +0000 (20:56 +0000)]
Silence some -Wunused-variable warnings; NFC.

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

6 years ago[Coroutines] Use allocator overload when available
Brian Gesiak [Thu, 15 Feb 2018 20:37:22 +0000 (20:37 +0000)]
[Coroutines] Use allocator overload when available

Summary:
Depends on https://reviews.llvm.org/D42605.

An implementation of the behavior described in `[dcl.fct.def.coroutine]/7`:
when a promise type overloads `operator new` using a "placement new"
that takes the same argument types as the coroutine function, that
overload is used when allocating the coroutine frame.

Simply passing references to the coroutine function parameters directly
to `operator new` results in invariant violations in LLVM's coroutine
splitting pass, so this implementation modifies Clang codegen to
produce allocator-specific alloc/store/loads for each parameter being
forwarded to the allocator.

Test Plan: `check-clang`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: lewissbaker, EricWF, cfe-commits

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

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

6 years ago[Sema] Toggle diags when finding allocators (NFCI)
Brian Gesiak [Thu, 15 Feb 2018 20:09:25 +0000 (20:09 +0000)]
[Sema] Toggle diags when finding allocators (NFCI)

Summary:
Many methods in Sema take a `bool Diagnose` parameter. Examples of such
methods include `Sema::FindDeallocationFunction` and
`Sema::SpecialMemberIsTrivial`. Calling these methods with
`Diagnose = false` allows callers to, for instance, check for the
existence of a deallocation function, without that check resulting in
error diagnostics being emitted if no matching deallocation function exists.

Add a similar `bool Diagnose` to the `Sema::FindAllocationFunctions`
method, so that checks for the existence of allocation functions can be
made without triggering error diagnostics.

This allows `SemaCoroutine.cpp`, in its implementation of the
Coroutines TS, to check for the existence of a particular `operator new`
overload, but then without error fall back to a default `operator new`
if no matching overload exists.

Test Plan: `check-clang`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Suppress temporary destructors for temporary arrays.
Artem Dergachev [Thu, 15 Feb 2018 19:34:19 +0000 (19:34 +0000)]
[analyzer] Suppress temporary destructors for temporary arrays.

Array destructors, like constructors, need to be called for each element of the
array separately. We do not have any mechanisms to do this in the analyzer,
so for now all we do is evaluate a single constructor or destructor
conservatively and give up. It automatically causes the necessary invalidation
and pointer escape for the whole array, because this is how RegionStore works.

Implement this conservative behavior for temporary destructors. This fixes the
crash on the provided test.

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

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

6 years ago[analyzer] Implement path notes for temporary destructors.
Artem Dergachev [Thu, 15 Feb 2018 19:28:21 +0000 (19:28 +0000)]
[analyzer] Implement path notes for temporary destructors.

Temporary destructors fire at the end of the full-expression. It is reasonable
to attach the path note for entering/leaving the temporary destructor to its
CXXBindTemporaryExpr. This would not affect lifetime-extended temporaries with
their automatic destructors which aren't temporary destructors.

The path note may be confusing in the case of destructors after elidable copy
constructors.

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

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

6 years ago[analyzer] Compute the correct this-region for temporary destructors.
Artem Dergachev [Thu, 15 Feb 2018 19:17:44 +0000 (19:17 +0000)]
[analyzer] Compute the correct this-region for temporary destructors.

Inline them if possible - a separate flag is added to control this.
The whole thing is under the cfg-temporary-dtors flag, off by default so far.

Temporary destructors are called at the end of full-expression. If the
temporary is lifetime-extended, automatic destructors kick in instead,
which are not addressed in this patch, and normally already work well
modulo the overally broken support for lifetime extension.

The patch operates by attaching the this-region to the CXXBindTemporaryExpr in
the program state, and then recalling it during destruction that was triggered
by that CXXBindTemporaryExpr. It has become possible because
CXXBindTemporaryExpr is part of the construction context since r325210.

Differential revision: https://reviews.llvm.org/D43104

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

6 years agoClean up AMDGCN tests
Yaxun Liu [Thu, 15 Feb 2018 19:12:41 +0000 (19:12 +0000)]
Clean up AMDGCN tests

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

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

6 years ago[analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().
Artem Dergachev [Thu, 15 Feb 2018 19:01:55 +0000 (19:01 +0000)]
[analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().

Don't look at the parent statement to figure out if the cxx-allocator-inlining
flag should kick in and prevent us from inlining the constructor within
a new-expression. We now have construction contexts for that purpose.

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

6 years ago[Test] Remove mangled name from test.
Matt Davis [Thu, 15 Feb 2018 17:55:52 +0000 (17:55 +0000)]
[Test] Remove mangled name from test.

This line is not needed in the test, and breaks Windows testing.
Fixes the test added in r325175.

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

6 years ago[OpenCL] Fix __enqueue_block for block with captures
Yaxun Liu [Thu, 15 Feb 2018 16:39:19 +0000 (16:39 +0000)]
[OpenCL] Fix __enqueue_block for block with captures

The following test case causes issue with codegen of __enqueue_block

void (^block)(void) = ^{ callee(id, out); };

enqueue_kernel(queue, 0, ndrange, block);
Clang first does codegen for block expression in the first line and deletes its block info.
Clang then tries to do codegen for the same block expression again for the second line,
and fails because the block info is gone.

The fix is to do normal codegen for both lines. Introduce an API to OpenCL runtime to
record llvm block invoke function and llvm block literal emitted for each AST block
expression, and use the recorded information for generating the wrapper kernel.

The EmitBlockLiteral APIs are cleaned up to minimize changes to the normal codegen
of blocks.

Another minor issue is that some clean up AST expression is generated for block
with captures, which can be stripped by IgnoreImplicit.

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

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

6 years agoAmend r325256. This change was not properly merged locally before the commit happened.
Aaron Ballman [Thu, 15 Feb 2018 16:28:10 +0000 (16:28 +0000)]
Amend r325256. This change was not properly merged locally before the commit happened.

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

6 years agoNFC; clean up this file based on our coding standards. The impetus was considerable...
Aaron Ballman [Thu, 15 Feb 2018 16:20:20 +0000 (16:20 +0000)]
NFC; clean up this file based on our coding standards. The impetus was considerable use of a type name as an identifier for an object.

Changed identifier names (especially function parameters) to not clash with type names and to follow the proper naming conventions. Use of explicit type names changed to use auto where appropriate. Removed unused parameters that should have never been added in the first place. Minor formatting cleanups.

The changes were mostly mechanical and should have no functional impact.

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

6 years ago[clang-format] Support repeated field lists in protos
Krasimir Georgiev [Thu, 15 Feb 2018 15:30:22 +0000 (15:30 +0000)]
[clang-format] Support repeated field lists in protos

Summary:
This patch adds support for list initialization of proto repeated fields:
```
keys: [1, 2, 3]
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years agoAdding msan support for FreeBSD
Kamil Rytarowski [Thu, 15 Feb 2018 14:19:23 +0000 (14:19 +0000)]
Adding msan support for FreeBSD

Summary: Enabling memory sanitiser for X86_64 arch only. To match the sanitiser counterpart.

Patch by: David CARLIER

Reviewers: krytarowski

Reviewed By: krytarowski

Subscribers: dim, emaste, cfe-commits

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

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

6 years agoAdd Xray instrumentation compile-time/link-time support to FreeBSD
Kamil Rytarowski [Thu, 15 Feb 2018 14:12:21 +0000 (14:12 +0000)]
Add Xray instrumentation compile-time/link-time support to FreeBSD

Summary: Similarly to the GNU driver version, adding proper compile and linker flags.

Patch by: David CARLIER

Reviewers: vitalybuka, krytarowski, dberris

Reviewed By: krytarowski, dberris

Subscribers: emaste, dberris, cfe-commits

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

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

6 years agoAdd -no-canonical-prefixes to allow different build modes.
Martin Bohme [Thu, 15 Feb 2018 13:50:07 +0000 (13:50 +0000)]
Add -no-canonical-prefixes to allow different build modes.

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

6 years ago[clang-format] Improve ObjC headers detection
Jacek Olesiak [Thu, 15 Feb 2018 08:47:56 +0000 (08:47 +0000)]
[clang-format] Improve ObjC headers detection

Summary: Detect ObjC characteristic types when they start a line and add additional keywords.

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

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

6 years ago[analyzer] Inline constructors for destroyable temporaries.
Artem Dergachev [Thu, 15 Feb 2018 03:26:43 +0000 (03:26 +0000)]
[analyzer] Inline constructors for destroyable temporaries.

Since r325210, in cfg-temporary-dtors mode, we can rely on the CFG to tell us
that we're indeed constructing a temporary, so we can trivially construct a
temporary region and inline the constructor.

Much like r325202, this is only done under the off-by-default
cfg-temporary-dtors flag because the temporary destructor, even if available,
will not be inlined and won't have the correct object value (target region).
Unless this is fixed, it is quite unsafe to inline the constructor.

If the temporary is lifetime-extended, the destructor would be an automatic
destructor, which would be evaluated with a "correct" target region - modulo
the series of incorrect relocations performed during the lifetime extension.
It means that at least, values within the object are guaranteed to be properly
escaped or invalidated.

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

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

6 years ago[CFG] Provide construction contexts for temproary objects.
Artem Dergachev [Thu, 15 Feb 2018 03:13:36 +0000 (03:13 +0000)]
[CFG] Provide construction contexts for temproary objects.

Constructors of C++ temporary objects that have destructors now can be queried
to discover that they're indeed constructing temporary objects.

The respective CXXBindTemporaryExpr, which is also repsonsible for destroying
the temporary at the end of full-expression, is now available at the
construction site in the CFG. This is all the context we need to provide for
temporary objects that are not lifetime extended. For lifetime-extended
temporaries, more context is necessary.

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

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

6 years ago[analyzer] Decide on inlining destructors via EvalCallOptions.
Artem Dergachev [Thu, 15 Feb 2018 02:51:58 +0000 (02:51 +0000)]
[analyzer] Decide on inlining destructors via EvalCallOptions.

EvalCallOptions were introduced in r324018 for allowing various parts of
ExprEngine to notify the inlining mechanism, while preparing for evaluating a
function call, of possible difficulties with evaluating the call that they
foresee. Then mayInlineCall() would still be a single place for making the
decision.

Use that mechanism for destructors as well - pass the necessary flags from the
CFG-element-specific destructor handlers.

Part of this patch accidentally leaked into r324018, which led into a change in
tests; this change is reverted now, because even though the change looked
correct, the underlying behavior wasn't. Both of these commits were not intended
to introduce any function changes otherwise.

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

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

6 years agoReapply r325193
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:37:04 +0000 (02:37 +0000)]
Reapply r325193

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

6 years ago[analyzer] Allow inlining constructors into return values.
Artem Dergachev [Thu, 15 Feb 2018 02:32:32 +0000 (02:32 +0000)]
[analyzer] Allow inlining constructors into return values.

This only affects the cfg-temporary-dtors mode - in this mode we begin inlining
constructors that are constructing function return values. These constructors
have a correct construction context since r324952.

Because temporary destructors are not only never inlined, but also don't have
the correct target region yet, this change is not entirely safe. But this
will be fixed in the subsequent commits, while this stays off behind the
cfg-temporary-dtors flag.

Lifetime extension for return values is still not modeled correctly.

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

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