]> granicus.if.org Git - clang/log
clang
6 years agoAdding nocf_check attribute for cf-protection fine tuning
Oren Ben Simhon [Sat, 17 Mar 2018 13:31:35 +0000 (13:31 +0000)]
Adding nocf_check attribute for cf-protection fine tuning

The patch adds nocf_check target independent attribute for disabling checks that were enabled by cf-protection flag.
The attribute can be appertained to functions and function pointers.
Attribute name follows GCC's similar attribute name.

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

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

6 years ago[MS] Fix bug in r327732 with devirtualized complete destructor calls
Reid Kleckner [Fri, 16 Mar 2018 22:20:57 +0000 (22:20 +0000)]
[MS] Fix bug in r327732 with devirtualized complete destructor calls

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

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Mar 2018 21:22:42 +0000 (21:22 +0000)]
[Analysis] 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@327746 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MS] Fix tests after r327738 that only fail with a default Windows target
Reid Kleckner [Fri, 16 Mar 2018 20:53:13 +0000 (20:53 +0000)]
[MS] Fix tests after r327738 that only fail with a default Windows target

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

6 years ago[MS] Commit some changes that were intended to be part of r327738
Reid Kleckner [Fri, 16 Mar 2018 20:37:59 +0000 (20:37 +0000)]
[MS] Commit some changes that were intended to be part of r327738

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

6 years ago[MS] Don't escape MS C++ names with \01
Reid Kleckner [Fri, 16 Mar 2018 20:36:49 +0000 (20:36 +0000)]
[MS] Don't escape MS C++ names with \01

It is not needed after LLVM r327734. Now it will be easier to copy-paste
IR symbol names from Clang.

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

6 years ago[Parser] Remove hard-coded bracket depth limit
Jan Korous [Fri, 16 Mar 2018 20:17:28 +0000 (20:17 +0000)]
[Parser] Remove hard-coded bracket depth limit

The diagnostics produced if assert fails are using proper limit from language definition already.

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

6 years ago[MS] Always use base dtors in place of complete/vbase dtors when possible
Reid Kleckner [Fri, 16 Mar 2018 19:40:50 +0000 (19:40 +0000)]
[MS] Always use base dtors in place of complete/vbase dtors when possible

Summary:
Previously we tried too hard to uphold the fiction that destructor
variants work like they do on Itanium throughout the ABI-neutral parts
of clang. This lead to MS C++ ABI incompatiblities and other bugs. Now,
-mconstructor-aliases will no longer control this ABI detail, and clang
-cc1's LLVM IR output will be this much closer to the clang driver's.

Based on a patch by Zahira Ammarguellat:
  https://reviews.llvm.org/D39063

I've tried to move the logic that Zahira added into MicrosoftCXXABI.cpp.
There is only one ABI-specific detail sticking out, and that is in
CodeGenModule::getAddrOfCXXStructor, where we collapse complete dtors to
base dtors in the MS ABI.

This fixes PR32990.

Reviewers: erichkeane, zahiraam, majnemer, rjmccall

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Fix crashes in RetainCountChecker when underlying region is not a var
George Karpenkov [Fri, 16 Mar 2018 18:16:47 +0000 (18:16 +0000)]
[analyzer] Fix crashes in RetainCountChecker when underlying region is not a var

For other regions, the error message contains a good indication of the
problem, and there, in general, nothing helpful we can print.
Error pointer to the problematic expression seems enough.

rdar://37323555

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

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

6 years ago[docs] ReleaseNotes: document -Wextra-semi changes.
Roman Lebedev [Fri, 16 Mar 2018 18:01:07 +0000 (18:01 +0000)]
[docs] ReleaseNotes: document -Wextra-semi changes.

I should have done it in rL327558 / D43162, but forgot..

I'm not 100% sure about the text, but i don't think
it warrants a whole new differential revision.

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

6 years ago[clang-format] Disallow breaks before ']' in text proto extensions
Krasimir Georgiev [Fri, 16 Mar 2018 15:23:22 +0000 (15:23 +0000)]
[clang-format] Disallow breaks before ']' in text proto extensions

Summary: This disallows patterns like `[ext.name\n]` in text protos.

Subscribers: klimek, cfe-commits

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

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

6 years ago[clang-format] Fix raw string prefix penalty
Krasimir Georgiev [Fri, 16 Mar 2018 14:01:25 +0000 (14:01 +0000)]
[clang-format] Fix raw string prefix penalty

Summary: We weren't penalizing cases where the raw string prefix goes over the column limit.

Subscribers: klimek, cfe-commits

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

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

6 years agoImplement C++ DR727, which permits explicit specializations at class scope.
Richard Smith [Fri, 16 Mar 2018 13:36:56 +0000 (13:36 +0000)]
Implement C++ DR727, which permits explicit specializations at class scope.

More generally, this permits a template to be specialized in any scope in which
it could be defined, so this also supersedes DR44 and DR374 (the latter of
which we previously only implemented in C++11 mode onwards due to unclarity as
to whether it was a DR).

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

6 years agoFix compilation warning introduced in r327654
Mikael Holmen [Fri, 16 Mar 2018 07:27:57 +0000 (07:27 +0000)]
Fix compilation warning introduced in r327654

