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

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

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

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

It will incorrectly see such functions as Declarations and not Definitions

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

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

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

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

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

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

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

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

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

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

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

Reviewers: alexfh, klimek

Reviewed By: klimek

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

Tags: #clang, #llvm

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[MS] Add metadata for __declspec(allocator)

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

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

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

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

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

This is the same approach used by CUDA and OpenMP.

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

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

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

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

Patch by: Nicolas Manichon

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

Reviewed By: riccibruno

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

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

Disabled by default as this is still an experimental feature.

Reviewed By: thakis

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

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

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

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

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

Reviewed By: aaron.ballman

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

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

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

Reviewers: pablooliveira, olista01, LukeGeeson, DavidSpickett

Reviewed By: DavidSpickett

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

Tags: #clang

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

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

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

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

Contributed by @dchai!

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang

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

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

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

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

Reviewers: ioeric, ilya-biryukov

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

Tags: #clang

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

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

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

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

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

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

<rdar://problem/49794007>

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

Tags: #clang

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

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

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

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

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

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

5 years agoRemove use of lookahead from _Pragma handling and from all other
Richard Smith [Thu, 11 Apr 2019 21:18:22 +0000 (21:18 +0000)]
Remove use of lookahead from _Pragma handling and from all other
internal lexing steps in the preprocessor.

It is not safe to use the preprocessor's token lookahead except when
operating on the final sequence of tokens that would be produced by
phase 4 of translation. Doing so corrupts the token lookahead cache used
by the parser. (See added testcase for an example.) Lookahead should
instead be viewed as a layer on top of the normal lexer.

Added assertions to catch any further incorrect uses of lookahead within
lexing actions.

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

5 years ago[DebugInfo] Combine Trivial and NonTrivial flags
Aaron Smith [Thu, 11 Apr 2019 20:24:54 +0000 (20:24 +0000)]
[DebugInfo] Combine Trivial and NonTrivial flags

Summary:
These flags are used when emitting debug info and needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs.

The Trivial flag was introduced in https://reviews.llvm.org/D45122

It's been pointed out that Trivial and NonTrivial may imply each other and that seems to be the case in the current tests. This change combines them into a single flag -- NonTrivial -- and updates the corresponding unit tests. There is an additional change to llvm to update the flags.

Reviewers: rnk, zturner, dblaikie, probinson, Hui

Reviewed By: dblaikie

Subscribers: aprantl, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoSupport objc_nonlazy_class attribute on Objective-C implementations
Erik Pilkington [Thu, 11 Apr 2019 17:55:34 +0000 (17:55 +0000)]
Support objc_nonlazy_class attribute on Objective-C implementations

Fixes rdar://49523079

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

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

5 years agoAdd support for attributes on @implementations in Objective-C
Erik Pilkington [Thu, 11 Apr 2019 17:55:30 +0000 (17:55 +0000)]
Add support for attributes on @implementations in Objective-C

We want to make objc_nonlazy_class apply to implementations, but ran into this.
There doesn't seem to be any reason that this isn't supported.

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

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

5 years agoAdd { } to silence compiler warning [NFC]
Mikael Holmen [Thu, 11 Apr 2019 06:57:12 +0000 (06:57 +0000)]
Add { } to silence compiler warning [NFC]

At least clang 3.6 warns on the original code:

