]> granicus.if.org Git - clang/log
clang
5 years ago[OPENMP][NVPTX]Emit service debug variable for NVPTX.
Alexey Bataev [Mon, 28 Jan 2019 20:03:02 +0000 (20:03 +0000)]
[OPENMP][NVPTX]Emit service debug variable for NVPTX.

In case of the empty module, the ptxas tool may emit error message about
empty debug info sections. This patch fixes this bug.

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

5 years agoCorrect help text for --unwindlib options.
Sterling Augustine [Mon, 28 Jan 2019 18:56:44 +0000 (18:56 +0000)]
Correct help text for --unwindlib options.

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

5 years agoAdd --unwindlib=[libgcc|compiler-rt] to parallel --rtlib=
Sterling Augustine [Mon, 28 Jan 2019 18:56:43 +0000 (18:56 +0000)]
Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib=

Summary:
"clang++ hello.cc --rtlib=compiler-rt"

now works without specifying additional unwind or exception
handling libraries.

Reviewers: rsmith

Subscribers: srhines, dberris, aheejin, llvm-commits

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

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

5 years agoRevert "[AST] Introduce GenericSelectionExpr::Association"
Bruno Ricci [Mon, 28 Jan 2019 18:40:26 +0000 (18:40 +0000)]
Revert "[AST] Introduce GenericSelectionExpr::Association"

This breaks GCC 4.8.4. Reported by email by Hans Wennborg.

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

5 years agoAdd -fapply-global-visibility-to-externs for -cc1
Scott Linder [Mon, 28 Jan 2019 17:12:19 +0000 (17:12 +0000)]
Add -fapply-global-visibility-to-externs for -cc1

Introduce an option to request global visibility settings be applied to
declarations without a definition or an explicit visibility, rather than
the existing behavior of giving these default visibility. When the
visibility of all or most extern definitions are known this allows for
the same optimisations -fvisibility permits without updating source code
to annotate all declarations.

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

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

5 years ago[clang][OpenMP] OMPFlushClause is synthetic, no such clause exists
Roman Lebedev [Mon, 28 Jan 2019 17:04:11 +0000 (17:04 +0000)]
[clang][OpenMP] OMPFlushClause is synthetic, no such clause exists

Summary:
As discussed in https://reviews.llvm.org/D57112#inline-506781,
'flush' clause does not exist in the OpenMP spec, it can not be
specified, and `OMPFlushClause` class is just a helper class.

Therefore `OPENMP_CLAUSE()` in `clang/Basic/OpenMPKinds.def`
should not contain 'flush' "clause".

I have simply removed the `OPENMP_CLAUSE(flush, OMPFlushClause)`
from `clang/Basic/OpenMPKinds.def`, grepped for `OPENMP_CLAUSE`
and added `OPENMP_CLAUSE(flush, OMPFlushClause)` back to the **every**
place where `OPENMP_CLAUSE` is defined and `clang/Basic/OpenMPKinds.def`
is then included.

So as-is, this patch is a NFC. Possibly, some of these
`OPENMP_CLAUSE(flush, OMPFlushClause)` should be dropped,
i don't really know.

Test plan: `ninja check-clang`

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: guansong, arphaman, cfe-commits

Tags: #openmp

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

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

5 years ago[AST] Introduce GenericSelectionExpr::Association
Bruno Ricci [Mon, 28 Jan 2019 14:18:11 +0000 (14:18 +0000)]
[AST] Introduce GenericSelectionExpr::Association

Introduce a new class GenericSelectionExpr::Association which bundle together
an association expression and its TypeSourceInfo.

An iterator GenericSelectionExpr::AssociationIterator is additionally added to
make it possible to iterate over ranges of Associations. This iterator is a
kind of proxy iterator which abstract over how exactly the expressions and the
TypeSourceInfos are stored.

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

Reviewed By: aaron.ballman

Reviewers: aaron.ballman, steveire, dblaikie, mclow.lists

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

5 years ago[AMDGPU] Add interpolation builtins
Tim Corringham [Mon, 28 Jan 2019 13:50:37 +0000 (13:50 +0000)]
[AMDGPU] Add interpolation builtins

Summary:
Added builtins for the interpolation intrinsics, and related LIT
test.

Reviewers: arsenm, tpr, dstuttard, #amdgpu

Reviewed By: arsenm, #amdgpu

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, cfe-commits

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

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

5 years agoRename getTypeQualifiers to getMethodQualifiers.
Anastasia Stulova [Mon, 28 Jan 2019 11:37:49 +0000 (11:37 +0000)]
Rename getTypeQualifiers to getMethodQualifiers.

Use more descriptive name for the method qualifiers getter.

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

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

5 years ago[AST] Add structural eq tests for template args
Gabor Marton [Mon, 28 Jan 2019 10:01:11 +0000 (10:01 +0000)]
[AST] Add structural eq tests for template args

Summary:
New tests added to verify equivalency of templates when their
parameters are different.

Reviewers: a_sidorin, shafik

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

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

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

5 years ago[X86] Add new variadic avx512 compress/expand intrinsics that use vXi1 types for...
Craig Topper [Mon, 28 Jan 2019 07:03:10 +0000 (07:03 +0000)]
[X86] Add new variadic avx512 compress/expand intrinsics that use vXi1 types for the mask argument.

Custom lower the builtins to these intrinsics. This enables the middle end to optimize out bitcasts for the masks.

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

5 years ago[SemaCXX] Fix ICE with structure bindings to members of template
Nicolas Lesser [Sun, 27 Jan 2019 19:19:59 +0000 (19:19 +0000)]
[SemaCXX] Fix ICE with structure bindings to members of template

Summary:
Trying to use structure binding with a structure that doesn't implement
std::tuple_size, should unpack the data members. When the struct is a
template though, clang might hit an assertion (if the type has not been
completed before), because CXXRecordDecl::DefinitionData is nullptr.

This commit fixes the problem by completing the type while trying to
decompose the structured binding.

The ICE happens in real world code, for example, when trying to iterate
a protobuf generated map with a range-based for loop and structure
bindings (because google::protobuf::MapPair is a template and doesn't
support std::tuple_size).

Reported-by: nicholas.sun@nlsun.com
Patch by Daniele Di Proietto

Reviewers: #clang, rsmith

Reviewed By: #clang, rsmith

Subscribers: cpplearner, Rakete1111, cfe-commits

Tags: #clang

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

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