The compiler complained about

../tools/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:184:15: error: unused variable 'CSI' [-Werror,-Wunused-variable]
    if (auto *CSI = CGF.CapturedStmtInfo) {
              ^
1 error generated.

I don't know this code but it seems like an easy fix so I push it anyway
to get rid of the warning.

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

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Mar 2018 00:37:51 +0000 (00:37 +0000)]
[Analysis] 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@327687 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OPENMP, NVPTX] Improve globalization of the variables captured by value.
Alexey Bataev [Thu, 15 Mar 2018 18:10:54 +0000 (18:10 +0000)]
[OPENMP, NVPTX] Improve globalization of the variables captured by value.

If the variable is captured by value and the corresponding parameter in
the outlined function escapes its declaration context, this parameter
must be globalized. To globalize it we need to get the address of the
original parameter, load the value, store it to the global address and
use this global address instead of the original.

Patch improves globalization for parallel|teams regions + functions in
declare target regions.

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

6 years ago[OPENMP] Codegen for `omp declare target` construct.
Alexey Bataev [Thu, 15 Mar 2018 15:47:20 +0000 (15:47 +0000)]
[OPENMP] Codegen for `omp declare target` construct.

Added initial codegen for device side of declarations inside `omp
declare target` construct + codegen for implicit `declare target`
functions, which are used in the target regions.

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

6 years agoRecommit r326946 after reducing CallArgList memory footprint
Yaxun Liu [Thu, 15 Mar 2018 15:25:19 +0000 (15:25 +0000)]
Recommit r326946 after reducing CallArgList memory footprint

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

6 years ago[AAch64] Tests for ACLE FP16 macros
Sjoerd Meijer [Thu, 15 Mar 2018 13:36:30 +0000 (13:36 +0000)]
[AAch64] Tests for ACLE FP16 macros

This adds some missing tests for the AArch64 FP16 macros.

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

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

6 years agoMore warnings when double truncation to float: compound assignment is supported now.
Andrew V. Tischenko [Thu, 15 Mar 2018 10:03:35 +0000 (10:03 +0000)]
More warnings when double truncation to float: compound assignment is supported now.

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

6 years agoRefactoring code around move/copy initialization. NFC.
Richard Trieu [Thu, 15 Mar 2018 03:00:55 +0000 (03:00 +0000)]
Refactoring code around move/copy initialization.  NFC.

Use an enum parameter instead of a bool for more control on how the copy elision
functions work.  Extract the move initialization code from the move or copy
initialization block.

Patch by: Arthur O'Dwyer

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

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

6 years ago[CFG] Allow CallExpr's to be looked up in CFG's
Richard Trieu [Thu, 15 Mar 2018 00:09:26 +0000 (00:09 +0000)]
[CFG] Allow CallExpr's to be looked up in CFG's

r327343 changed the handling for CallExpr in a CFG, which prevented lookups for
CallExpr while other Stmt kinds still worked.  This change carries over the
necessary bits from Stmt function to CallExpr function.

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

6 years ago[analyzer] Explicitly set an -std level for the analyzer test.
George Karpenkov [Wed, 14 Mar 2018 23:50:18 +0000 (23:50 +0000)]
[analyzer] Explicitly set an -std level for the analyzer test.

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

6 years agoRemove test deep-ast-tree.cpp
Yaxun Liu [Wed, 14 Mar 2018 21:40:55 +0000 (21:40 +0000)]
Remove test deep-ast-tree.cpp

Since there is no reliable way to change the AST depth of this test by supported stack size
of the test environment, remove this test for now.

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

6 years ago[Tooling] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 14 Mar 2018 21:05:51 +0000 (21:05 +0000)]
[Tooling] 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@327573 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReduce AST depth for test deep-ast-tree.cpp for atom
Yaxun Liu [Wed, 14 Mar 2018 20:41:05 +0000 (20:41 +0000)]
Reduce AST depth for test deep-ast-tree.cpp for atom

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

6 years ago[Parser] (C++) Make -Wextra-semi slightly more useful
Roman Lebedev [Wed, 14 Mar 2018 19:31:34 +0000 (19:31 +0000)]
[Parser] (C++) Make -Wextra-semi slightly more useful

Summary:
Let's suppose the `-Weverything` is passed.

Given code like
```
void F() {}
;
```
If the code is compiled with `-std=c++03`, it would diagnose that extra sema:
```
<source>:2:1: warning: extra ';' outside of a function is a C++11 extension [-Wc++11-extra-semi]
;
^~
```
If the code is compiled with `-std=c++11`, it also would diagnose that extra sema:
```
<source>:2:1: warning: extra ';' outside of a function is incompatible with C++98 [-Wc++98-compat-pedantic]
;
^~
```

But, let's suppose the C++11 or higher is used, and the used does not care
about `-Wc++98-compat-pedantic`, so he disables that diagnostic.
And that silences the complaint about extra `;` too.
And there is no way to re-enable that particular diagnostic, passing `-Wextra-semi` does nothing...