../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:829:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 1>({Address(nullptr, CharUnits::Zero())});
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 {                                  }
../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:833:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 2>({Address(nullptr, CharUnits::Zero()),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

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

5 years ago[OpenCL] Re-fix invalid address space generation for clk_event_t arguments of enqueue...
Alexey Sotkin [Thu, 11 Apr 2019 06:18:17 +0000 (06:18 +0000)]
[OpenCL] Re-fix invalid address space generation for clk_event_t arguments of enqueue_kernel builtin function

Summary:
https://reviews.llvm.org/D53809 fixed wrong address space(assert in debug build)
generated for event_ret argument. But exactly the same problem exists for
event_wait_list argument. This patch should fix both.

Reviewers: Anastasia, yaxunl

Reviewed By:  Anastasia

Subscribers: kristina, ebevhan, cfe-commits

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

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

5 years agoFix a test, NFC
Erik Pilkington [Wed, 10 Apr 2019 21:18:21 +0000 (21:18 +0000)]
Fix a test, NFC

This test was duplicated, and the last declaration had some syntax errors since
the invalid attribute caused the @implementation to be skipped by the parser.

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

5 years agoCheck i < FD->getNumParams() before querying
Dmitri Gribenko [Wed, 10 Apr 2019 20:25:07 +0000 (20:25 +0000)]
Check i < FD->getNumParams() before querying

Summary:
As was already stated in a previous comment, the parameter isn't
necessarily referring to one of the DeclContext's parameter. We
should check the index is within the range to avoid out-of-boundary
access.

Reviewers: gribozavr, rsmith, lebedev.ri

Reviewed By: gribozavr, rsmith

Subscribers: lebedev.ri, cfe-commits

Tags: #clang

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

Patch by Violet.

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

5 years ago[clang][ASTContext] Try to exit early before loading serialized comments from AST...
Jan Korous [Wed, 10 Apr 2019 20:23:33 +0000 (20:23 +0000)]
[clang][ASTContext] Try to exit early before loading serialized comments from AST files

Loading external comments is expensive. This change probably doesn't apply to common cases but is almost for free and would save some work in case none of the declaration needs external comments to be loaded.

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

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

5 years agoAdd IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.
John McCall [Wed, 10 Apr 2019 19:57:20 +0000 (19:57 +0000)]
Add IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.

Patch by Tony Allevato!

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

5 years ago[OPENMP]Improve detection of number of teams, threads in target
Alexey Bataev [Wed, 10 Apr 2019 19:11:33 +0000 (19:11 +0000)]
[OPENMP]Improve detection of number of teams, threads in target
regions.

Added more complex analysis for number of teams and number of threads in
the target regions, also merged related common code between CGOpenMPRuntime
and CGOpenMPRuntimeNVPTX classes.

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

5 years agoFix for different build configurations.
John McCall [Wed, 10 Apr 2019 19:11:32 +0000 (19:11 +0000)]
Fix for different build configurations.

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

5 years agoFix an off-by-one mistake in IRGen's copy-construction
John McCall [Wed, 10 Apr 2019 18:07:18 +0000 (18:07 +0000)]
Fix an off-by-one mistake in IRGen's copy-construction
special cases in the presence of zero-length arrays.

Patch by Joran Bigalet!

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

5 years agoDon't emit an unreachable return block.
John McCall [Wed, 10 Apr 2019 17:03:09 +0000 (17:03 +0000)]
Don't emit an unreachable return block.

Patch by Brad Moody.

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

5 years agoclang-cl: Fix parsing of the /F option (PR41405)
Hans Wennborg [Wed, 10 Apr 2019 14:27:47 +0000 (14:27 +0000)]
clang-cl: Fix parsing of the /F option (PR41405)

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

5 years ago[CodeGen][ObjC] Emit the retainRV marker as a module flag instead of
Akira Hatanaka [Wed, 10 Apr 2019 06:20:23 +0000 (06:20 +0000)]
[CodeGen][ObjC] Emit the retainRV marker as a module flag instead of
named metadata.

This fixes a bug where ARC contract wasn't inserting the retainRV
marker when LTO was enabled, which caused objects returned from a
function to be auto-released.

rdar://problem/49464214

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

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

5 years ago[OPENMP]Allow allocate directive on parameters.
Alexey Bataev [Tue, 9 Apr 2019 16:31:37 +0000 (16:31 +0000)]
[OPENMP]Allow allocate directive on parameters.

Patch allows to use allocate directives on the function parameters.

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

5 years agoFixed comment as pointed out by post-commit review of D59845
Raphael Isemann [Tue, 9 Apr 2019 14:18:23 +0000 (14:18 +0000)]
Fixed comment as pointed out by post-commit review of D59845

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

5 years agoAdd support for detection of devtoolset-8
Tom Stellard [Tue, 9 Apr 2019 13:26:10 +0000 (13:26 +0000)]
Add support for detection of devtoolset-8

Summary:
The current llvm/clang et al. project can be built with the latest developer toolset (devtoolset-8) on RHEL, which provides GCC 8.2.1.
However, the result compiler will not identify this toolset itself when compiling programs, which is of course not desirable.

After the patch - which simply adds the name of the developer toolset to the existing list - it gets identified and selected, as shown below:

[bamboo@bamboo llvm-project]$ clang -v
clang version 9.0.0 (https://github.com/llvm/llvm-project.git e5ac385fb1ffa4bd3875ea6a4d24efdbd7814572)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bamboo/llvm/bin
Found candidate GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1
Found candidate GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

Patch By: Radu-Adrian Popescu

Reviewers: tstellar, fedor.sergeev

Reviewed By: tstellar

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[RISCV] Unbreak test from r357989
Alex Bradbury [Tue, 9 Apr 2019 10:44:47 +0000 (10:44 +0000)]
[RISCV] Unbreak test from r357989

There were some errors in the committed test checks, left in due to a git
stash apply mishap.

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

5 years ago[RISCV][NFC] Minor fixup for r357989
Alex Bradbury [Tue, 9 Apr 2019 10:25:05 +0000 (10:25 +0000)]
[RISCV][NFC] Minor fixup for r357989

One of the tests in riscv64-lp64-lp64f-lp64d would have had a different
lowering for lp64f/lp64d as a float argument was missed.

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

5 years ago[RISCV][NFC] Refactor RISC-V ABI lowering tests in preparation for hard float patches
Alex Bradbury [Tue, 9 Apr 2019 10:12:49 +0000 (10:12 +0000)]
[RISCV][NFC] Refactor RISC-V ABI lowering tests in preparation for hard float patches

Split tests in to files representing the subset of RISC-V ABIs they should
have identical output for.

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

5 years ago[ASTImporter] Fix in ASTImporter::Import_New(const Decl *)
Bjorn Pettersson [Tue, 9 Apr 2019 09:12:32 +0000 (09:12 +0000)]
[ASTImporter] Fix in ASTImporter::Import_New(const Decl *)

Make sure ASTImporter::Import_New(const Decl *) returns
a Expected<const Decl *> and not Expected<Decl *> to
make the clang/unittests/AST/ASTImporterTest.cpp compile
without the warning

 clang/unittests/AST/ASTImporterTest.cpp:117:12: error: no viable conversion from 'Expected<clang::Decl *>' to 'Expected<const clang::Decl *>'
    return Imported;

(I got the above when building with clang 3.6).

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

5 years ago[clang-format] Add AfterCaseLabel to BraceWrapping
Owen Pan [Mon, 8 Apr 2019 23:36:25 +0000 (23:36 +0000)]
[clang-format] Add AfterCaseLabel to BraceWrapping

Fixes PR38686

llvm-svn: 52527

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

5 years agoRevert "[MS] Add metadata for __declspec(allocator)"
Amy Huang [Mon, 8 Apr 2019 22:46:41 +0000 (22:46 +0000)]
Revert "[MS] Add metadata for __declspec(allocator)"

This reverts commit e7bd735bb03a7b8141e32f7d6cb98e8914d8799e.
Reverting because of buildbot failure.

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

5 years agoMove the builtin headers to use the new license file header.
Chandler Carruth [Mon, 8 Apr 2019 20:51:30 +0000 (20:51 +0000)]
Move the builtin headers to use the new license file header.

Summary:
These all had somewhat custom file headers with different text from the
ones I searched for previously, and so I missed them. Thanks to Hal and
Kristina and others who prompted me to fix this, and sorry it took so
long.

Reviewers: hfinkel

Subscribers: mcrosier, javed.absar, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name...
Shafik Yaghmour [Mon, 8 Apr 2019 20:50:21 +0000 (20:50 +0000)]
[ASTImporter] Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name instead of SearchName

Summary:
https://reviews.llvm.org/D51633 added error handling to the ASTNodeImporter::VisitEnumDecl(...) for the conflicting names case. This could lead to erroneous return of an error in that case since we should have been using SearchName. Name may be empty in the case where we find the name via getTypedefNameForAnonDecl(...).

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

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

5 years agoClean up ObjCPropertyDecl printing
David Goldman [Mon, 8 Apr 2019 19:52:45 +0000 (19:52 +0000)]
Clean up ObjCPropertyDecl printing

Summary:
- `@property(attr, attr2)` instead of `@property ( attr,attr2 )`.
- Change priority of attributes (see code/comments inline).
- Support for printing weak and unsafe_unretained attributes.

Subscribers: arphaman, jfb, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.
Alexey Bataev [Mon, 8 Apr 2019 19:06:42 +0000 (19:06 +0000)]
[OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.

Functions __kmpc_alloc/__kmpc_free are updated with the new interfaces.
Patch synchronizes the compiler with the runtime.

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

5 years ago[MS] Add metadata for __declspec(allocator)
Amy Huang [Mon, 8 Apr 2019 17:58:29 +0000 (17:58 +0000)]
[MS] Add metadata for __declspec(allocator)

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

Reviewers: rnk

Subscribers: jfb, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Add some fp to integer conversion intrinsics to Sema::CheckX86BuiltinRoundingOr...
Craig Topper [Mon, 8 Apr 2019 17:05:57 +0000 (17:05 +0000)]
[X86] Add some fp to integer conversion intrinsics to Sema::CheckX86BuiltinRoundingOrSAE so their rounding controls will be checked.

If we don't check this in the frontend we'll get an isel error in the backend later. This is far less friendly to users.

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

5 years ago[OPENMP][NVPTX]Fixed processing of memory management directives.
Alexey Bataev [Mon, 8 Apr 2019 16:53:57 +0000 (16:53 +0000)]
[OPENMP][NVPTX]Fixed processing of memory management directives.

Added special processing of the memory management directives/clauses for
NVPTX target. For private locals, omp_default_mem_alloc and
omp_thread_mem_alloc result in allocation in local memory.
omp_const_mem_alloc allocates const memory, omp_teams_mem_alloc
allocates shared memory, and omp_cgroup_mem_alloc and
omp_large_cap_mem_alloc allocate global memory.

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

5 years agoRemove a bogus sed option in test.
Alexander Kornienko [Mon, 8 Apr 2019 16:34:38 +0000 (16:34 +0000)]
Remove a bogus sed option in test.

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

5 years agoRemove a useless assertion in clang-check.
Alexander Kornienko [Mon, 8 Apr 2019 16:29:43 +0000 (16:29 +0000)]
Remove a useless assertion in clang-check.

Re-commit r357915 with a fix for windows.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

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

5 years agoRevert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.
Simon Pilgrim [Mon, 8 Apr 2019 15:49:19 +0000 (15:49 +0000)]
Revert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15
........
Breaks windows buildbots

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

5 years ago[python, tests] Disable Clang Python tests on SPARC
Rainer Orth [Mon, 8 Apr 2019 15:01:06 +0000 (15:01 +0000)]
[python, tests] Disable Clang Python tests on SPARC

Running `make check-all` fails on Solaris 11/SPARC since the clang python
tests FAIL:

  ............................
  ======================================================================
  FAIL: test_extent (tests.cindex.test_location.TestLocation)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_location.py", line 87, in test_extent
      self.assert_location(one.extent.start,line=1,column=1,offset=0)
    File "tests/cindex/test_location.py", line 22, in assert_location
      self.assertEqual(loc.column, column)
  AssertionError: 5 != 1

  ======================================================================
  FAIL: test_get_children (tests.cindex.test_cursor.TestCursor)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_cursor.py", line 70, in test_get_children
      self.assertEqual(tu_nodes[0].is_definition(), True)
  AssertionError: False != True

  ----------------------------------------------------------------------
  Ran 126 tests in 2.123s

  FAILED (failures=2, skipped=6)

Unfortunately, this aborts the rest of `make check-all`, even with `-k`, so
this patch disables the test as is already done on a couple of other
targets.

This allowed the `sparc-sun-solaris2.11` test to finish.

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

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

5 years agoRemove a useless assertion in clang-check.
Alexander Kornienko [Mon, 8 Apr 2019 14:18:26 +0000 (14:18 +0000)]
Remove a useless assertion in clang-check.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

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

5 years agoChanged every use of ASTImporter::Import to Import_New
Balazs Keri [Mon, 8 Apr 2019 13:59:15 +0000 (13:59 +0000)]
Changed every use of ASTImporter::Import to Import_New

Reviewers: a.sidorin, shafik, martong, a_sidorin

Reviewed By: a_sidorin

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

Tags: #clang

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

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

5 years ago[clang-format] Optionally insert a space after unary ! operator
Reuben Thomas [Mon, 8 Apr 2019 12:54:48 +0000 (12:54 +0000)]
[clang-format] Optionally insert a space after unary ! operator

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

5 years agoIAS is now enabled for all OS on MIPS64
Brad Smith [Mon, 8 Apr 2019 00:03:01 +0000 (00:03 +0000)]
IAS is now enabled for all OS on MIPS64

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

5 years agoEnable IAS for FreeBSD SPARC64.
Brad Smith [Sun, 7 Apr 2019 23:12:31 +0000 (23:12 +0000)]
Enable IAS for FreeBSD SPARC64.

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

5 years ago[clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413
Owen Pan [Sun, 7 Apr 2019 21:05:52 +0000 (21:05 +0000)]
[clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413

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

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

5 years ago[clang-format] Fix Bug 41407
Owen Pan [Sat, 6 Apr 2019 23:10:11 +0000 (23:10 +0000)]
[clang-format] Fix Bug 41407
Differential Revision: https://reviews.llvm.org/D60359

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

5 years ago[clang-format] BreakAfterReturnType ignored on functions with numeric template parameters
Paul Hoad [Sat, 6 Apr 2019 10:13:04 +0000 (10:13 +0000)]
[clang-format] BreakAfterReturnType ignored on functions with numeric template parameters

Summary:
Addresses PR40696 - https://bugs.llvm.org/show_bug.cgi?id=40696

The BreakAfterReturnType didn't work if it had a single arguments which was a template with an integer template parameter

```
int  foo(A<8> a) { return a; }
```

When run with the Mozilla style. would not break after the `int`

```
int TestFn(A<8> a)
{
  return a;
}

```

This revision resolves this issue by allowing numeric constants to be considered function parameters if if seen inside `<>`

Reviewers: djasper, klimek, JonasToth, krasimir, reuk, alexfh

Reviewed By: klimek

Subscribers: cfe-commits, llvm-commits

Tags: #clang-tools-extra

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

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

5 years agoRevert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."
Artem Dergachev [Fri, 5 Apr 2019 22:11:28 +0000 (22:11 +0000)]
Revert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."

This reverts commit r357823.

Was breaking clang-tidy!

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

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

5 years ago[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().
Artem Dergachev [Fri, 5 Apr 2019 21:48:52 +0000 (21:48 +0000)]
[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().

As the unit test demonstrates, subtracting 1 from the offset was unnecessary.

The only user of this function was the plist file emitter (in Static Analyzer
and ARCMigrator). It means that a lot of Static Analyzer's plist arrows
are in fact off by one character. The patch carefully preserves this
completely incorrect behavior and causes no functional change,
i.e. no plist format breakage.

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

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

5 years ago[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.
Artem Dergachev [Fri, 5 Apr 2019 20:18:53 +0000 (20:18 +0000)]
[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.

The idea behind this heuristic is that normally the visitor is there to
inform the user that a certain function may fail to initialize a certain
out-parameter. For system header functions this is usually dictated by the
contract, and it's unlikely that the header function has accidentally
forgot to put the value into the out-parameter; it's more likely
that the user has intentionally skipped the error check.

Warnings on skipped error checks are more like security warnings;
they aren't necessarily useful for all users, and they should instead
be introduced on a per-API basis.

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

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

5 years ago[clang-fuzzer] Include ExternalProject before using it.
Matt Morehouse [Fri, 5 Apr 2019 19:47:17 +0000 (19:47 +0000)]
[clang-fuzzer] Include ExternalProject before using it.

Some versions of CMake require ExternalProject to be included before we
can use ExternalProject_Add.

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

5 years agoFix error in NamedDeclPrinterTest
David Goldman [Fri, 5 Apr 2019 19:17:24 +0000 (19:17 +0000)]
Fix error in NamedDeclPrinterTest

Caused by D56924, shouldn't use raw string literals in macros.

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

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

5 years ago[docs] Fix rst title in clang langext docs. NFCI
Kristina Brooks [Fri, 5 Apr 2019 18:26:43 +0000 (18:26 +0000)]
[docs] Fix rst title in clang langext docs. NFCI

Fix an odd line in LanguageExtensions.rst which
rendered incorrectly due to an underscore being
mixed in with dashes.

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

5 years ago[AMDGPU] rename vi-insts into gfx8-insts
Stanislav Mekhanoshin [Fri, 5 Apr 2019 18:25:00 +0000 (18:25 +0000)]
[AMDGPU] rename vi-insts into gfx8-insts

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

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

5 years ago[CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA...
Evgeny Mankov [Fri, 5 Apr 2019 16:51:10 +0000 (16:51 +0000)]
[CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows" (https://bugs.llvm.org/show_bug.cgi?id=38811).

[IMPORTANT]
With that last fix, CUDA has just started being compiling by clang on Windows after nearly a year and two clang’s major releases (7 and 8).
As long as the last LLVM release, in which clang was compiling CUDA on Windows successfully, was 6.0.1, this fix and two previous have to be included into upcoming 7.1.0 and 8.0.1 releases.

[How to repro]
clang++.exe -x cuda "c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\0_Simple\simplePrintf\simplePrintf.cu" -I"c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\common\inc" --cuda-gpu-arch=sm_50 --cuda-path="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0" -L"c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64" -lcudart.lib  -v

[Output]
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:390:11: error: no matching function for call to '__isinfl'
  return (__isinfl(a) != 0);
          ^~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2662:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __isinfl(long double a))
             ^
In file included from <built-in>:1:
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:438:11: error: no matching function for call to '__isnanl'
  return (__isnanl(a) != 0);
          ^~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2672:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __isnanl(long double a))
             ^
In file included from <built-in>:1:
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:486:11: error: no matching function for call to '__finitel'
  return (__finitel(a) != 0);
          ^~~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2652:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __finitel(long double a))
             ^
3 errors generated when compiling for sm_50.

[Solution]
Add missing long double device functions' declarations. Provide only declarations to prevent any use of long double on the device side, because CUDA does not support long double on the device side.

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

Reviewed by: Artem Belevich

Differential Revision: http://reviews.llvm.org/D60220

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

5 years ago[Tooling] add a Heuristic field indicating that a CompileCommand was guessed.
Sam McCall [Fri, 5 Apr 2019 15:22:20 +0000 (15:22 +0000)]
[Tooling] add a Heuristic field indicating that a CompileCommand was guessed.

Summary:
Use cases:
 - a tool that dumps the heuristic used for each header in a project can
   be used to evaluate changes to the heuristic
 - we want to expose this information to users in clangd as it affects
   accuracy/reliability of editor features
 - express interpolation tests more directly

Reviewers: ilya-biryukov, klimek

Subscribers: ioeric, kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[LibTooling] Add Transformer, a library for source-to-source transformations.
Yitzhak Mandelbaum [Fri, 5 Apr 2019 15:14:05 +0000 (15:14 +0000)]
[LibTooling] Add Transformer, a library for source-to-source transformations.

Summary: Adds a basic version of Transformer, a library supporting the concise specification of clang-based source-to-source transformations.  A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ioeric, ABataev, mgorny, jfb, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[LibTooling] Add "SourceCode" library for functions relating to source-code manipulation.
Yitzhak Mandelbaum [Fri, 5 Apr 2019 14:05:03 +0000 (14:05 +0000)]
[LibTooling] Add "SourceCode" library for functions relating to source-code manipulation.

Summary:
Introduces a utility library in Refactoring/ to collect routines related to
source-code manipulation.  In this change, we move "extended-range" functions
from the FixIt library (in clangTooling) to this new library.

We need to use this functionality in Refactoring/ and cannot access it if it
resides in Tooling/, because that would cause clangToolingRefactor to depend on
clangTooling, which would be a circular dependency.

Reviewers: ilya-biryukov, ioeric

Reviewed By: ilya-biryukov

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[test] Specify an explicit darwin version in a triple in
Alex Lorenz [Fri, 5 Apr 2019 01:48:11 +0000 (01:48 +0000)]
[test] Specify an explicit darwin version in a triple in
`test/Driver/debug-options.c` to ensure that the driver
selects the DWARF 2 version as intended by the test.

Fixes the `test/Driver/debug-options.c` test regression on GreenDragon
on macOS that started failing after r357713.

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

5 years ago[IR] Refactor attribute methods in Function class (NFC)
Evandro Menezes [Thu, 4 Apr 2019 22:40:06 +0000 (22:40 +0000)]
[IR] Refactor attribute methods in Function class (NFC)

Rename the functions that query the optimization kind attributes.

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

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

5 years agoMake SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*
Nico Weber [Thu, 4 Apr 2019 21:06:41 +0000 (21:06 +0000)]
Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*

Requires making the llvm::MemoryBuffer* stored by SourceManager const,
which in turn requires making the accessors for that return const
llvm::MemoryBuffer*s and updating all call sites.

The original motivation for this was to use it and fix the TODO in
CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag
version of createFileID, and since llvm::SourceMgr* hands out a const
llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO
this way actually works, but this seems like a good change on its own
anyways.

No intended behavior change.

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

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

5 years agoSpecial case ObjCPropertyDecl for printing
David Goldman [Thu, 4 Apr 2019 20:13:22 +0000 (20:13 +0000)]
Special case ObjCPropertyDecl for printing

ObjCPropertyDecl should use the category interface as a context similar to what is done for methods.

Previously category methods would be printed as `::property`; now they are printed as `Class::property`.

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

5 years ago[OPENMP]Add codegen for task reduction vars with allocate clause, NFC.
Alexey Bataev [Thu, 4 Apr 2019 18:58:17 +0000 (18:58 +0000)]
[OPENMP]Add codegen for task reduction vars with allocate clause, NFC.

Added test for the task reduction variables with the allocate clause.

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

5 years agoVerify that Android targets generate DWARF 4 by default.
Stephen Hines [Thu, 4 Apr 2019 18:17:46 +0000 (18:17 +0000)]
Verify that Android targets generate DWARF 4 by default.

Summary:
In the future, Android releases will support DWARF 5, but we need to
ensure that older targets only have DWARF 4 generated for them. This
patch inserts that verification for all Android releases now. The patch
also fixes 2 minor mistakes (a mistakenly moved RUN line, and the
missing G_DWARF2 check label).

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: chh, pirama, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Add codegen for linear vars with allocate clause, NFC.
Alexey Bataev [Thu, 4 Apr 2019 18:06:53 +0000 (18:06 +0000)]
[OPENMP]Add codegen for linear vars with allocate clause, NFC.

Added test for the linear variables with the allocate clause.

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

5 years ago[OPENMP]Fix lookup of the user-defined reductions in C.
Alexey Bataev [Thu, 4 Apr 2019 17:28:22 +0000 (17:28 +0000)]
[OPENMP]Fix lookup of the user-defined reductions in C.

Fixed the regression of the lookup of user-defined reductions for C.

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

5 years ago[RISCV] Fix rL357699 by adding missing zero-length files
Alex Bradbury [Thu, 4 Apr 2019 14:36:07 +0000 (14:36 +0000)]
[RISCV] Fix rL357699 by adding missing zero-length files

svn add doesn't play very nicely here...

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

5 years agoUpdating Chromium's Java import order
Nico Weber [Thu, 4 Apr 2019 14:19:45 +0000 (14:19 +0000)]
Updating Chromium's Java import order

Adding in androidx as another import group.

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

Patch from Sam Maier <smaier@chromium.org>!

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

5 years ago[RISCV] Collect library directories and triples for riscv64 triple too
Alex Bradbury [Thu, 4 Apr 2019 14:18:26 +0000 (14:18 +0000)]
[RISCV] Collect library directories and triples for riscv64 triple too

When setting up library and tools paths when detecting an accompanying GCC
installation only riscv32 was handled. As a consequence when targetting
riscv64 neither the linker nor libraries would be found. This adds handling
and tests for riscv64.

Differential Revision: https://reviews.llvm.org/D53392
Patch by Edward Jones.

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

5 years ago[clang-format] Preserve include blocks in ObjC Google style
Krasimir Georgiev [Thu, 4 Apr 2019 14:04:26 +0000 (14:04 +0000)]
[clang-format] Preserve include blocks in ObjC Google style

Summary:
r357567 started to regroup include block for Google style; it was meant to apply
only for C++. This patch reverts this for ObjC.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: thakis, cfe-commits

Tags: #clang

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

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

5 years ago[RISCV][NFC] s/riscv32-linux-unknown-elf/riscv32-unknown-linux-gnu in test/Driver...
Alex Bradbury [Thu, 4 Apr 2019 13:51:41 +0000 (13:51 +0000)]
[RISCV][NFC] s/riscv32-linux-unknown-elf/riscv32-unknown-linux-gnu in test/Driver/riscv32-toolchain.c

riscv32-linux-unknown-elf was a weird thing to test for as it doesn't match
the triple used in any common RISC-V toolchain distributions (e.g.
riscv-gnu-toolchain scripts produce riscv{32,64}-unknown-linux-gnu).

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

5 years ago[CodeComplete] Fix crash when completing ObjC block parameter with a broken type
Sam McCall [Thu, 4 Apr 2019 11:34:18 +0000 (11:34 +0000)]
[CodeComplete] Fix crash when completing ObjC block parameter with a broken type

Summary:
The fix isn't great, but it's hard to fix properly because the completion
code sensibly uses ParmVarDecl to represent parameters, but the AST-building
code sensibly doesn't synthesize them if the type is broken.
Also this case is apparently really rare, so it's probably not worth bending
over backwards for.

Reviewers: ilya-biryukov

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

Tags: #clang

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

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

5 years ago[PR41157][OpenCL] Prevent implicit init of local addr space var in C++ mode.
Anastasia Stulova [Thu, 4 Apr 2019 11:08:51 +0000 (11:08 +0000)]
[PR41157][OpenCL] Prevent implicit init of local addr space var in C++ mode.

Prevent adding initializers implicitly to variables declared in
local address space. This happens when they get converted into
global variables and therefore theoretically have to be default
initialized in C++.

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

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

5 years ago[PR41276] Fixed incorrect generation of addr space cast for 'this' in C++.
Anastasia Stulova [Thu, 4 Apr 2019 10:48:36 +0000 (10:48 +0000)]
[PR41276] Fixed incorrect generation of addr space cast for 'this' in C++.

Improved classification of address space cast when qualification
conversion is performed - prevent adding addr space cast for
non-pointer and non-reference types. Take address space correctly
from the pointee.

Also pass correct address space from 'this' object using
AggValueSlot when generating addrspacecast in the constructor
call.

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

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

5 years agoRevert r357452 - 'SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function...
David L. Jones [Thu, 4 Apr 2019 02:27:57 +0000 (02:27 +0000)]
Revert r357452 - 'SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)'

This revision causes tests to fail under ASAN. Since the cause of the failures
is not clear (could be ASAN, could be a Clang bug, could be a bug in this
revision), the safest course of action seems to be to revert while investigating.

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

5 years agoadd periods
Amy Huang [Wed, 3 Apr 2019 22:19:07 +0000 (22:19 +0000)]
add periods

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

5 years ago[IR] Create new method in `Function` class (NFC)
Evandro Menezes [Wed, 3 Apr 2019 21:27:03 +0000 (21:27 +0000)]
[IR] Create new method in `Function` class (NFC)

Create method `optForNone()` testing for the function level equivalent of
`-O0` and refactor appropriately.

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

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

5 years ago[OPENMP]Add codegen for reduction vars with allocate clause, NFC.
Alexey Bataev [Wed, 3 Apr 2019 19:59:09 +0000 (19:59 +0000)]
[OPENMP]Add codegen for reduction vars with allocate clause, NFC.

Added test for the reduction variables with the allocate clause.

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

5 years ago[OPENMP]Add codegen for lastprivate vars with allocate clause, NFC.
Alexey Bataev [Wed, 3 Apr 2019 19:12:47 +0000 (19:12 +0000)]
[OPENMP]Add codegen for lastprivate vars with allocate clause, NFC.

Added test for the lastprivatized variables with the allocate clause.

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

5 years agoRevert "[analyzer] Toning down invalidation a bit".
Artem Dergachev [Wed, 3 Apr 2019 18:21:16 +0000 (18:21 +0000)]
Revert "[analyzer] Toning down invalidation a bit".

This reverts commit r352473.

The overall idea is great, but it seems to cause unintented consequences
when not only Region Store invalidation but also pointer escape mechanism
was accidentally affected.

Based on discussions in https://reviews.llvm.org/D58121#1452483
and https://reviews.llvm.org/D57230#1434161

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

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

5 years ago[OPENMP]Add codegen for firstprivate vars with allocate clause.
Alexey Bataev [Wed, 3 Apr 2019 17:57:06 +0000 (17:57 +0000)]
[OPENMP]Add codegen for firstprivate vars with allocate clause.

Added codegen/test for the firstprivatized variables with the allocate
clause.

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

5 years agoRevert "[LibTooling] Add Transformer, a library for source-to-source transformations."
Alexey Bataev [Wed, 3 Apr 2019 17:34:04 +0000 (17:34 +0000)]
Revert "[LibTooling] Add Transformer, a library for source-to-source transformations."

This reverts commit r357576 to fix the problem with the cyclic
dependencies between libTooling and libToolingRefactor.

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

5 years agoBug-40323: MS ABI adding template static member in the linker directive section to...
Jennifer Yu [Wed, 3 Apr 2019 17:21:40 +0000 (17:21 +0000)]
Bug-40323: MS ABI adding template static member in the linker directive section to make sure init function can be called before main.

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

5 years ago[clang-format] Do not emit replacements while regrouping if Cpp includes are OK
Krasimir Georgiev [Wed, 3 Apr 2019 15:16:04 +0000 (15:16 +0000)]
[clang-format] Do not emit replacements while regrouping if Cpp includes are OK

Summary:
Currently clang-format would always emit a replacement for multi-block #include
sections if `IBS_Regroup`, even if the sections are correct:
```
% cat ~/test.h
#include <a.h>

#include "b.h"
% bin/clang-format --output-replacements-xml -style=google ~/test.h
<?xml version='1.0'?>
<replacements xml:space='preserve' incomplete_format='false'>
<replacement offset='0' length='30'>#include &lt;a.h>&#10;&#10;#include "b.h"</replacement>
</replacements>
%
```

This change makes clang-format not emit replacements in this case.
The logic is similar to the one implemented for Java in r354452.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoWhitespace and formatting changes; NFC.
Aaron Ballman [Wed, 3 Apr 2019 14:40:00 +0000 (14:40 +0000)]
Whitespace and formatting changes; NFC.

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