5 years agoRemove Expr sugar decorating the CXXUuidofExpr node.
Bill Wendling [Sun, 27 Jan 2019 07:24:03 +0000 (07:24 +0000)]
Remove Expr sugar decorating the CXXUuidofExpr node.

Summary: Sugar, like ConstantExpr, causes an infinite expansion of the template object.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: riccibruno, aaron.ballman, cfe-commits, tzik, rnk

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

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

5 years ago[FIX] Adjust CXX microsoft abi dynamic cast test to r352293
Johannes Doerfert [Sun, 27 Jan 2019 00:22:10 +0000 (00:22 +0000)]
[FIX] Adjust CXX microsoft abi dynamic cast test to r352293

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

5 years ago[analyzer] Add CheckerManager::getChecker, make sure that a registry function registe...
Kristof Umann [Sat, 26 Jan 2019 21:41:50 +0000 (21:41 +0000)]
[analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker

This patch effectively fixes the almost decade old checker naming issue.
The solution is to assert when CheckerManager::getChecker is called on an
unregistered checker, and assert when CheckerManager::registerChecker is called
on a checker that is already registered.

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

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

5 years ago[analyzer] Reimplement dependencies between checkers
Kristof Umann [Sat, 26 Jan 2019 20:06:54 +0000 (20:06 +0000)]
[analyzer] Reimplement dependencies between checkers

Unfortunately, up until now, the fact that certain checkers depended on one
another was known, but how these actually unfolded was hidden deep within the
implementation. For example, many checkers (like RetainCount, Malloc or CString)
modelled a certain functionality, and exposed certain reportable bug types to
the user. For example, while MallocChecker models many many different types of
memory handling, the actual "unix.MallocChecker" checker the user was exposed to
was merely and option to this modeling part.

Other than this being an ugly mess, this issue made resolving the checker naming
issue almost impossible. (The checker naming issue being that if a checker
registered more than one checker within its registry function, both checker
object recieved the same name) Also, if the user explicitly disabled a checker
that was a dependency of another that _was_ explicitly enabled, it implicitly,
without "telling" the user, reenabled it.

Clearly, changing this to a well structured, declarative form, where the
handling of dependencies are done on a higher level is very much preferred.

This patch, among the detailed things later, makes checkers declare their
dependencies within the TableGen file Checkers.td, and exposes the same
functionality to plugins and statically linked non-generated checkers through
CheckerRegistry::addDependency. CheckerRegistry now resolves these dependencies,
makes sure that checkers are added to CheckerManager in the correct order,
and makes sure that if a dependency is disabled, so will be every checker that
depends on it.

In detail:

* Add a new field to the Checker class in CheckerBase.td called Dependencies,
which is a list of Checkers.
* Move unix checkers before cplusplus, as there is no forward declaration in
tblgen :/
* Add the following new checkers:
  - StackAddrEscapeBase
  - StackAddrEscapeBase
  - CStringModeling
  - DynamicMemoryModeling (base of the MallocChecker family)
  - IteratorModeling (base of the IteratorChecker family)
  - ValistBase
  - SecuritySyntaxChecker (base of bcmp, bcopy, etc...)
  - NSOrCFErrorDerefChecker (base of NSErrorChecker and  CFErrorChecker)
  - IvarInvalidationModeling (base of IvarInvalidation checker family)
  - RetainCountBase (base of RetainCount and OSObjectRetainCount)
* Clear up and registry functions in MallocChecker, happily remove old FIXMEs.
* Add a new addDependency function to CheckerRegistry.
* Neatly format RUN lines in files I looked at while debugging.

Big thanks to Artem Degrachev for all the guidance through this project!

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

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

5 years ago[analyzer] Fix an bug where statically linked, but not registered checkers weren...
Kristof Umann [Sat, 26 Jan 2019 17:27:40 +0000 (17:27 +0000)]
[analyzer] Fix an bug where statically linked, but not registered checkers weren't recognized

My last patch, D56989, moved the validation of whether a checker exists into
its constructor, but we do support statically linked (and non-plugin) checkers
that were do not have an entry in Checkers.td. However, the handling of this
happens after the creation of the CheckerRegistry object.

This patch fixes this bug by moving even this functionality into
CheckerRegistry's constructor.

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

5 years ago[analyzer][NFC] Keep track of whether enabling a checker was explictly specified...
Kristof Umann [Sat, 26 Jan 2019 16:35:33 +0000 (16:35 +0000)]
[analyzer][NFC] Keep track of whether enabling a checker was explictly specified in command line arguments

I added a new enum to CheckerInfo, so we can easily track whether the check is
explicitly enabled, explicitly disabled, or isn't specified in this regard.
Checkers belonging in the latter category may be implicitly enabled through
dependencies in the followup patch. I also made sure that this is done within
CheckerRegisty's constructor, leading to very significant simplifications in
its query-like methods.

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

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

5 years ago[analyzer][NFC] Supply CheckerRegistry with AnalyzerOptions
Kristof Umann [Sat, 26 Jan 2019 15:59:21 +0000 (15:59 +0000)]
[analyzer][NFC] Supply CheckerRegistry with AnalyzerOptions

Since pretty much all methods of CheckerRegistry has AnalyzerOptions as an
argument, it makes sense to just simply require it in it's constructor.

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

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

5 years ago[analyzer] Split unix.API up to UnixAPIMisuseChecker and UnixAPIPortabilityChecker
Kristof Umann [Sat, 26 Jan 2019 15:56:40 +0000 (15:56 +0000)]
[analyzer] Split unix.API up to UnixAPIMisuseChecker and UnixAPIPortabilityChecker

The actual implementation of unix.API features a dual-checker: two checkers in
one, even though they don't even interact at all. Split them up, as this is a
problem for establishing dependencies.

I added no new code at all, just merely moved it around.

Since the plist files change (and that's a benefit!) this patch isn't NFC.

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

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

5 years ago[analyzer] Supply all checkers with a shouldRegister function
Kristof Umann [Sat, 26 Jan 2019 14:23:08 +0000 (14:23 +0000)]
[analyzer] Supply all checkers with a shouldRegister function

Introduce the boolean ento::shouldRegister##CHECKERNAME(const LangOptions &LO)
function very similarly to ento::register##CHECKERNAME. This will force every
checker to implement this function, but maybe it isn't that bad: I saw a lot of
ObjC or C++ specific checkers that should probably not register themselves based
on some LangOptions (mine too), but they do anyways.

A big benefit of this is that all registry functions now register their checker,
once it is called, registration is guaranteed.

This patch is a part of a greater effort to reinvent checker registration, more
info here: D54438#1315953

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

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

5 years ago[AST] Pack GenericSelectionExpr
Bruno Ricci [Sat, 26 Jan 2019 14:15:10 +0000 (14:15 +0000)]
[AST] Pack GenericSelectionExpr

Store the controlling expression, the association expressions and the
corresponding TypeSourceInfos as trailing objects.

Additionally use the bit-fields of Stmt to store one SourceLocation,
saving one additional pointer. This saves 3 pointers in total per
GenericSelectionExpr.

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

Reviewed By: aaron.ballman

Reviewers: aaron.ballman, steveire

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

5 years ago[AST][NFC] Various cleanups to GenericSelectionExpr
Bruno Ricci [Sat, 26 Jan 2019 13:58:15 +0000 (13:58 +0000)]
[AST][NFC] Various cleanups to GenericSelectionExpr

Various cleanups to GenericSelectionExpr factored out of D57104. In particular:

1. Move the friend declaration to the top.
2. Introduce a constant ResultDependentIndex instead of the magic "-1".
3. clang-format
4. Group the member function together so that they can be removed as one block
   by D57106.

NFC.

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

Reviewed By: aaron.ballman

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

5 years ago[X86] Custom codegen 512-bit cvt(u)qq2tops, cvt(u)qqtopd, and cvt(u)dqtops intrinsics.
Craig Topper [Sat, 26 Jan 2019 02:42:01 +0000 (02:42 +0000)]
[X86] Custom codegen 512-bit cvt(u)qq2tops, cvt(u)qqtopd, and cvt(u)dqtops intrinsics.

Summary:
The 512-bit cvt(u)qq2tops, cvt(u)qqtopd, and cvt(u)dqtops intrinsics all have the possibility of taking an explicit rounding mode argument. If the rounding mode is CUR_DIRECTION we'd like to emit a sitofp/uitofp instruction and a select like we do for 256-bit intrinsics.

For cvt(u)qqtopd and cvt(u)dqtops we do this when the form of the software intrinsics that doesn't take a rounding mode argument is used. This is done by using convertvector in the header with the select builtin. But if the explicit rounding mode form of the intrinsic is used and CUR_DIRECTION is passed, we don't do this. We shouldn't have this inconsistency.

For cvt(u)qqtops nothing is done because we can't use the select builtin in the header without avx512vl. So we need to use custom codegen for this.

Even when the rounding mode isn't CUR_DIRECTION we should also use select in IR for consistency. And it will remove another scalar integer mask from our intrinsics.

To accomplish all of these goals I've taken a slightly unusual approach. I've added two new X86 specific intrinsics for sitofp/uitofp with rounding. These intrinsics are variadic on the input and output type so we only need 2 instead of 6. This avoids the need for a switch to map them in CGBuiltin.cpp. We just need to check signed vs unsigned. I believe other targets also use variadic intrinsics like this.

So if the rounding mode is CUR_DIRECTION we'll use an sitofp/uitofp instruction. Otherwise we'll use one of the new intrinsics. After that we'll emit a select instruction if needed.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

5 years agoAttempt to fix build on Windows with LLVM_ENABLE_PIC=OFF
Nico Weber [Fri, 25 Jan 2019 23:37:57 +0000 (23:37 +0000)]
Attempt to fix build on Windows with LLVM_ENABLE_PIC=OFF

libclang can be built in shared or static mode. On Windows, with
LLVM_ENABLE_PIC=OFF, it was built in neither mode, leading to clients of
libclang (c-index-test, c-arcmt-test) failing to link with it set.

Since PIC isn't really a thing on Windows, build libclang in shared mode when
LLVM_ENABLE_PIC=OFF there. This is also somewhat symmetric with the existing
ENABLE_STATIC a few lines down.

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

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

5 years agoFixed frontend clang tests in windows read-only container
Stella Stamenova [Fri, 25 Jan 2019 23:03:12 +0000 (23:03 +0000)]
Fixed frontend clang tests in windows read-only container

Summary:
When mounting LLVM source into a windows container in read-only mode, certain tests fail. Ideally, we want all these tests to pass so that developers can mount the same source folder into multiple (windows) containers simultaneously, allowing them to build/test the same source code using various different configurations simultaneously.

**Fix**: I've found that when attempting to open a file for writing on windows, if you don't have the correct permissions (trying to open a file for writing in a read-only folder), you get [Access is denied](https://support.microsoft.com/en-us/help/2623670/access-denied-or-other-errors-when-you-access-or-work-with-files-and-f). In llvm, we map this error message to a linux based error, see: https://github.com/llvm-mirror/llvm/blob/master/lib/Support/ErrorHandling.cpp

This is why we see "Permission denied" in our output as opposed to the expected "No such file or directory", thus causing the tests to fail.

I've changed the test locally to instead point to the root drive so that they can successfully bypass the Access is denied error when LLVM is mounted in as a read-only directory. This way, the test operate exactly the same, but we can get around the windows-complications of what error to expect in a read-only directory.

Patch By: justice_adams

Reviewers: rsmith, zturner, MatzeB, stella.stamenova

Reviewed By: stella.stamenova

Subscribers: ormris, cfe-commits

Tags: #clang

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

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

5 years ago[Sema] Improve a -Warray-bounds diagnostic
Erik Pilkington [Fri, 25 Jan 2019 20:52:45 +0000 (20:52 +0000)]
[Sema] Improve a -Warray-bounds diagnostic

Fix a bug where we would compare array sizes with incompatible
element types, and look through explicit casts.

rdar://44800168

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

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

5 years ago[CodeGen] Implement isTriviallyRecursive with StmtVisitor instead of RecursiveASTVisitor
Reid Kleckner [Fri, 25 Jan 2019 19:18:40 +0000 (19:18 +0000)]
[CodeGen] Implement isTriviallyRecursive with StmtVisitor instead of RecursiveASTVisitor

This code doesn't need to traverse types, lambdas, template arguments,
etc to detect trivial recursion. We can do a basic statement traversal
instead. This reduces the time spent compiling CodeGenModule.cpp, the
object file size (mostly reduced debug info), and the final executable
size by a small amount. I measured the exe mostly to check how much of
the overhead is from debug info, object file section headers, etc, vs
actual code.

metric   | before | after | diff
time (s) | 47.4   | 38.5  | -8.9
obj (kb) | 12888  | 12012 | -876
exe (kb) | 86072  | 85996 | -76

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

5 years agoRemove F16 literal support based on Float16 support.
Erich Keane [Fri, 25 Jan 2019 18:36:20 +0000 (18:36 +0000)]
Remove F16 literal support based on Float16 support.

Float16 support was disabled recently on many platforms, however that
commit still allowed literals of Float16 type to work.  This commit
removes those based on the same logic as Float16 disable.

Change-Id: I72243048ae2db3dc47bd3d699843e3edf9c395ea

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

5 years agoFix incorrect indent from r352221
Erich Keane [Fri, 25 Jan 2019 17:39:57 +0000 (17:39 +0000)]
Fix incorrect indent from r352221

Change-Id: I0a7b1443eb6912ef7bea1a4cf2f696fc01726557

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

5 years agoDisable _Float16 for non ARM/SPIR Targets
Erich Keane [Fri, 25 Jan 2019 17:27:57 +0000 (17:27 +0000)]
Disable _Float16 for non ARM/SPIR Targets

As Discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2019-January/129543.html

There are problems exposing the _Float16 type on architectures that
haven't defined the ABI/ISel for the type yet, so we're temporarily
disabling the type and making it opt-in.

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

Change-Id: I5db7366dedf1deb9485adb8948b1deb7e612a736

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

5 years agoAllow 'static' storage specifier on an out-of-line member function template
Erich Keane [Fri, 25 Jan 2019 17:01:42 +0000 (17:01 +0000)]
Allow 'static' storage specifier on an out-of-line member function template
declaration in MSVCCompat mode

Microsoft compiler permits the use of 'static' storage specifier outside
of a class definition if it's on an out-of-line member function template
declaration.

This patch allows 'static' storage specifier on an out-of-line member
function template declaration with a warning in Clang (To be compatible
with Microsoft).

Intel C/C++ compiler allows the 'static' keyword with a warning in
Microsoft mode. GCC allows this with -fpermissive.

Patch By: Manna

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

Change-Id: I97b2d9e9d57cecbcd545d17e2523142a85ca2702

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

5 years ago[NFC][Clang] Add driver tests for sb and predres
Diogo N. Sampaio [Fri, 25 Jan 2019 14:57:22 +0000 (14:57 +0000)]
[NFC][Clang] Add driver tests for sb and predres

Add tests that arguments for enabling/disabling
sb and predres are correctly being or not passed
by the driver.

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

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

5 years agoFix "control reaches end of non-void function" warning. NFCI.
Simon Pilgrim [Fri, 25 Jan 2019 11:36:51 +0000 (11:36 +0000)]
Fix "control reaches end of non-void function" warning. NFCI.

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

5 years agoRevert r352181 as it's breaking the bots
Anton Korobeynikov [Fri, 25 Jan 2019 10:35:35 +0000 (10:35 +0000)]
Revert r352181 as it's breaking the bots

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

5 years agoDisable PIC/PIE for MSP430 target by default.
Anton Korobeynikov [Fri, 25 Jan 2019 09:41:20 +0000 (09:41 +0000)]
Disable PIC/PIE for MSP430 target by default.

Relocatable code generation is meaningless on MSP430, as the platform is too small to use shared libraries.

Patch by Dmitry Mikushev!

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

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

5 years ago[MSP430] Ajust f32/f64 alignment according to MSP430 EABI
Anton Korobeynikov [Fri, 25 Jan 2019 08:51:53 +0000 (08:51 +0000)]
[MSP430] Ajust f32/f64 alignment according to MSP430 EABI

Patch by Kristina Bessonova!

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

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

5 years ago[X86] Remove mask and passthru arguments from vpconflict builtins. Use select in...
Craig Topper [Fri, 25 Jan 2019 07:08:22 +0000 (07:08 +0000)]
[X86] Remove mask and passthru arguments from vpconflict builtins. Use select in IR instead.

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

5 years ago[AArch64] Make the test for rsr and rsr64 stricter
Petr Hosek [Fri, 25 Jan 2019 02:42:30 +0000 (02:42 +0000)]
[AArch64] Make the test for rsr and rsr64 stricter

ACLE specifies that return type for rsr and rsr64 is uint32_t and
uint64_t respectively. D56852 change the return type of rsr64 from
unsigned long to unsigned long long which at least on Linux doesn't
match uint64_t, but the test isn't strict enough to detect that
because compiler implicitly converts unsigned long long to uint64_t,
but it breaks other uses such as printf with PRIx64 type specifier.
This change makes the test stricter enforcing that the return type
of rsr and rsr64 builtins is what is actually specified in ACLE.

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

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

5 years agoRevert "[AArch64] Use LL for 64-bit intrinsic arguments"
Petr Hosek [Fri, 25 Jan 2019 02:16:29 +0000 (02:16 +0000)]
Revert "[AArch64] Use LL for 64-bit intrinsic arguments"

This reverts commit r351740: this broke on platforms where unsigned long
long isn't the same as uint64_t which is what ACLE specifies for the
return value of rsr64.

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

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

5 years ago[analyzer] Port RetainSummaryManager to the new AnyCall interface, decouple ARCMT...
George Karpenkov [Fri, 25 Jan 2019 01:24:04 +0000 (01:24 +0000)]
[analyzer] Port RetainSummaryManager to the new AnyCall interface, decouple ARCMT from the analyzer

rdar://19694750

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

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

5 years ago[analysis] Introduce an AnyCall helper class, for abstraction over different callables
George Karpenkov [Fri, 25 Jan 2019 01:23:51 +0000 (01:23 +0000)]
[analysis] Introduce an AnyCall helper class, for abstraction over different callables

A lot of code, particularly in the analyzer, has to perform a lot of
duplication to handle functions/ObjCMessages/destructors/constructors in
a generic setting.
The analyzer already has a CallEvent helper class abstracting over such
calls, but it's not always suitable, since it's tightly coupled to other
analyzer classes (ExplodedNode, ProgramState, etc.) and it's not always
possible to construct.

This change introduces a very simple, very lightweight helper class to
do simple generic operations over callables.

In future, parts of CallEvent could be changed to use this class to
avoid some duplication.

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

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

5 years ago[AST] Add a method to get a call type from an ObjCMessageExpr
George Karpenkov [Fri, 25 Jan 2019 01:23:37 +0000 (01:23 +0000)]
[AST] Add a method to get a call type from an ObjCMessageExpr

Due to references, expression type does not always correspond to an
expected method return type (e.g. for a method returning int & the
expression type of the call would still be int).
We have a helper method for getting the expected type on CallExpr, but
not on ObjCMessageExpr.

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

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

5 years ago[clang-format] square parens with one token are not Objective-C message sends
Alex Lorenz [Thu, 24 Jan 2019 23:07:58 +0000 (23:07 +0000)]
[clang-format] square parens with one token are not Objective-C message sends

The commit r322690 introduced support for ObjC detection in header files.
Unfortunately some C headers that use designated initializers are now
incorrectly detected as Objective-C.
This commit fixes it by ensuring that `[ token ]` is not annotated as an
Objective-C message send.

rdar://45504376

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

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

5 years ago[clang-cl] Ignore space-separated /AI arguments
Reid Kleckner [Thu, 24 Jan 2019 22:26:51 +0000 (22:26 +0000)]
[clang-cl] Ignore space-separated /AI arguments

The /AI flag is for #using directives, which I don't think we support.
This is consistent with how the /I flag is handled by MSVC.  Add a test
for it.

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

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

5 years ago[WebAssembly] Add WebAssemblyImportModule to pragma-attribute-supported-attributes...
Dan Gohman [Thu, 24 Jan 2019 21:20:03 +0000 (21:20 +0000)]
[WebAssembly] Add WebAssemblyImportModule to pragma-attribute-supported-attributes-list.test

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

5 years ago[WebAssembly] Add an import_module function attribute
Dan Gohman [Thu, 24 Jan 2019 21:08:30 +0000 (21:08 +0000)]
[WebAssembly] Add an import_module function attribute

This adds a C/C++ attribute which corresponds to the LLVM IR wasm-import-module
attribute. It allows code to specify an explicit import module.

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

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

5 years ago[WebAssembly] Add a __wasi__ target macro
Dan Gohman [Thu, 24 Jan 2019 21:05:11 +0000 (21:05 +0000)]
[WebAssembly] Add a __wasi__ target macro

This adds a `__wasi__` macro for the wasi OS, similar to `__linux__` etc. for
other OS's.

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

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

5 years agoAdd a triple to this test so it passes for targets where alignof(double)
Richard Smith [Thu, 24 Jan 2019 20:52:56 +0000 (20:52 +0000)]
Add a triple to this test so it passes for targets where alignof(double)
really should be equal to alignof(float).

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

5 years ago[WebAssembly] Support __float128
Dan Gohman [Thu, 24 Jan 2019 20:33:28 +0000 (20:33 +0000)]
[WebAssembly] Support __float128

This enables support for the "__float128" keyword.

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

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

5 years ago[WebAssembly] Factor commonality between wasm32 and wasm64 in test/Preprocessor/init.c
Dan Gohman [Thu, 24 Jan 2019 20:31:11 +0000 (20:31 +0000)]
[WebAssembly] Factor commonality between wasm32 and wasm64 in test/Preprocessor/init.c

Use the -check-prefixes= feature to merge most of the WEBASSEMBLY32 and
WEBASSEMBLY64 test checks into a shared WEBASSEMBLY test check.

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

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

5 years ago[NFC][clang] Test updates for CreateAlignmentAssumption() changes in D54653
Roman Lebedev [Thu, 24 Jan 2019 19:32:49 +0000 (19:32 +0000)]
[NFC][clang] Test updates for CreateAlignmentAssumption() changes in D54653

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

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

5 years agoAdd a priority field to availability attributes to prioritize explicit
Alex Lorenz [Thu, 24 Jan 2019 19:14:39 +0000 (19:14 +0000)]
Add a priority field to availability attributes to prioritize explicit
attributes from declaration over attributes from '#pragma clang attribute'

Before this commit users had an issue when using #pragma clang attribute with
availability attributes:

The explicit attribute that's specified next to the declaration is not
guaranteed to be preferred over the attribute specified in the pragma.

This commit fixes this by introducing a priority field to the availability
attribute to control how they're merged. Attributes with higher priority are
applied over attributes with lower priority for the same platform. The
implicitly inferred attributes are given the lower priority. This ensures that:

- explicit attributes are preferred over all other attributes.
- implicitly inferred attributes that are inferred from an explicit attribute
  are discarded if there's an explicit attribute or an attribute specified
  using a #pragma for the same platform.
- implicitly inferred attributes that are inferred from an attribute in the
  #pragma are not used if there's an explicit, explicit #pragma, or an
  implicit attribute inferred from an explicit attribute for the declaration.

This is the resulting ranking:

`platform availability > platform availability from pragma > inferred availability > inferred availability from pragma`

rdar://46390243

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

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

5 years ago[FileManager] Revert r347205 to avoid PCH file-descriptor leak.
Sam McCall [Thu, 24 Jan 2019 18:55:24 +0000 (18:55 +0000)]
[FileManager] Revert r347205 to avoid PCH file-descriptor leak.

Summary:
r347205 fixed a bug in FileManager: first calling
getFile(shouldOpen=false) and then getFile(shouldOpen=true) results in
the file not being open.

Unfortunately, some code was (inadvertently?) relying on this bug: when
building with a PCH, the file entries are obtained first by passing
shouldOpen=false, and then later shouldOpen=true, without any intention
of reading them. After r347205, they do get unneccesarily opened.
Aside from extra operations, this means they need to be closed. Normally
files are closed when their contents are read. As these files are never
read, they stay open until clang exits. On platforms with a low
open-files limit (e.g. Mac), this can lead to spurious file-not-found
errors when building large projects with PCH enabled, e.g.
  https://bugs.chromium.org/p/chromium/issues/detail?id=924225

Fixing the callsites to pass shouldOpen=false when the file won't be
read is not quite trivial (that info isn't available at the direct
callsite), and passing shouldOpen=false is a performance regression (it
results in open+fstat pairs being replaced by stat+open).

So an ideal fix is going to be a little risky and we need some fix soon
(especially for the llvm 8 branch).
The problem addressed by r347205 is rare and has only been observed in
clangd. It was present in llvm-7, so we can live with it for now.

Reviewers: bkramer, thakis

Subscribers: ilya-biryukov, ioeric, kadircet, cfe-commits

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

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

5 years agoRevert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of...
Julian Lettner [Thu, 24 Jan 2019 18:04:21 +0000 (18:04 +0000)]
Revert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls"

This reverts commit cea84ab93aeb079a358ab1c8aeba6d9140ef8b47.

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

5 years agoFix failing buildbots
Gabor Marton [Thu, 24 Jan 2019 16:27:21 +0000 (16:27 +0000)]
Fix failing buildbots

Fix remaining unittest errors caused by
__attribute__((no_caller_saved_registers))
Related commit which caused the buildbots to fail:
rL352050

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

5 years agoFix failing buildbots
Gabor Marton [Thu, 24 Jan 2019 15:42:20 +0000 (15:42 +0000)]
Fix failing buildbots

Related commit which caused the buildbots to fail:
rL352050

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

5 years ago[CPU-Dispatch] Make pentium_iii_no_xmm_regs and pentium_iii alias.
Erich Keane [Thu, 24 Jan 2019 15:28:57 +0000 (15:28 +0000)]
[CPU-Dispatch] Make pentium_iii_no_xmm_regs and pentium_iii alias.

I discovered that in ICC (where this list comes from), that the two
pentium_iii versions were actually identical despite the two different
names (despite them implying a difference). Because of this, they ended
up having identical manglings, which obviously caused problems when used
together.

This patch makes pentium_iii_no_xmm_regs an alias for pentium_iii so
that it can still be used, but has the same meaning as ICC. However, we
still prohibit using the two together which is different (albeit better)
behavior.

Change-Id: I4f3c9a47e48490c81525c8a3d23ed4201921b288

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

5 years ago[ASTImporter] Fix inequality of functions with different attributes
Gabor Marton [Thu, 24 Jan 2019 14:47:44 +0000 (14:47 +0000)]
[ASTImporter] Fix inequality of functions with different attributes

Summary:
FunctionType::ExtInfo holds such properties of a function which are needed
mostly for code gen. We should not compare these bits when checking for
structural equivalency.
Checking ExtInfo caused false ODR errors during CTU analysis (of tmux).

Reviewers: a_sidorin, a.sidorin, shafik

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

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

5 years ago[Sema] Don't crash when recovering from a misspelled pseudo destructor call to an...
Bruno Ricci [Thu, 24 Jan 2019 13:52:47 +0000 (13:52 +0000)]
[Sema] Don't crash when recovering from a misspelled pseudo destructor call to an incomplete type.

When attempting to correct a misspelled pseudo destructor call as in:

struct Foo;
void foo(Foo *p) {
  p.~Foo();
}

a call is made in canRecoverDotPseudoDestructorCallsOnPointerObjects
to LookupDestructor without checking that the record has a definition.

This causes an assertion later in LookupSpecialMember which assumes that
the record has a definition.

Patch By Roman Zhikharevich!

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

Reviewed By: riccibruno

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

5 years agoTest commit: fix typo.
Pierre Gousseau [Thu, 24 Jan 2019 11:44:24 +0000 (11:44 +0000)]
Test commit: fix typo.

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

5 years ago[CodeComplete] [clangd] Fix crash on ValueDecl with a null type
Ilya Biryukov [Thu, 24 Jan 2019 10:41:43 +0000 (10:41 +0000)]
[CodeComplete] [clangd] Fix crash on ValueDecl with a null type

Reviewers: kadircet

Reviewed By: kadircet

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

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

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

5 years agoFix python3 compability issue in clang binding
Serge Guelton [Thu, 24 Jan 2019 10:34:44 +0000 (10:34 +0000)]
Fix python3 compability issue in clang binding

The file contents could be of str type. Should use byte length instead
of str length, otherwise utf-8 encoded files may not get properly parsed
for completion.

Source issue: https://github.com/ncm2/ncm2-pyclang#2

Commited on behalf of `roxma'

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

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

5 years agoReland r345009 "[DebugInfo] Generate debug information for labels."
Hsiangkai Wang [Thu, 24 Jan 2019 05:34:29 +0000 (05:34 +0000)]
Reland r345009 "[DebugInfo] Generate debug information for labels."

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.
After fixing problems in LiveDebugVariables.
After fixing NULL symbol problems in AddressPool when enabling
split-dwarf-file.
After fixing PR39094.
After landing D54199 and D54465 to fix Chromium build failed.

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

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

5 years ago[CMake][Fuchsia] Enable hermetic static libc++abi for Fuchsia
Petr Hosek [Thu, 24 Jan 2019 03:24:37 +0000 (03:24 +0000)]
[CMake][Fuchsia] Enable hermetic static libc++abi for Fuchsia

Similarly to libc++, we want to use hermetic static libc++abi.

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

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

5 years agoImprove diagnostic for -fvisibility mismatch between module/PCH build
Richard Smith [Thu, 24 Jan 2019 02:41:46 +0000 (02:41 +0000)]
Improve diagnostic for -fvisibility mismatch between module/PCH build
and use.

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

5 years ago[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn...
Julian Lettner [Thu, 24 Jan 2019 01:06:19 +0000 (01:06 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls

Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every `unreachable` instruction. However,
the optimizer will remove code after calls to functions marked with
`noreturn`. To avoid this UBSan removes `noreturn` from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
`_asan_handle_no_return` before `noreturn` functions. This is important
for functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* `longjmp` (`longjmp` itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the `noreturn` attributes are missing and ASan
cannot unpoison the stack, so it has false positives when stack
unwinding is used.

Changes:
  # UBSan now adds the `expect_noreturn` attribute whenever it removes
    the `noreturn` attribute from a function
  # ASan additionally checks for the presence of this attribute

Generated code:
```
call void @__asan_handle_no_return    // Additionally inserted to avoid false positives
call void @longjmp
call void @__asan_handle_no_return
call void @__ubsan_handle_builtin_unreachable
unreachable
```

The second call to `__asan_handle_no_return` is redundant. This will be
cleaned up in a follow-up patch.

rdar://problem/40723397

Reviewers: delcypher, eugenis

Tags: #sanitizers

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

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

5 years ago[Sema] Fix Modified Type in address_space AttributedType
Leonard Chan [Thu, 24 Jan 2019 00:11:35 +0000 (00:11 +0000)]
[Sema] Fix Modified Type in address_space AttributedType

This is a fix for https://reviews.llvm.org/D51229 where we pass the
address_space qualified type as the modified type of an AttributedType. This
change now instead wraps the AttributedType with either the address_space
qualifier or a DependentAddressSpaceType.

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

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

5 years ago[Documentation] Fix problem in docs/SafeStack.rst introduced in r351976.
Eugene Zelenko [Wed, 23 Jan 2019 20:51:06 +0000 (20:51 +0000)]
[Documentation] Fix problem in docs/SafeStack.rst introduced in r351976.

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

5 years ago[Documentation] Use HTTPS whenever possible
Eugene Zelenko [Wed, 23 Jan 2019 20:39:07 +0000 (20:39 +0000)]
[Documentation] Use HTTPS whenever possible

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

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

5 years agoMerge similar target diagnostics for interrupt attribute into one; NFC
Aaron Ballman [Wed, 23 Jan 2019 18:02:17 +0000 (18:02 +0000)]
Merge similar target diagnostics for interrupt attribute into one; NFC

Patch by Kristina Bessonova!

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

5 years ago[ubsan] Check the correct size when sanitizing array new.
Richard Smith [Wed, 23 Jan 2019 03:37:29 +0000 (03:37 +0000)]
[ubsan] Check the correct size when sanitizing array new.

We previously forgot to multiply the element size by the array bound.

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

5 years ago[Sema][ObjC] Check whether a DelayedDiagnosticPool has been pushed
Akira Hatanaka [Wed, 23 Jan 2019 00:55:48 +0000 (00:55 +0000)]
[Sema][ObjC] Check whether a DelayedDiagnosticPool has been pushed
before adding a delayed diagnostic to DelayedDiagnostics.

This fixes an assertion failure in Sema::DelayedDiagnostics::add that
was caused by the changes made in r141037.

rdar://problem/42782323

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

5 years ago[mips] Replace help-text for '-m{no}-relax-pic-calls'. NFC
Vladimir Stefanovic [Tue, 22 Jan 2019 22:33:53 +0000 (22:33 +0000)]
[mips] Replace help-text for '-m{no}-relax-pic-calls'. NFC

Thanks to Simon Dardis for the new text.

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

5 years ago[analyzer] Insert notes in RetainCountChecker where our dynamic cast modeling assumes...
George Karpenkov [Tue, 22 Jan 2019 19:51:00 +0000 (19:51 +0000)]
[analyzer] Insert notes in RetainCountChecker where our dynamic cast modeling assumes 'null' output

rdar://47397214

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

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

5 years ago[analyzer] Model another special-case kind of cast for OSObject RetainCountChecker
George Karpenkov [Tue, 22 Jan 2019 19:50:47 +0000 (19:50 +0000)]
[analyzer] Model another special-case kind of cast for OSObject RetainCountChecker

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

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

5 years ago[ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl
Raphael Isemann [Tue, 22 Jan 2019 17:59:45 +0000 (17:59 +0000)]
[ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl

Summary:
Shafik found out that importing a CXXConstructorDecl will create a translation unit that
causes Clang's CodeGen to crash. The reason for that is that we don't copy the OperatorDelete
from the CXXConstructorDecl when importing. This patch fixes it and adds a test case for that.

Reviewers: shafik, martong, a_sidorin, a.sidorin

Reviewed By: martong, a_sidorin

Subscribers: rnkovacs, cfe-commits

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

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

5 years agoReleaseNotes: remove openmp notes from r351580
Hans Wennborg [Tue, 22 Jan 2019 17:01:39 +0000 (17:01 +0000)]
ReleaseNotes: remove openmp notes from r351580

They were for the 8.0 branch, and have been committed there in r351839.

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

5 years ago[CodeGen] Always use string computed in Sema for PredefinedExpr
Eli Friedman [Tue, 22 Jan 2019 00:11:17 +0000 (00:11 +0000)]
[CodeGen] Always use string computed in Sema for PredefinedExpr

We can't use any other string, anyway, because its type wouldn't
match the type of the PredefinedExpr.

With this change, we don't compute a "nice" name for the __func__ global
when it's used in the initializer for a constant. This doesn't seem like
a great loss, and I'm not sure how to fix it without either storing more
information in the AST, or somehow threading through the information
from ExprConstant.cpp.

This could break some situations involving BlockDecl; currently,
CodeGenFunction::EmitPredefinedLValue has some logic to intentionally
emit a string different from what Sema computed.  This code skips that
logic... but that logic can't work correctly in general anyway.  (For
example, sizeof(__func__) returns the wrong result.) Hopefully this
doesn't affect practical code.

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

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

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

5 years ago[test] Pass -ccc-install-dir in mac compilation db test
Michal Gorny [Mon, 21 Jan 2019 17:05:43 +0000 (17:05 +0000)]
[test] Pass -ccc-install-dir in mac compilation db test

Pass -ccc-install-dir explicitly as the compilation database code does
not pass argv[0] to getMainExecutable(), while some systems require it
to return the correct path.  Since the relevant code is apparently only
applicable to Darwin, just pass correct -ccc-install-dir to make
the tests pass on *BSD systems.

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

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

5 years agoMark the lambda function pointer conversion operator as noexcept.
Aaron Ballman [Mon, 21 Jan 2019 16:25:08 +0000 (16:25 +0000)]
Mark the lambda function pointer conversion operator as noexcept.

This implements CWG DR 1722 and fixes PR40309. Patch by Ignat Loskutov.

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

5 years agoRegenerating the C++ DR status page from the latest Core issues list.
Aaron Ballman [Mon, 21 Jan 2019 16:21:14 +0000 (16:21 +0000)]
Regenerating the C++ DR status page from the latest Core issues list.

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

5 years ago[OpenCL] Allow address spaces as method qualifiers.
Anastasia Stulova [Mon, 21 Jan 2019 16:01:38 +0000 (16:01 +0000)]
[OpenCL] Allow address spaces as method qualifiers.

Methods can now be qualified with address spaces to prevent
undesirable conversions to generic or to provide custom
implementation to be used if the object is located in certain
memory segments.

This commit extends parsing and standard C++ overloading to
work for an address space of a method (i.e. implicit 'this'
parameter).

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

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

5 years ago[Analyzer] Remove extra blank line from Iterator Checker (test commit)
Adam Balogh [Mon, 21 Jan 2019 15:31:23 +0000 (15:31 +0000)]
[Analyzer] Remove extra blank line from Iterator Checker (test commit)

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

5 years ago[NFC] Fix comparison warning issues by MSVC
Johannes Doerfert [Mon, 21 Jan 2019 14:23:46 +0000 (14:23 +0000)]
[NFC] Fix comparison warning issues by MSVC

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

5 years ago[clang] add tests to ExprMutAnalyzer that reproduced a crash in ASTMatchers
Jonas Toth [Mon, 21 Jan 2019 13:26:18 +0000 (13:26 +0000)]
[clang] add tests to ExprMutAnalyzer that reproduced a crash in ASTMatchers

Summary:
This patch adds two unit-tests that are the result of reducing a crashing TU
when running ExprMutAnalyzer over it. They are added only to ensure the regression
that has been fixed with https://reviews.llvm.org/D56444 don't creep back.

Reviewers: aaron.ballman, sammccall, rsmith, george.karpenkov

Reviewed By: sammccall

Subscribers: baloghadamsoftware, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits

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

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

5 years ago[AArch64] Use LL for 64-bit intrinsic arguments
Sam Parker [Mon, 21 Jan 2019 11:01:05 +0000 (11:01 +0000)]
[AArch64] Use LL for 64-bit intrinsic arguments

The ACLE states that 64-bit crc32, wsr, rsr and rbit operands are
uint64_t so we should have the clang builtin match this description
- which is what we already do for AArch32.

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

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

5 years ago[ASTImporter] Add test for importing anonymous namespaces.
Raphael Isemann [Mon, 21 Jan 2019 10:14:31 +0000 (10:14 +0000)]
[ASTImporter] Add test for importing anonymous namespaces.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

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

5 years agoFix typos throughout the license files that somehow I and my reviewers
Chandler Carruth [Mon, 21 Jan 2019 09:52:34 +0000 (09:52 +0000)]
Fix typos throughout the license files that somehow I and my reviewers
all missed!

Thanks to Alex Bradbury for pointing this out, and the fact that I never
added the intended `legacy` anchor to the developer policy. Add that
anchor too. With hope, this will cause the links to all resolve
successfully.

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

5 years ago[Driver] Don't pass default value to getCompilerRTArgString
Petr Hosek [Mon, 21 Jan 2019 01:34:09 +0000 (01:34 +0000)]
[Driver] Don't pass default value to getCompilerRTArgString

Using static library is already a default.

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

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

5 years ago[CMake][Fuchsia] Drop -DNDEBUG, re-enable modules
Petr Hosek [Mon, 21 Jan 2019 01:06:50 +0000 (01:06 +0000)]
[CMake][Fuchsia] Drop -DNDEBUG, re-enable modules

-DNDEBUG is no longer needed now that we don't enable assertions,
modules should improve build times for the second stage.

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

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

5 years ago[X86] Add missing test cases for some int/fp->fp conversion intrinsics with rounding...
Craig Topper [Sun, 20 Jan 2019 23:49:50 +0000 (23:49 +0000)]
[X86] Add missing test cases for some int/fp->fp conversion intrinsics with rounding mode. Use non-default rounding mode on some tests.

For some reason we were missing tests for several unmasked conversion intrinsics, but had their mask form.

Also use a non-default rounding mode on some tests to provide better coverage for a future patch.

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

5 years agoTentative fix for r351701 and gcc 6.2 build on ubuntu
Serge Guelton [Sun, 20 Jan 2019 23:43:37 +0000 (23:43 +0000)]
Tentative fix for r351701 and gcc 6.2 build on ubuntu

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

5 years agoReplace llvm::isPodLike<...> by llvm::is_trivially_copyable<...>
Serge Guelton [Sun, 20 Jan 2019 21:19:56 +0000 (21:19 +0000)]
Replace llvm::isPodLike<...>  by llvm::is_trivially_copyable<...>

As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the specialization for
isPodLike<std::pair<...>> did not match the expectation of
std::is_trivially_copyable which makes the memcpy optimization invalid.

This patch renames the llvm::isPodLike trait into llvm::is_trivially_copyable.
Unfortunately std::is_trivially_copyable is not portable across compiler / STL
versions. So a portable version is provided too.

Note that the following specialization were invalid:

    std::pair<T0, T1>
    llvm::Optional<T>

Tests have been added to assert that former specialization are respected by the
standard usage of llvm::is_trivially_copyable, and that when a decent version
of std::is_trivially_copyable is available, llvm::is_trivially_copyable is
compared to std::is_trivially_copyable.

As of this patch, llvm::Optional is no longer considered trivially copyable,
even if T is. This is to be fixed in a later patch, as it has impact on a
long-running bug (see r347004)

Note that GCC warns about this UB, but this got silented by https://reviews.llvm.org/D50296.

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

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

5 years ago[X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp...
Craig Topper [Sun, 20 Jan 2019 19:04:56 +0000 (19:04 +0000)]
[X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp and select.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: kristina, cfe-commits

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

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

5 years ago[X86] Replace VPCOM/VPCOMU with generic integer comparisons (clang)
Simon Pilgrim [Sun, 20 Jan 2019 16:40:33 +0000 (16:40 +0000)]
[X86] Replace VPCOM/VPCOMU with generic integer comparisons (clang)

These intrinsics can always be replaced with generic integer comparisons without any regression in codegen, even for -O0/-fast-isel cases.

Noticed while cleaning up vector integer comparison costs for PR40376.

A future commit will remove/autoupgrade the existing VPCOM/VPCOMU llvm intrinsics.

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

5 years ago[FIX] Generalize the expected results for callback clang tests
Johannes Doerfert [Sat, 19 Jan 2019 20:46:10 +0000 (20:46 +0000)]
[FIX] Generalize the expected results for callback clang tests

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

5 years agoUpdate the license mentioned in this documentation.
Chandler Carruth [Sat, 19 Jan 2019 11:48:15 +0000 (11:48 +0000)]
Update the license mentioned in this documentation.

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

5 years ago[ASTDump] NFC: Convert iterative loops to cxx_range_for
Stephen Kelly [Sat, 19 Jan 2019 09:57:59 +0000 (09:57 +0000)]
[ASTDump] NFC: Convert iterative loops to cxx_range_for

This is coming up a lot in reviews. Better just to change them all at
once.

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

5 years ago[ASTDump] NFC: Use `const auto` in cxx_range_for loops
Stephen Kelly [Sat, 19 Jan 2019 09:57:51 +0000 (09:57 +0000)]
[ASTDump] NFC: Use `const auto` in cxx_range_for loops

This is coming up a lot in reviews. Better just to do them all at once.

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