Now, there is also a related `no newline at end of file` diagnostic, which is also emitted by `-Wc++98-compat-pedantic`
```
<source>:2:2: warning: C++98 requires newline at end of file [-Wc++98-compat-pedantic]
;
 ^
```
But unlike the previous case, if `-Wno-c++98-compat-pedantic` is passed, that diagnostic stays displayed:
```
<source>:2:2: warning: no newline at end of file [-Wnewline-eof]
;
 ^
```

This diff refactors the code so `-Wc++98-compat-extra-semi` can be re-enabled, after the `-Wc++98-compat-pedantic` was disabled.
This seems ugly, but there does not seem to be any saner way.

Testing: `$ ninja check-clang`

Reviewers: rsmith, rtrieu, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: jordan_rose, cfe-commits

Tags: #clang

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

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

6 years agoAttempt to fix failure of deep-ast-tree.cpp on atom and s390
Yaxun Liu [Wed, 14 Mar 2018 18:24:38 +0000 (18:24 +0000)]
Attempt to fix failure of deep-ast-tree.cpp on atom and s390

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

6 years agoUpdate DR script to mark Clang 6 as 'done' not 'svn'.
Richard Smith [Wed, 14 Mar 2018 18:20:45 +0000 (18:20 +0000)]
Update DR script to mark Clang 6 as 'done' not 'svn'.

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

6 years ago[www] Update C++ DR status to match latest issues list.
Richard Smith [Wed, 14 Mar 2018 18:19:41 +0000 (18:19 +0000)]
[www] Update C++ DR status to match latest issues list.

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

6 years agoSet dso_local for NSConcreteStackBlock.
Rafael Espindola [Wed, 14 Mar 2018 18:19:26 +0000 (18:19 +0000)]
Set dso_local for NSConcreteStackBlock.

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

6 years agoSet dso_local on external rtti GVs.
Rafael Espindola [Wed, 14 Mar 2018 18:14:46 +0000 (18:14 +0000)]
Set dso_local on external rtti GVs.

In this particular case it would be possible to just add an else with
CGM.setDSOLocal(GV), but it seems better to have as many callers as
possible just call setGVProperties so that we can centralize the logic
there.

This patch then makes setGVProperties able to handle null Decls.

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

6 years ago[CMake] Properly quote string arguments to quiet errors from r327528 when built
Frederich Munch [Wed, 14 Mar 2018 16:56:02 +0000 (16:56 +0000)]
[CMake] Properly quote string arguments to quiet errors from r327528 when built
with LLVM_ENABLE_EH and LLVM_ENABLE_RTTI.

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

6 years agoAttempt to fix failure of deep-ast-tree.cpp on ppc64 and atom
Yaxun Liu [Wed, 14 Mar 2018 16:47:49 +0000 (16:47 +0000)]
Attempt to fix failure of deep-ast-tree.cpp on ppc64 and atom

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

6 years agoExpand clang-interpreter with example of throwing in and from the JIT for Windows64.
Frederich Munch [Wed, 14 Mar 2018 16:04:45 +0000 (16:04 +0000)]
Expand clang-interpreter with example of throwing in and from the JIT for Windows64.

Summary:
Getting this to work is not particularly obvious, and having it as an example should be helpful.
Portions of this could be placed into LLVM, but as a whole it seems necessary to do this a higher level.

Reviewers: lhames, mehdi_amini

Reviewed By: lhames

Subscribers: mgrang, martell, cfe-commits, mgorny

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

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

6 years agoAdd deep AST tree test for r327515
Yaxun Liu [Wed, 14 Mar 2018 15:03:31 +0000 (15:03 +0000)]
Add deep AST tree test for r327515

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

6 years agoCodeGen: Reduce LValue and CallArgList memory footprint before recommitting r326946
Yaxun Liu [Wed, 14 Mar 2018 15:02:28 +0000 (15:02 +0000)]
CodeGen: Reduce LValue and CallArgList memory footprint before recommitting r326946

Recent change r326946 (https://reviews.llvm.org/D34367) causes regression in Eigen due to increased
memory footprint of CallArg.

This patch reduces LValue size from 112 to 96 bytes and reduces inline argument count of CallArgList
from 16 to 8.

It has been verified that this will let the added deep AST tree test pass with r326946.

In the long run, CallArg or LValue memory footprint should be further optimized.

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

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

6 years ago[OpenMP] Add OpenMP data sharing infrastructure using global memory
Gheorghe-Teodor Bercea [Wed, 14 Mar 2018 14:17:45 +0000 (14:17 +0000)]
[OpenMP] Add OpenMP data sharing infrastructure using global memory

Summary:
This patch handles the Clang code generation phase for the OpenMP data sharing infrastructure.

TODO: add a more detailed description.

Reviewers: ABataev, carlo.bertolli, caomhin, hfinkel, Hahnfeld

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

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

6 years ago[Sema] Pop function scope when instantiating a func with skipped body
Ilya Biryukov [Wed, 14 Mar 2018 13:18:30 +0000 (13:18 +0000)]
[Sema] Pop function scope when instantiating a func with skipped body

Summary:
By calling ActOnFinishFunctionBody(). Previously we were only calling
ActOnSkippedFunctionBody, which didn't pop the function scope.
This causes a crash when running on our internal code. No test-case,
though, since I couldn't come up with a small example in reasonable
time.

The bug was introduced in r321174.

Reviewers: bkramer, sammccall, sepavloff, aaron.ballman

Reviewed By: sammccall, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

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

6 years agoStaticAnalyzer: fix compiler warning. NFC
Pavel Labath [Wed, 14 Mar 2018 10:16:40 +0000 (10:16 +0000)]
StaticAnalyzer: fix compiler warning. NFC

My compiler (clang-3.8) complains that the RCC variable is unused.
That's not really true, as it's checked by the if-declaration, but it's
also kinda true, because we don't need to declaration if we only check
it in the if statement.

In reality, all this means that the dyn_cast<> can be replaced by isa<>,
so that's what I do here.

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

6 years ago[hwasan] update docs
Kostya Serebryany [Wed, 14 Mar 2018 01:55:49 +0000 (01:55 +0000)]
[hwasan] update docs

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

6 years agoCheck that a field is not annotated with attribute "unavailable" before
Akira Hatanaka [Tue, 13 Mar 2018 23:37:51 +0000 (23:37 +0000)]
Check that a field is not annotated with attribute "unavailable" before
setting the NonTrivialToPrimitive* flags of a record.

Union fields that have non-trivial Objective-C ownership qualifications
are normally not legal, but if the union is declared in a system header,
the fields are annotated with attribute "unavailable".

rdar://problem/38431072

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

6 years ago[OpenMP] Add flag for linking runtime bitcode library
Gheorghe-Teodor Bercea [Tue, 13 Mar 2018 23:19:52 +0000 (23:19 +0000)]
[OpenMP] Add flag for linking runtime bitcode library

Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode.

Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel

Reviewed By: ABataev, grokos

Subscribers: jholewinski, guansong, cfe-commits

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

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

6 years ago[Attr] Merge two dependent tests from different directories
Joel E. Denny [Tue, 13 Mar 2018 22:18:29 +0000 (22:18 +0000)]
[Attr] Merge two dependent tests from different directories

Suggested at: https://reviews.llvm.org/D43248

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

6 years ago[ARM] ACLE FP16 feature test macros
Sjoerd Meijer [Tue, 13 Mar 2018 22:11:06 +0000 (22:11 +0000)]
[ARM] ACLE FP16 feature test macros

This is a partial recommit of r327189 that was reverted
due to test issues. I.e., this recommits minimal functional
change, the FP16 feature test macros, and adds tests that
were missing in the original commit.

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

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Tue, 13 Mar 2018 21:32:01 +0000 (21:32 +0000)]
[Analysis] 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@327453 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert revision 327438.
Gheorghe-Teodor Bercea [Tue, 13 Mar 2018 20:50:12 +0000 (20:50 +0000)]
Revert revision 327438.

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

6 years ago[OpenMP] Add flag for linking runtime bitcode library
Gheorghe-Teodor Bercea [Tue, 13 Mar 2018 19:39:19 +0000 (19:39 +0000)]
[OpenMP] Add flag for linking runtime bitcode library

Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode.

Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel

Reviewed By: ABataev, grokos

Subscribers: jholewinski, guansong, cfe-commits

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

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

6 years agoThis reverts "r327189 - [ARM] Add ARMv8.2-A FP16 vector intrinsic"
Sjoerd Meijer [Tue, 13 Mar 2018 19:38:56 +0000 (19:38 +0000)]
This reverts "r327189 - [ARM] Add ARMv8.2-A FP16 vector intrinsic"

This is causing problems in testing, and PR36683 was raised.
Reverting it until we have sorted out how to pass f16 vectors.

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

6 years agoSerialize the NonTrivialToPrimitive* flags I added in r326307.
Akira Hatanaka [Tue, 13 Mar 2018 18:58:25 +0000 (18:58 +0000)]
Serialize the NonTrivialToPrimitive* flags I added in r326307.

rdar://problem/38421774

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

6 years ago[analyzer] Fix the matcher for GCDAntipattern to look for "signal" call in all parameters
George Karpenkov [Tue, 13 Mar 2018 17:27:01 +0000 (17:27 +0000)]
[analyzer] Fix the matcher for GCDAntipattern to look for "signal" call in all parameters

rdar://38405904

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

6 years agoReland "[Attr] Fix parameter indexing for several attributes"
Joel E. Denny [Tue, 13 Mar 2018 14:51:22 +0000 (14:51 +0000)]
Reland "[Attr] Fix parameter indexing for several attributes"

Relands r326602 (reverted in r326862) with new test and fix for
PR36620.

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

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

6 years ago[Hexagon] Clang side of r327302 in LLVM
Krzysztof Parzyszek [Tue, 13 Mar 2018 13:30:43 +0000 (13:30 +0000)]
[Hexagon] Clang side of r327302 in LLVM

Add option -m[no-]packets to control generation of instruction packets
(enabled by default).

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

6 years agoclang-import-test: fix build with clang-3.8
Pavel Labath [Tue, 13 Mar 2018 11:28:27 +0000 (11:28 +0000)]
clang-import-test: fix build with clang-3.8

clang-3.8 complains that constructor for '...' must explicitly
initialize the const object. Newer clangs and gcc seem to be fine with
this, but explicitly initializing the variable does not hurt.

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

6 years agoAdd missing "env" so that test added in r327322 passes on Windows bots.
Douglas Yung [Tue, 13 Mar 2018 00:41:44 +0000 (00:41 +0000)]
Add missing "env" so that test added in r327322 passes on Windows bots.

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

6 years ago[CFG] [analyzer] Don't add construction context to a return-by-reference call.
Artem Dergachev [Mon, 12 Mar 2018 23:52:36 +0000 (23:52 +0000)]
[CFG] [analyzer] Don't add construction context to a return-by-reference call.

Call expressions that return objects by an lvalue reference or an rvalue
reference have a value type in the AST but wear an auxiliary flag of being an
lvalue or an xvalue respectively.

Use the helper method for obtaining the actual return type of the function.

Fixes a crash.

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

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

6 years ago[analyzer] Support temporaries conjured by conservatively evaluated functions.
Artem Dergachev [Mon, 12 Mar 2018 23:36:12 +0000 (23:36 +0000)]
[analyzer] Support temporaries conjured by conservatively evaluated functions.

Properly perform destruction and lifetime extension of such temporaries.

C++ object-type return values of conservatively evaluated functions are now
represented as compound values of well-defined temporary object regions. The
function creates a region that represents the temporary object and will later
be used for destruction or materialization, invalidates it, and returns the
invalidated compound value of the object.

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

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

6 years ago[analyzer] NFC: Move the code for setting temp object lifetime into method.
Artem Dergachev [Mon, 12 Mar 2018 23:27:52 +0000 (23:27 +0000)]
[analyzer] NFC: Move the code for setting temp object lifetime into method.

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

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

6 years ago[analyzer] Destroy and lifetime-extend inlined function return values properly.
Artem Dergachev [Mon, 12 Mar 2018 23:22:35 +0000 (23:22 +0000)]
[analyzer] Destroy and lifetime-extend inlined function return values properly.

This patch uses the newly added CFGCXXRecordTypedCall element at the call site
of the caller to construct the return value within the callee directly into the
caller's stack frame. This way it is also capable of populating the temporary
destructor and lifetime extension maps for the temporary, which allows
temporary destructors and lifetime extension to work correctly.

This patch does not affect temporaries that were returned from conservatively
evaluated functions.

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

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

6 years ago[CFG] [analyzer] Add construction context to C++ return-by-value call elements.
Artem Dergachev [Mon, 12 Mar 2018 23:12:40 +0000 (23:12 +0000)]
[CFG] [analyzer] Add construction context to C++ return-by-value call elements.

This patch adds a new CFGStmt sub-class, CFGCXXRecordTypedCall, which replaces
the regular CFGStmt for the respective CallExpr whenever the CFG has additional
information to provide regarding the lifetime of the returned value.

This additional call site information is represented by a ConstructionContext
(which was previously used for CFGConstructor elements) that provides references
to CXXBindTemporaryExpr and MaterializeTemporaryExpr that surround the call.

This corresponds to the common C++ calling convention solution of providing
the target address for constructing the return value as an auxiliary implicit
argument during function call.

One of the use cases for such extra context at the call site would be to perform
any sort of inter-procedural analysis over the CFG that involves functions
returning objects by value. In this case the elidable constructor at the return
site would construct the object explained by the context at the call site, and
its lifetime would also be managed by the caller, not the callee.

The extra context would also be useful for properly handling the return-value
temporary at the call site, even if the callee is not being analyzed
inter-procedurally.

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

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

6 years agoRe-land "[Sema] Make getCurFunction() return null outside function parsing"
Reid Kleckner [Mon, 12 Mar 2018 21:43:02 +0000 (21:43 +0000)]
Re-land "[Sema] Make getCurFunction() return null outside function parsing"

This relands r326965.

There was a null dereference in typo correction that was triggered in
Sema/diagnose_if.c. We are not always in a function scope when doing
typo correction. The fix is to add a null check.

LLVM's optimizer made it hard to find this bug. I wrote it up in a
not-very-well-editted blog post here:
http://qinsb.blogspot.com/2018/03/ub-will-delete-your-null-checks.html

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

6 years ago[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing
Alex Lorenz [Mon, 12 Mar 2018 19:36:29 +0000 (19:36 +0000)]
[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing

This ensures that diagnostics are not remapped to incorrect preamble locations after
the second reparse with a remapped header file occurs.

rdar://37502480

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

6 years agoCheck that ubsan is the only supported sanitizer on OpenBSD
Vedant Kumar [Mon, 12 Mar 2018 19:18:51 +0000 (19:18 +0000)]
Check that ubsan is the only supported sanitizer on OpenBSD

Patch by David Carlier!

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

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

6 years ago[Driver] Add text description of --help-hidden so it is shown in help
Jan Korous [Mon, 12 Mar 2018 18:33:55 +0000 (18:33 +0000)]
[Driver] Add text description of --help-hidden so it is shown in help

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

6 years ago[analyzer] Move the GCDAsyncSemaphoreChecker to optin.performance
George Karpenkov [Mon, 12 Mar 2018 18:27:36 +0000 (18:27 +0000)]
[analyzer] Move the GCDAsyncSemaphoreChecker to optin.performance

rdar://38383753

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

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

6 years agoRevert "[ObjC] Allow declaring __weak pointer fields in C structs in
Akira Hatanaka [Mon, 12 Mar 2018 17:05:06 +0000 (17:05 +0000)]
Revert "[ObjC] Allow declaring __weak pointer fields in C structs in
ARC."

This reverts commit r327206 as there were test failures caused by this
patch.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180312/221427.html

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

6 years ago[clang-format] Improve detection of Objective-C block types
Ben Hamilton [Mon, 12 Mar 2018 15:42:40 +0000 (15:42 +0000)]
[clang-format] Improve detection of Objective-C block types

Summary:
Previously, clang-format would detect the following as an
Objective-C block type:

  FOO(^);

when it actually must be a C or C++ macro dealing with an XOR
statement or an XOR operator overload.

According to the Clang Block Language Spec:

https://clang.llvm.org/docs/BlockLanguageSpec.html

block types are of the form:

  int (^)(char, float)

and block variables of block type are of the form:

  void (^blockReturningVoidWithVoidArgument)(void);
  int (^blockReturningIntWithIntAndCharArguments)(int, char);
  void (^arrayOfTenBlocksReturningVoidWithIntArgument[10])(int);

This tightens up the detection so we don't unnecessarily detect
C macros which pass in the XOR operator.

Depends On D43904

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

Reviewers: krasimir, jolesiak, djasper

Reviewed By: djasper

Subscribers: djasper, cfe-commits, klimek

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

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

6 years ago[clang-format] Don't detect C++11 attribute specifiers as ObjC
Ben Hamilton [Mon, 12 Mar 2018 15:42:38 +0000 (15:42 +0000)]
[clang-format] Don't detect C++11 attribute specifiers as ObjC

Summary:
Previously, clang-format would detect C++11 and C++17 attribute
specifiers like the following as Objective-C method invocations:

  [[noreturn]];
  [[clang::fallthrough]];
  [[noreturn, deprecated("so sorry")]];
  [[using gsl: suppress("type")]];

To fix this, I ported part of the logic from
tools/clang/lib/Parse/ParseTentative.cpp into TokenAnnotator.cpp so we
can explicitly parse and identify C++11 attribute specifiers.

This allows the guessLanguage() and getStyle() APIs to correctly
guess files containing the C++11 attribute specifiers as C++,
not Objective-C.

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

Reviewers: krasimir, jolesiak, djasper

Reviewed By: djasper

Subscribers: aaron.ballman, cfe-commits, klimek

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

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

6 years ago[analyzer] Trying to fix Windows buildbots after r327258
Maxim Ostapenko [Mon, 12 Mar 2018 13:44:19 +0000 (13:44 +0000)]
[analyzer] Trying to fix Windows buildbots after r327258

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

6 years agoUpdate the supported C language standards in the user manual.
Aaron Ballman [Mon, 12 Mar 2018 13:09:13 +0000 (13:09 +0000)]
Update the supported C language standards in the user manual.

Remove mention of -std=c94 (it is spelled iso9899:1994, not c94) and add mention of -std=c17 and -std=gnu17.

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

6 years ago[analyzer] Trying to fix buildbots after r327258
Maxim Ostapenko [Mon, 12 Mar 2018 13:07:54 +0000 (13:07 +0000)]
[analyzer] Trying to fix buildbots after r327258

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

6 years ago[analyzer] Add scope information to CFG
Maxim Ostapenko [Mon, 12 Mar 2018 12:26:15 +0000 (12:26 +0000)]
[analyzer] Add scope information to CFG

This patch adds two new CFG elements CFGScopeBegin and CFGScopeEnd that indicate
when a local scope begins and ends respectively. We use first VarDecl declared
in a scope to uniquely identify it and add CFGScopeBegin and CFGScopeEnd elements
into corresponding basic blocks.

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

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

6 years agoclang-format: Properly handle implicit string concatenation in text protos
Daniel Jasper [Mon, 12 Mar 2018 10:32:18 +0000 (10:32 +0000)]
clang-format: Properly handle implicit string concatenation in text protos

Three issues to fix:
- char_constants weren't properly treated as string literals
- Prevening the break after "label: " does not make sense in concunction
  with AlwaysBreakBeforeMultilineStrings. It leads to situations where
  clang-format just cannot find a viable format (it must break and yet
  it must not break).
- AlwaysBreakBeforeMultilineStrings should not be on for LK_TextProto in
  Google style.

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

6 years agoDon't re-format raw string literal contents when formatting is disable
Daniel Jasper [Mon, 12 Mar 2018 10:11:30 +0000 (10:11 +0000)]
Don't re-format raw string literal contents when formatting is disable

Not entirely sure this is the best place to put this check, but it fixes
the immediate issue.

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

6 years ago[Driver] Update the comment about incompatible sanitizers
Petr Hosek [Mon, 12 Mar 2018 00:23:37 +0000 (00:23 +0000)]
[Driver] Update the comment about incompatible sanitizers

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

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

6 years ago[CodeGen] Eagerly emit lifetime.end markers for calls
George Burgess IV [Sat, 10 Mar 2018 23:06:31 +0000 (23:06 +0000)]
[CodeGen] Eagerly emit lifetime.end markers for calls

In C, we'll wait until the end of the scope to clean up aggregate
temporaries used for returns from calls. This means in cases like:

{
  // Assuming that `Bar` is large enough to warrant indirect returns
  struct Bar b = {};
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
}

...We'll allocate space for 5 Bars on the stack (`b`, and 4
temporaries). This becomes painful in things like large switch
statements.

If cleaning up sooner is trivial, we should do it.

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

6 years ago[ObjC] Allow declaring __weak pointer fields in C structs in ARC.
Akira Hatanaka [Sat, 10 Mar 2018 06:36:08 +0000 (06:36 +0000)]
[ObjC] Allow declaring __weak pointer fields in C structs in ARC.

This patch uses the infrastructure added in r326307 for enabling
non-trivial fields to be declared in C structs to allow __weak fields in
C structs in ARC.

rdar://problem/33599681

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

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

6 years ago[Driver] Pass Default=false to hasFlag.
Akira Hatanaka [Sat, 10 Mar 2018 05:55:21 +0000 (05:55 +0000)]
[Driver] Pass Default=false to hasFlag.

I forgot to do this in r326530.

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

6 years agoRevert r326946. It caused stack overflows by significantly increasing the size of...
Richard Smith [Sat, 10 Mar 2018 01:47:22 +0000 (01:47 +0000)]
Revert r326946. It caused stack overflows by significantly increasing the size of a CallArgList.

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

6 years ago[CodeGen] Try to not call a dtor after lifetime.end
George Burgess IV [Sat, 10 Mar 2018 01:11:17 +0000 (01:11 +0000)]
[CodeGen] Try to not call a dtor after lifetime.end

If CodeGenFunction::EmitCall is:
- asked to emit a call with an indirectly returned value,
- given an invalid return value slot, and
- told the return value of the function it's calling is unused

then it'll make its own temporary, and add lifetime markers so that the
temporary's lifetime ends immediately after the call.

The early lifetime.end becomes problematic when we need to run a
destructor on the result of the function.

Instead of unconditionally saying that results of all calls are used
here (which would be correct, but would also cause us to never emit
lifetime markers for these temporaries), we just build our own temporary
to pass in when a dtor has to be run.

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

6 years ago[ARM] Add ARMv8.2-A FP16 vector intrinsic
Abderrazek Zaafrani [Fri, 9 Mar 2018 23:39:34 +0000 (23:39 +0000)]
[ARM] Add ARMv8.2-A FP16 vector intrinsic

Add the fp16 neon vector intrinsic for ARM as described in the ARM ACLE document.

Reviews in https://reviews.llvm.org/D43650

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

6 years agotest: repair windows build after SVN r327105
Saleem Abdulrasool [Fri, 9 Mar 2018 23:00:29 +0000 (23:00 +0000)]
test: repair windows build after SVN r327105

Thanks to Nico Weber for pointing out the failure.  Add an explicit
target for the test.

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

6 years agoFix Clang test case.
Peter Collingbourne [Fri, 9 Mar 2018 19:37:28 +0000 (19:37 +0000)]
Fix Clang test case.

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

6 years agoDon't use -pie in relocatable link.
Evgeniy Stepanov [Fri, 9 Mar 2018 19:35:16 +0000 (19:35 +0000)]
Don't use -pie in relocatable link.

Summary:
Android, in particular, got PIE enabled by default in r316606. It resulted in
relocatable links passing both -r and -pie to the linker, which is not allowed.

Reviewers: srhines

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Fix the address of the original variable in task reductions.
Alexey Bataev [Fri, 9 Mar 2018 15:20:30 +0000 (15:20 +0000)]
[OPENMP] Fix the address of the original variable in task reductions.

If initialization of the task reductions requires pointer to original
variable, which is stored in the threadprivate storage, we used the
address of this pointer instead.

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

6 years ago[SemaOverload] Fixed crash on code completion
Ilya Biryukov [Fri, 9 Mar 2018 14:43:29 +0000 (14:43 +0000)]
[SemaOverload] Fixed crash on code completion

Summary:
The relevant failing assertion message is:
../tools/clang/lib/Sema/SemaInit.cpp:8411: PerformCopyInitialization(): Assertion `InitE && "No initialization expression?"' failed.

See the added test case for a repro.

Reviewers: bkramer, sammccall, ioeric, hokein

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years agoCodeGen: simplify and validate exception personalities
Saleem Abdulrasool [Fri, 9 Mar 2018 07:06:42 +0000 (07:06 +0000)]
CodeGen: simplify and validate exception personalities

Simplify the dispatching for the personality routines.  This really had
no test coverage previously, so add test coverage for the various cases.
This turns out to be pretty complicated as the various languages and
models interact to change personalities around.

You really should feel bad for the compiler if you are using exceptions.
There is no reason for this type of cruelty.

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

6 years agoPR36645: Go looking for an appropriate array bound when constant-evaluating a
Richard Smith [Fri, 9 Mar 2018 02:00:01 +0000 (02:00 +0000)]
PR36645: Go looking for an appropriate array bound when constant-evaluating a
name of an array object.

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

6 years ago[analyzer] MmapWriteExecChecker: Add support for mprotect().
Artem Dergachev [Fri, 9 Mar 2018 01:47:24 +0000 (01:47 +0000)]
[analyzer] MmapWriteExecChecker: Add support for mprotect().

mprotect() allows setting memory access flags similarly to mmap(),
causing similar security issues if these flags are needlessly broad.

Patch by David Carlier!

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

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

6 years ago[CFG] [analyzer] Add construction context for implicit constructor conversions.
Artem Dergachev [Fri, 9 Mar 2018 01:39:59 +0000 (01:39 +0000)]
[CFG] [analyzer] Add construction context for implicit constructor conversions.

Implicit constructor conversions such as A a = B() are represented by
surrounding the constructor for B() with an ImplicitCastExpr of
CK_ConstructorConversion kind, similarly to how explicit constructor conversions
are surrounded by a CXXFunctionalCastExpr. Support this syntax pattern when
extracting the construction context for the implicit constructor that
performs the conversion.

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

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

6 years ago[DOXYGEN] Fix doxygen and content issues in mmintrin.h
Douglas Yung [Fri, 9 Mar 2018 00:38:51 +0000 (00:38 +0000)]
[DOXYGEN] Fix doxygen and content issues in mmintrin.h

- Fix instruction mappings/listings for various intrinsics

This patch was made by Craig Flores

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

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

6 years agoAdd a debug info testcase for the trvial_abi attribute.
Adrian Prantl [Thu, 8 Mar 2018 23:11:46 +0000 (23:11 +0000)]
Add a debug info testcase for the trvial_abi attribute.

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

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Thu, 8 Mar 2018 22:45:13 +0000 (22:45 +0000)]
[StaticAnalyzer] 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@327074 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
Alexey Bataev [Thu, 8 Mar 2018 15:24:08 +0000 (15:24 +0000)]
[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
using.

We may emit the code in wrong order because of incorrect implementation
of the runtime functions for task reductions. Threadprivate storages may
be initialized after real initialization of the reduction items. Patch
fixes this problem.

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

6 years ago[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings
Krasimir Georgiev [Thu, 8 Mar 2018 11:29:27 +0000 (11:29 +0000)]
[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings

Summary:
This makes the formatter of raw string literals use NestedBlockIndent for
determining the 0 column of the content inside. This makes the formatting use
less horizonal space and fixes a case where two newlines before and after the
raw string prefix were selected instead of a single newline after it:

Before:
```
aaaa = ffff(
    R"pb(
      key: value)pb");
```

After:
```
aaaa = ffff(R"pb(
    key: value)pb");
```

Reviewers: djasper, sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

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

6 years agoPropagate DLLAttr to friend re-declarations of member functions
Stephan Bergmann [Thu, 8 Mar 2018 07:34:40 +0000 (07:34 +0000)]
Propagate DLLAttr to friend re-declarations of member functions

...that have already been constructed (e.g., in inner classes) while parsing the
class definition.  They would otherwise lack any DLLAttr inherited from the
class, which are only set here (called from Sema::CheckCompletedClass) after the
class definition has been parsed completely.

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

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

6 years ago[CodeGen] Emit lifetime.ends in both EH and non-EH blocks
George Burgess IV [Thu, 8 Mar 2018 05:32:30 +0000 (05:32 +0000)]
[CodeGen] Emit lifetime.ends in both EH and non-EH blocks

Before this, we'd only emit lifetime.ends for these temps in
non-exceptional paths. This potentially made our stack larger than it
needed to be for any code that follows an EH cleanup. e.g. in

```
struct Foo { char cs[32]; };

void escape(void *);

struct Bar { ~Bar() { char cs[64]; escape(cs); } };

Foo getFoo();

void baz() {
  Bar b;
  getFoo();
}
```

baz() would require 96 bytes of stack, since the temporary from getFoo()
only had a lifetime.end on the non-exceptional path.

This also makes us keep hold of the Value* returned by
EmitLifetimeStart, so we don't have to remake it later.

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

6 years ago[analyzer] Correctly model iteration through "nil" objects
George Karpenkov [Thu, 8 Mar 2018 02:53:39 +0000 (02:53 +0000)]
[analyzer] Correctly model iteration through "nil" objects

Previously, iteration through nil objects which resulted from
objc-messages being set to nil were modeled incorrectly.

There are a couple of notes about this patch:

In principle, ExprEngineObjC might be left untouched IFF osx.loops
checker is enabled.
I however think that we should not do something
completely incorrect depending on what checkers are left on.
We should evaluate and potentially remove altogether the isConsumedExpr
performance heuristic, as it seems very fragile.

rdar://22205149

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

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

6 years agoFix an unused variable warning; NFC
George Burgess IV [Thu, 8 Mar 2018 02:15:12 +0000 (02:15 +0000)]
Fix an unused variable warning; NFC

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

6 years ago[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.
Eugene Zelenko [Thu, 8 Mar 2018 01:37:39 +0000 (01:37 +0000)]
[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.

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