]> granicus.if.org Git - clang/log
clang
6 years ago[C++17] Disallow lambdas in template parameters (PR33696).
Nicolas Lesser [Thu, 12 Jul 2018 18:45:41 +0000 (18:45 +0000)]
[C++17] Disallow lambdas in template parameters (PR33696).

Summary: This revision disallows lambdas in template parameters, as reported in PR33696.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years ago[Tooling] Make standalone executor support user-provided vfs.
Eric Liu [Thu, 12 Jul 2018 18:32:11 +0000 (18:32 +0000)]
[Tooling] Make standalone executor support user-provided vfs.

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

6 years ago[C++11] Fix warning when dropping cv-qualifiers when assigning to a reference with...
Nicolas Lesser [Thu, 12 Jul 2018 17:43:49 +0000 (17:43 +0000)]
[C++11] Fix warning when dropping cv-qualifiers when assigning to a reference with a braced initializer list

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

6 years agoRevert "[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts"
Bruno Cardoso Lopes [Thu, 12 Jul 2018 17:38:48 +0000 (17:38 +0000)]
Revert "[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts"

This reverts commit f40124d4f05ecf4f880cf4e8f26922d861f705f3 / r336660.

This change shouldn't be affecting `@import` behavior, but turns out it is:
https://ci.swift.org/view/swift-master-next/job/oss-swift-incremental-RA-osx-master-next/2800/consoleFull#-12570166563122a513-f36a-4c87-8ed7-cbc36a1ec144

Working on a reduced testcase for this, reverting in the meantime.

rdar://problem/42102222

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

6 years ago[Tooling] Get working directory properly without assuming real file system.
Eric Liu [Thu, 12 Jul 2018 14:54:25 +0000 (14:54 +0000)]
[Tooling] Get working directory properly without assuming real file system.

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

6 years ago[analyzer][UninitializedObjectChecker] Moved non-member functions out of the anonymou...
Kristof Umann [Thu, 12 Jul 2018 13:13:46 +0000 (13:13 +0000)]
[analyzer][UninitializedObjectChecker] Moved non-member functions out of the anonymous namespace

As the code for the checker grew, it became increasinly difficult to see
whether a function was global or statically defined. In this patch,
anything that isn't a type declaration or definition was moved out of the
anonymous namespace and is marked as static.

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

6 years ago[ASTImporter] Fix infinite recursion on function import with struct definition in...
Gabor Marton [Thu, 12 Jul 2018 11:50:21 +0000 (11:50 +0000)]
[ASTImporter] Fix infinite recursion on function import with struct definition in parameters

Summary:
Importing a function having a struct definition in the parameter list
causes a crash in the importer via infinite recursion. This patch avoids
the crash and reports such functions as not supported. Unit tests make
sure that normal struct definitions inside function bodies work normally
on the other hand and LLDB-like type imports also do.

Reviewers: a.sidorin, martong

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

Patch by Zoltan Gera!

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

6 years ago[ASTImporter] Refactor Decl creation
Gabor Marton [Thu, 12 Jul 2018 09:42:05 +0000 (09:42 +0000)]
[ASTImporter] Refactor Decl creation

Summary:
Generalize the creation of Decl nodes during Import.  With this patch we do the
same things after and before a new AST node is created (::Create) The import
logic should be really simple, we create the node, then we mark that as
imported, then we recursively import the parts for that node and then set them
on that node.  However, the AST is actually a graph, so we have to handle
circles.  If we mark something as imported (`MapImported()`) then we return with
the corresponding `To` decl whenever we want to import that node again, this way
circles are handled.  In order to make this algorithm work we must ensure
things, which are handled in the generic CreateDecl<> template:
* There are no `Import()` calls in between any node creation (::Create)
and the `MapImported()` call.
* Before actually creating an AST node (::Create), we must check if
the Node had been imported already, if yes then return with that one.
One very important case for this is connected to templates: we may
start an import both from the templated decl of a template and from
the template itself.

Now, the virtual `Imported` function is called in `ASTImporter::Impor(Decl *)`,
but only once, when the `Decl` is imported.  One point of this refactor is to
separate responsibilities. The original `Imported()` had 3 responsibilities:
- notify subclasses when an import happened
- register the decl into `ImportedDecls`
- initialise the Decl (set attributes, etc)
Now all of these are in separate functions:
- `Imported`
- `MapImported`
- `InitializeImportedDecl`
I tried to check all the clients, I executed tests for `ExternalASTMerger.cpp`
and some unittests for lldb.

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

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoFix deduction for conversion function templates converting to reference
Richard Smith [Wed, 11 Jul 2018 23:19:41 +0000 (23:19 +0000)]
Fix deduction for conversion function templates converting to reference
types.

We previously tried to use the "parameter is a reference" logic here,
but that doesn't work because it gets P and A backwards. Instead, add
a separate implementation of the "deduced A can be less qualified than
A" rule.

This also exposes that we incorrectly stripped cv-qualifiers from the
referent of A if it was a reference. However, if we don't do that, we
get the wrong results when P is a reference. In an attempt to match
what sanity dictates and what other implementations are doing, we now
remove cv-qualifiers from A and P unless both are reference types. I've
brought this up on the core reflector too, to try to get the standard
fixed.

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

6 years agoos_log: When there are multiple privacy annotations in the format
Akira Hatanaka [Wed, 11 Jul 2018 22:19:14 +0000 (22:19 +0000)]
os_log: When there are multiple privacy annotations in the format
string, choose the strictest one instead of the last.

Also fix an undefined behavior. Move the pointer update to a later point to
avoid adding StringRef::npos to the pointer.

rdar://problem/40706280

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

6 years agoFix determination of whether one set of cvr-qualifiers is compatible
Richard Smith [Wed, 11 Jul 2018 21:07:04 +0000 (21:07 +0000)]
Fix determination of whether one set of cvr-qualifiers is compatible
with another in template argument deduction.

We happened to typically get away with getting this wrong, because the
cases where we'd produce a bogus deduction were caught by the final
"deduced A is compatible with A" check.

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

6 years ago[FileCheck] Add -allow-deprecated-dag-overlap to failing clang tests
Joel E. Denny [Wed, 11 Jul 2018 20:26:20 +0000 (20:26 +0000)]
[FileCheck] Add -allow-deprecated-dag-overlap to failing clang tests

See https://reviews.llvm.org/D47106 for details.

Reviewed By: probinson

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

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

6 years agoFix setting of empty implicit-section-name attribute
Petr Pavlu [Wed, 11 Jul 2018 20:17:54 +0000 (20:17 +0000)]
Fix setting of empty implicit-section-name attribute

Code in `CodeGenModule::SetFunctionAttributes()` could set an empty
attribute `implicit-section-name` on a function that is affected by
`#pragma clang text="section"`. This is incorrect because the attribute
should contain a valid section name. If the function additionally also
used `__attribute__((section("section")))` then this could result in
emitting the function in a section with an empty name.

The patch fixes the issue by removing the problematic code that sets
empty `implicit-section-name` from
`CodeGenModule::SetFunctionAttributes()` because it is sufficient to set
this attribute only from a similar code in `setNonAliasAttributes()`
when the function is emitted.

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

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

6 years ago[NFC] typo
JF Bastien [Wed, 11 Jul 2018 19:51:40 +0000 (19:51 +0000)]
[NFC] typo

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

6 years ago[NFC] Replace usage of QualType.getTypePtr()-> with operator->
Erich Keane [Wed, 11 Jul 2018 19:09:21 +0000 (19:09 +0000)]
[NFC] Replace usage of QualType.getTypePtr()-> with operator->

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

6 years ago[analyzer] Track multiple raw pointer symbols in DanglingInternalBufferChecker.
Reka Kovacs [Wed, 11 Jul 2018 19:08:02 +0000 (19:08 +0000)]
[analyzer] Track multiple raw pointer symbols in DanglingInternalBufferChecker.

Previously, the checker only tracked one raw pointer symbol for each
container object. But member functions returning a pointer to the
object's inner buffer may be called on the object several times. These
pointer symbols are now collected in a set inside the program state map
and thus all of them is checked for use-after-free problems.

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

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

6 years agoRevert "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the...
Eric Liu [Wed, 11 Jul 2018 18:43:07 +0000 (18:43 +0000)]
Revert "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name"

This reverts commit r336807. This breaks users of
ClangTool::mapVirtualFile. Will try to investigate a fix. See also the
discussion on https://reviews.llvm.org/D48903

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

6 years ago[AST] Fix for structural equivalence tests in rL336776.
Balazs Keri [Wed, 11 Jul 2018 15:26:26 +0000 (15:26 +0000)]
[AST] Fix for structural equivalence tests in rL336776.

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

6 years ago[clangd] Uprank delcarations when "using q::name" is present in the main file
Kirill Bobyrev [Wed, 11 Jul 2018 14:49:49 +0000 (14:49 +0000)]
[clangd] Uprank delcarations when "using q::name" is present in the main file

Having `using qualified::name;` for some symbol is an important signal
for clangd code completion as the user is more likely to use such
symbol.  This patch helps to uprank the relevant symbols by saving
UsingShadowDecl in the new field of CodeCompletionResult and checking
whether the corresponding UsingShadowDecl is located in the main file
later in ClangD code completion routine. While the relative importance
of such signal is a subject to change in the future, this patch simply
bumps DeclProximity score to the value of 1.0 which should be enough for
now.

The patch was tested using

`$ ninja check-clang check-clang-tools`

No unexpected failures were noticed after running the relevant testsets.

Reviewers: sammccall, ioeric

Subscribers: MaskRay, jkorous, cfe-commits

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

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

6 years ago[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested...
Simon Marchi [Wed, 11 Jul 2018 14:08:17 +0000 (14:08 +0000)]
[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

Summary:
InMemoryFileSystem::status behaves differently than
RealFileSystem::status.  The Name contained in the Status returned by
RealFileSystem::status will be the path as requested by the caller,
whereas InMemoryFileSystem::status returns the normalized path.

For example, when requested the status for "../src/first.h",
RealFileSystem returns a Status with "../src/first.h" as the Name.
InMemoryFileSystem returns "/absolute/path/to/src/first.h".

The reason for this change is that I want to make a unit test in the
clangd testsuite (where we use an InMemoryFileSystem) to reproduce a
bug I get with the clangd program (where a RealFileSystem is used).
This difference in behavior "hides" the bug in the unit test version.

In general, I guess it's good if InMemoryFileSystem works as much as
possible like RealFileSystem.

Doing so made the FileEntry::RealPathName value (assigned in
FileManager::getFile) wrong when using the InMemoryFileSystem.  That's
because it assumes that vfs::File::getName will always return the real
path.  I changed to to use FileSystem::getRealPath instead.

Subscribers: ilya-biryukov, ioeric, cfe-commits

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

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

6 years ago[mips] Add '-mvirt', '-mno-virt', '-mginv', '-mno-ginv' options
Vladimir Stefanovic [Wed, 11 Jul 2018 12:45:25 +0000 (12:45 +0000)]
[mips] Add '-mvirt', '-mno-virt', '-mginv', '-mno-ginv' options

'-mvirt'/'-mno-virt' enables/disables Virtualization ASE.
'-mginv'/'-mno-ginv' enables/disables GINV (Global Invalidate) ASE.

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

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

6 years ago[AST] Structural equivalence of methods
Balazs Keri [Wed, 11 Jul 2018 09:37:24 +0000 (09:37 +0000)]
[AST] Structural equivalence of methods

Summary:
Added structural equivalence check for C++ methods.
Improved structural equivalence tests.
Added related ASTImporter tests.

Reviewers: a.sidorin, szepet, xazax.hun, martong, a_sidorin

Reviewed By: martong, a_sidorin

Subscribers: a_sidorin, rnkovacs, cfe-commits

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

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

6 years ago[analyzer] Fix bots by changing the analyzer-config tests.
George Karpenkov [Wed, 11 Jul 2018 02:01:18 +0000 (02:01 +0000)]
[analyzer] Fix bots by changing the analyzer-config tests.

To be investigated.

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

6 years ago[analyzer] Partial revert of https://reviews.llvm.org/D49050
George Karpenkov [Wed, 11 Jul 2018 01:58:08 +0000 (01:58 +0000)]
[analyzer] Partial revert of https://reviews.llvm.org/D49050

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

6 years ago[analyzer] Pass through all arguments from the registerChecker() to the checker const...
George Karpenkov [Wed, 11 Jul 2018 01:23:27 +0000 (01:23 +0000)]
[analyzer] Pass through all arguments from the registerChecker() to the checker constructor

A lot of checkers could be cleaned up in a similar way

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

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

6 years ago[SemaCXX] Remove comment from coroutines test, NFC
Brian Gesiak [Wed, 11 Jul 2018 01:00:53 +0000 (01:00 +0000)]
[SemaCXX] Remove comment from coroutines test, NFC

Summary:
The file name was accidentally included when the test file was added.

Test Plan: check-clang

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

6 years agoRemove qualtype qualifier in coroutine error to prevent assert in debug
Brian Gesiak [Wed, 11 Jul 2018 00:45:48 +0000 (00:45 +0000)]
Remove qualtype qualifier in coroutine error to prevent assert in debug

Summary:
A forward-declared coroutine_traits should trip an error; we need
a complete type.

Unfortunately, in debug mode only, we trip an assert when attempting
to provide the fully qualified type for the error message.
If you try to compile a program with a forward-declared
coroutine_traits in debug mode, clang will crash.

I've included a test for the behavior and removed the q modifier
on the error message. This prevents the crash in debug mode and
does not change the behavior for the error message on a
forward-declaration of a coroutine_traits type.

Test Plan:
I've included a test for the forward-declaration.

Patch by Tanoy Sinha!

Reviewers: modocache, GorNishanov

Reviewed By: modocache

Subscribers: cfe-commits

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

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

6 years ago[docs] List correct default for -ftemplate-depth; also add missing
Richard Smith [Wed, 11 Jul 2018 00:34:54 +0000 (00:34 +0000)]
[docs] List correct default for -ftemplate-depth; also add missing
documentation for -fconstexpr-steps.

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

6 years agoPR38095: Allow constant-folding of loads through bitcasted pointers if
Richard Smith [Wed, 11 Jul 2018 00:29:05 +0000 (00:29 +0000)]
PR38095: Allow constant-folding of loads through bitcasted pointers if
the bitcast only changed cvr-qualifications within the pointer type.

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

6 years agoDR330: look through array types when forming the cv-decomposition of a type.
Richard Smith [Wed, 11 Jul 2018 00:19:19 +0000 (00:19 +0000)]
DR330: look through array types when forming the cv-decomposition of a type.

This allows more qualification conversions, eg. conversion from
   'int *(*)[]' -> 'const int *const (*)[]'
is now permitted, along with all the consequences of that: more types
are similar, more cases are permitted by const_cast, and conversely,
fewer "casting away constness" cases are permitted by reinterpret_cast.

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

6 years ago[X86] Also fix the test for _mm512_mullo_epi64 to test the intrinsic instead of a...
Craig Topper [Tue, 10 Jul 2018 23:28:05 +0000 (23:28 +0000)]
[X86] Also fix the test for _mm512_mullo_epi64 to test the intrinsic instead of a copy of the intrinsic implementation.

This had the same issue I just fixed in r336739. Apparently I copy pasted _mm512_mullo_epi64 when I added _mm512_mullox_epi64.

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

6 years ago[X86] Fix the test for _mm512_mullox_epi64 to test the intrinsic instead of a copy...
Craig Topper [Tue, 10 Jul 2018 23:13:01 +0000 (23:13 +0000)]
[X86] Fix the test for _mm512_mullox_epi64 to test the intrinsic instead of a copy of the intrinsic implementation.

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

6 years agoFix determination of whether a reinterpret_cast casts away constness.
Richard Smith [Tue, 10 Jul 2018 23:04:35 +0000 (23:04 +0000)]
Fix determination of whether a reinterpret_cast casts away constness.

The "casts away constness" check doesn't care at all how the different
layers of the source and destination type were formed: for example, if
the source is a pointer and the destination is a pointer-to-member, the
types are still decomposed and their pointee qualifications are still
checked.

This rule is bizarre and somewhat ridiculous, so as an extension we
accept code making use of such reinterpret_casts with a warning outside
of SFINAE contexts.

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

6 years ago[NFC] Switch CodeGenFunction to use value init instead of member init lists
Erich Keane [Tue, 10 Jul 2018 21:07:50 +0000 (21:07 +0000)]
[NFC] Switch CodeGenFunction to use value init instead of member init lists

The member init list for the sole constructor for CodeGenFunction
has gotten out of hand, so this patch moves the non-parameter-dependent
initializations into the member value inits.

Note: This is what was intended to be committed in r336726

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

6 years agoRevert -r336726, which included more files than intended.
Erich Keane [Tue, 10 Jul 2018 20:51:41 +0000 (20:51 +0000)]
Revert -r336726, which included more files than intended.

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

6 years ago[NFC] Switch CodeGenFunction to use value init instead of member init lists
Erich Keane [Tue, 10 Jul 2018 20:46:46 +0000 (20:46 +0000)]
[NFC] Switch CodeGenFunction to use value init instead of member init lists

The member init list for the sole constructor for CodeGenFunction
has gotten out of hand, so this patch moves the non-parameter-dependent
initializations into the member value inits.

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

6 years agoPatch to fix pragma metadata for do-while loops
Bjorn Pettersson [Tue, 10 Jul 2018 19:55:02 +0000 (19:55 +0000)]
Patch to fix pragma metadata for do-while loops

Summary:
Make sure that loop metadata only is put on the backedge
when expanding a do-while loop.
Previously we added the loop metadata also on the branch
in the pre-header. That could confuse optimization passes
and result in the loop metadata being associated with the
wrong loop.

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

Committing on behalf of deepak2427 (Deepak Panickal)

Reviewers: #clang, ABataev, hfinkel, aaron.ballman, bjope

Reviewed By: bjope

Subscribers: bjope, rsmith, shenhan, zzheng, xbolva00, lebedev.ri, cfe-commits

Tags: #clang

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

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

6 years agoRevert r336590 "[libclang] evalute compound statement cursors before trying to evaluate"
Evgeniy Stepanov [Tue, 10 Jul 2018 19:49:07 +0000 (19:49 +0000)]
Revert r336590 "[libclang] evalute compound statement cursors before trying to evaluate"

New memory leaks in
LibclangParseTest_EvaluateChildExpression_Test::TestBody()

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

6 years agoRevert r336591 "[libclang] NFC, simplify clang_Cursor_Evaluate"
Evgeniy Stepanov [Tue, 10 Jul 2018 19:48:53 +0000 (19:48 +0000)]
Revert r336591 "[libclang] NFC, simplify clang_Cursor_Evaluate"

This change is blocking r336590 which is being reverted due to memory leaks.

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

6 years agoFix a typo/regression in r335495.
John Baldwin [Tue, 10 Jul 2018 17:44:08 +0000 (17:44 +0000)]
Fix a typo/regression in r335495.

Use getTriple.isMIPS64() to detect 64-bit MIPS ABIs in
FreeBSD::getSupportedSanitizers() instead of getTriple.isMIPS32().

Reviewed By: atanasyan

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

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

6 years agoSupport -fdebug-prefix-map for assembler source (pass to cc1as). This
Paul Robinson [Tue, 10 Jul 2018 15:15:24 +0000 (15:15 +0000)]
Support -fdebug-prefix-map for assembler source (pass to cc1as).  This
is useful to omit the debug compilation dir when compiling assembly
files with -g.  Part of PR38050.

Patch by Siddhartha Bagaria!

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

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

6 years agoAMDGPU: Try to fix test again
Matt Arsenault [Tue, 10 Jul 2018 14:47:31 +0000 (14:47 +0000)]
AMDGPU: Try to fix test again

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

6 years agoUpdate test for backend error message change
Matt Arsenault [Tue, 10 Jul 2018 14:03:50 +0000 (14:03 +0000)]
Update test for backend error message change

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

6 years ago[analyzer] Add option to set maximum symbol complexity threshold
Mikhail R. Gadelha [Tue, 10 Jul 2018 13:46:05 +0000 (13:46 +0000)]
[analyzer] Add option to set maximum symbol complexity threshold

Summary:
This adds an option, max-symbol-complexity, so an user can set the maximum symbol complexity threshold.

Note that the current behaviour is equivalent to max complexity = 0, when taint analysis is not enabled and tests show that in a number of tests, having complexity = 25 yields the same results as complexity = 10000.

This patch was extracted and modified from Dominic Chen's patch, D35450.

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
Yuka Takahashi [Tue, 10 Jul 2018 12:17:34 +0000 (12:17 +0000)]
[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts

Summary:
Reproducer and errors:
https://bugs.llvm.org/show_bug.cgi?id=37878

lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't
find ModuleName in (proper) search paths. This was causing iteration over all
files in the search path subdirectories for example "/usr/include/foobar" in
bugzilla case.

Users don't expect Clang to load modulemaps in subdirectories implicitly, and
also the disk access is not cheap.

if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName.

Reviewers: rsmith, aprantl, bruno

Subscribers: cfe-commits, teemperor, v.g.vassilev

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

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

6 years agoFixing builtin __atomic_fetch_min declaration
Omer Paparo Bivas [Tue, 10 Jul 2018 12:04:04 +0000 (12:04 +0000)]
Fixing builtin __atomic_fetch_min declaration

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

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

6 years ago[MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified
Martin Storsjo [Tue, 10 Jul 2018 10:46:51 +0000 (10:46 +0000)]
[MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified

In this setup, skip adding all the default windows import libraries,
if linking to windowsapp (which replaces them, when targeting the
windows store/UWP api subset).

With GCC, the same is achieved by using a custom spec file, but
since clang doesn't use spec files, we have to allow other means of
overriding what default libraries to use (without going all the
way to using -nostdlib, which would exclude everything). The same
approach, in detecting certain user specified libraries and omitting
others from the defaults, was already used in SVN r314138.

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

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

6 years ago[MinGW] Treat any -lucrt* as replacing -lmsvcrt
Martin Storsjo [Tue, 10 Jul 2018 10:46:45 +0000 (10:46 +0000)]
[MinGW] Treat any -lucrt* as replacing -lmsvcrt

Since SVN r314138, we check if the user has specified any particular
alternative msvcrt/ucrt version, and skip the default -lmsvcrt
in those cases.

In addition to the existing names checked, we should also treat
a plain -lucrt in the same way, mingw-w64 has now added a separate
import library named libucrt.a, in addition to libucrtbase.a.

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

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

6 years ago[X86] Lowering integer truncation intrinsics to native IR
Mikhail Dvoretckii [Tue, 10 Jul 2018 08:22:44 +0000 (08:22 +0000)]
[X86] Lowering integer truncation intrinsics to native IR

This patch lowers the _mm[256|512]_cvtepi{64|32|16}_epi{32|16|8} intrinsics to
native IR in cases where the result's length is less than 128 bits.

The resulting IR for 256-bit inputs is folded into VPMOV instructions, while for
128-bit inputs the vpshufb (or, in the 64-to-32-bit case, vinsertps)
instructions are generated instead

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

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

6 years agoTest commit
Stephen Kelly [Tue, 10 Jul 2018 06:55:12 +0000 (06:55 +0000)]
Test commit

Add redundant doc.

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

6 years ago[X86] Use masked the masked scalar fma builtins to implement the default rounding...
Craig Topper [Tue, 10 Jul 2018 04:38:29 +0000 (04:38 +0000)]
[X86] Use masked the masked scalar fma builtins to implement the default rounding version of the fma intrinsics.

The rounding mode is checked in CGBuiltin.cpp to generate the correct intrinsic call.

Making this switch switchs the masking to use the i8 bitcast to <8 x i1> and extract i1 version of the IR for the mask. Previously we ended up with a scalar 'and' plus an icmp.

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

6 years ago[Sema] Fix a structured binding typo correction bug
Erik Pilkington [Tue, 10 Jul 2018 02:15:07 +0000 (02:15 +0000)]
[Sema] Fix a structured binding typo correction bug

BindingDecls have null type until their initializer is processed, so we can't
assume that a correction candidate has non-null type.

rdar://41559582

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

6 years ago[ODRHash] Merge the two function hashes into one.
Richard Trieu [Tue, 10 Jul 2018 01:40:50 +0000 (01:40 +0000)]
[ODRHash] Merge the two function hashes into one.

Functions that are a sub-Decl of a record were hashed differently than other
functions.  This change keeps the AddFunctionDecl function and the hash of
records now calls this function.  In addition, AddFunctionDecl has an option
to perform a hash as if the body was absent, which is required for some
checks after loading modules.  Additional logic prevents multiple error
message from being printed.

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

6 years agoUpdate crash diagnostics test to avoid attempting to write into various
Eric Christopher [Tue, 10 Jul 2018 01:01:38 +0000 (01:01 +0000)]
Update crash diagnostics test to avoid attempting to write into various
directories if possible and to not require %t to have "Output" in the name.

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

6 years agoFix parsing of privacy annotations in os_log format strings.
Akira Hatanaka [Tue, 10 Jul 2018 00:50:25 +0000 (00:50 +0000)]
Fix parsing of privacy annotations in os_log format strings.

Privacy annotations shouldn't have to appear in the first
comma-delimited string in order to be recognized. Also, they should be
ignored if they are preceded or followed by non-whitespace characters.

rdar://problem/40706280

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

6 years ago[X86] Remove custom handling for __builtin_ia32_divss_round_mask and __builtin_ia32_d...
Craig Topper [Tue, 10 Jul 2018 00:50:03 +0000 (00:50 +0000)]
[X86] Remove custom handling for __builtin_ia32_divss_round_mask and __builtin_ia32_divsd_round_mask.

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

6 years ago[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitabl...
Craig Topper [Tue, 10 Jul 2018 00:37:25 +0000 (00:37 +0000)]
[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitable for use in scalar mask intrinsics.

This will convert the i8 mask argument to <8 x i1> and extract an i1 and then emit a select instruction. This replaces the '(__U & 1)" and ternary operator used in some of intrinsics. The old sequence was lowered to a scalar and and compare. The new sequence uses an i1 vector that will interoperate better with other mask intrinsics.

This removes the need to handle div_ss/sd specially in CGBuiltin.cpp. A follow up patch will add the GCCBuiltin name back in llvm and remove the custom handling.

I made some adjustments to legacy move_ss/sd intrinsics which we reused here to do a simpler extract and insert instead of 2 extracts and two inserts or a shuffle.

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

6 years agoRename function calls missed in r336605
Richard Trieu [Mon, 9 Jul 2018 22:09:33 +0000 (22:09 +0000)]
Rename function calls missed in r336605

NextIsLatest -> isFirst

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

6 years ago[Index] Add index::IndexingOptions::IndexImplicitInstantiation
Fangrui Song [Mon, 9 Jul 2018 21:49:06 +0000 (21:49 +0000)]
[Index] Add index::IndexingOptions::IndexImplicitInstantiation

Summary:
With IndexImplicitInstantiation=true, the following case records an occurrence of B::bar in A::foo, which will benefit cross reference tools.

template <class T> struct B { void bar() {}};
template <class T> struct A { void foo(B<T> *x) { x->bar(); }};
int main() { A<int> a; a.foo(0); }

Reviewers: akyrtzi, arphaman, rsmith

Subscribers: cfe-commits

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

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

6 years ago[AST] Rename some Redeclarable functions to reduce confusion
Fangrui Song [Mon, 9 Jul 2018 21:31:20 +0000 (21:31 +0000)]
[AST] Rename some Redeclarable functions to reduce confusion

Reviewers: rsmith, akyrtzi

Subscribers: cfe-commits

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

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

6 years agoAdded -fcrash-diagnostics-dir flag
Bob Haarman [Mon, 9 Jul 2018 21:07:20 +0000 (21:07 +0000)]
Added -fcrash-diagnostics-dir flag

Summary:
New flag causes crash reports to be written in the specified directory
rather than the temp directory.

Patch by Chijioke Kamanu.

Reviewers: hans, inglorion, rnk

Reviewed By: hans

Subscribers: zturner, hiraditya, llvm-commits, cfe-commits

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

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

6 years ago[Power9] [CLANG] Add __float128 support for trunc to double round to odd
Stefan Pintilie [Mon, 9 Jul 2018 20:09:52 +0000 (20:09 +0000)]
[Power9] [CLANG] Add __float128 support for trunc to double round to odd

Add support for this builtin:
double builtin_truncf128_round_to_odd(float128)

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

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

6 years ago[OPENMP] Do not mark local variables as declare target.
Alexey Bataev [Mon, 9 Jul 2018 19:58:08 +0000 (19:58 +0000)]
[OPENMP] Do not mark local variables as declare target.

When the parsing of the functions happens inside of the declare target
region, we may erroneously mark local variables as declare target
thought they are not. This attribute can be applied only to global
variables.

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

6 years ago[libclang] NFC, simplify clang_Cursor_Evaluate
Alex Lorenz [Mon, 9 Jul 2018 19:56:45 +0000 (19:56 +0000)]
[libclang] NFC, simplify clang_Cursor_Evaluate

Take advantage of early returns as suggested by Duncan in
https://reviews.llvm.org/D49051

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

6 years ago[libclang] evalute compound statement cursors before trying to evaluate
Alex Lorenz [Mon, 9 Jul 2018 19:41:28 +0000 (19:41 +0000)]
[libclang] evalute compound statement cursors before trying to evaluate
the cursor like a declaration

This change fixes a bug in libclang in which it tries to evaluate a statement
cursor as a declaration cursor, because that statement still has a pointer to
the declaration parent.

rdar://38888477

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

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

6 years ago[Index] Ignore noop #undef's when handling macro occurrences.
Eric Liu [Mon, 9 Jul 2018 19:02:41 +0000 (19:02 +0000)]
[Index] Ignore noop #undef's when handling macro occurrences.

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

6 years ago[Builtins][Attributes][X86] Tag all X86 builtins with their required vector width...
Craig Topper [Mon, 9 Jul 2018 19:00:16 +0000 (19:00 +0000)]
[Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it

This is part of an ongoing attempt at making 512 bit vectors illegal in the X86 backend type legalizer due to CPU frequency penalties associated with wide vectors on Skylake Server CPUs. We want the loop vectorizer to be able to emit IR containing wide vectors as intermediate operations in vectorized code and allow these wide vectors to be legalized to 256 bits by the X86 backend even though we are targetting a CPU that supports 512 bit vectors. This is similar to what happens with an AVX2 CPU, the vectorizer can emit wide vectors and the backend will split them. We want this splitting behavior, but still be able to use new Skylake instructions that work on 256-bit vectors and support things like masking and gather/scatter.

Of course if the user uses explicit vector code in their source code we need to not split those operations. Especially if they have used any of the 512-bit vector intrinsics from immintrin.h. And we need to make it so that merely using the intrinsics produces the expected code in order to be backwards compatible.

To support this goal, this patch adds a new IR function attribute "min-legal-vector-width" that can indicate the need for a minimum vector width to be legal in the backend. We need to ensure this attribute is set to the largest vector width needed by any intrinsics from immintrin.h that the function uses. The inliner will be reponsible for merging this attribute when a function is inlined. We may also need a way to limit inlining in the future as well, but we can discuss that in the future.

To make things more complicated, there are two different ways intrinsics are implemented in immintrin.h. Either as an always_inline function containing calls to builtins(can be target specific or target independent) or vector extension code. Or as a macro wrapper around a taget specific builtin. I believe I've removed all cases where the macro was around a target independent builtin.

To support the always_inline function case this patch adds attribute((min_vector_width(128))) that can be used to tag these functions with their vector width. All x86 intrinsic functions that operate on vectors have been tagged with this attribute.

To support the macro case, all x86 specific builtins have also been tagged with the vector width that they require. Use of any builtin with this property will implicitly increase the min_vector_width of the function that calls it. I've done this as a new property in the attribute string for the builtin rather than basing it on the type string so that we can opt into it on a per builtin basis and avoid any impact to target independent builtins.

There will be future work to support vectors passed as function arguments and supporting inline assembly. And whatever else we can find that isn't covered by this patch.

Special thanks to Chandler who suggested this direction and reviewed a preview version of this patch. And thanks to Eric Christopher who has had many conversations with me about this issue.

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

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

6 years ago[Power9] Add __float128 builtins for Round To Odd
Stefan Pintilie [Mon, 9 Jul 2018 18:50:40 +0000 (18:50 +0000)]
[Power9] Add __float128 builtins for Round To Odd

Add a number of builtins for __float128 Round To Odd.
This is the Clang portion of the builtins work.

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

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

6 years ago[OPENMP, NVPTX] Do not globalize local variables in parallel regions.
Alexey Bataev [Mon, 9 Jul 2018 17:43:58 +0000 (17:43 +0000)]
[OPENMP, NVPTX] Do not globalize local variables in parallel regions.

In generic data-sharing mode we are allowed to not globalize local
variables that escape their declaration context iff they are declared
inside of the parallel region. We can do this because L2 parallel
regions are executed sequentially and, thus, we do not need to put
shared local variables in the global memory.

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

6 years ago[PCH] Add an option to not write comments into PCH
Ilya Biryukov [Mon, 9 Jul 2018 11:33:23 +0000 (11:33 +0000)]
[PCH] Add an option to not write comments into PCH

Summary:
Will be used in clangd, see the follow-up change.
Clangd does not use comments read from PCH to avoid crashes due to
changed contents of the file. However, reading them considerably slows
down code completion on files with large preambles.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, cfe-commits

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

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

6 years agoTry to fix build bot after r336524
Eric Liu [Mon, 9 Jul 2018 09:17:25 +0000 (09:17 +0000)]
Try to fix build bot after r336524

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

6 years ago[Preamble] Check system dependencies in preamble too
Ilya Biryukov [Mon, 9 Jul 2018 09:07:01 +0000 (09:07 +0000)]
[Preamble] Check system dependencies in preamble too

Summary:
PrecompiledPreamble hasn't checked if the system dependencies changed
before. This resulted in invalid preamble not being rebuilt if headers
that changed were found in -isystem include paths.

This pattern is sometimes used to avoid showing warnings in third
party code, so we want to correctly handle those cases.

Tested in clangd, see the follow-up patch.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: omtcyfz, cfe-commits

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

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

6 years ago[ASTImporter] fix test failure corrected by fixed func end locs
Rafael Stahl [Mon, 9 Jul 2018 09:02:53 +0000 (09:02 +0000)]
[ASTImporter] fix test failure corrected by fixed func end locs

fix to rC336523 / D48941

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

6 years ago[Index] Add clangLex to LINK_LIBS
Heejin Ahn [Mon, 9 Jul 2018 08:54:42 +0000 (08:54 +0000)]
[Index] Add clangLex to LINK_LIBS

Without this, builds with `-DSHARED_LIB=ON` fail.

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

6 years ago[Index] Add indexing support for MACROs.
Eric Liu [Mon, 9 Jul 2018 08:44:05 +0000 (08:44 +0000)]
[Index] Add indexing support for MACROs.

Reviewers: akyrtzi, arphaman, sammccall

Reviewed By: sammccall

Subscribers: malaperle, sammccall, cfe-commits

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

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

6 years ago[ASTImporter] import FunctionDecl end locations
Rafael Stahl [Mon, 9 Jul 2018 08:40:17 +0000 (08:40 +0000)]
[ASTImporter] import FunctionDecl end locations

Summary: On constructors that do not take the end source location, it was not imported. Fixes test from D47698 / rC336269.

Reviewers: martong, a.sidorin, balazske, xazax.hun, a_sidorin

Reviewed By: martong, a_sidorin

Subscribers: a_sidorin, rnkovacs, cfe-commits

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

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

6 years ago[clang-format/ObjC] Put ObjC method arguments into one line when they fit
Jacek Olesiak [Mon, 9 Jul 2018 07:08:45 +0000 (07:08 +0000)]
[clang-format/ObjC] Put ObjC method arguments into one line when they fit

Reapply D47195:
Currently BreakBeforeParameter is set to true everytime message receiver spans multiple lines, e.g.:
```
[[object block:^{
  return 42;
}] aa:42 bb:42];
```
will be formatted:
```
[[object block:^{
  return 42;
}] aa:42
   bb:42];
```
even though arguments could fit into one line. This change fixes this behavior.

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

6 years ago[clang-format/ObjC] Improve split priorities for ObjC methods
Jacek Olesiak [Mon, 9 Jul 2018 06:54:52 +0000 (06:54 +0000)]
[clang-format/ObjC] Improve split priorities for ObjC methods

Reduce penalty for aligning ObjC method arguments using the colon alignment as
this is the canonical way.

Trying to fit a whole expression into one line should not force other line
breaks (e.g. when ObjC method expression is a part of other expression).

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

6 years ago[clang-format/ObjC] Prohibit breaking after a bracket opening ObjC method expression
Jacek Olesiak [Mon, 9 Jul 2018 06:04:58 +0000 (06:04 +0000)]
[clang-format/ObjC] Prohibit breaking after a bracket opening ObjC method expression

Summary:
Don't break after a "[" opening an ObjC method expression.
Tests are added in D48719 where formatting is improved (to avoid adding and changing tests immediately).

Reviewers: benhamilton, klimek

Reviewed By: benhamilton

Subscribers: acoomans, cfe-commits

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

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

6 years ago[clang-format/ObjC] Fix counting selector name parts for ObjC
Jacek Olesiak [Mon, 9 Jul 2018 05:58:51 +0000 (05:58 +0000)]
[clang-format/ObjC] Fix counting selector name parts for ObjC

Summary:
Counts selector parts also for method declarations and counts correctly for methods without arguments.
This is an internal change and doesn't influence formatting on its own (at the current state). Its lack would be visible after applying D48719.

Reviewers: benhamilton, klimek

Reviewed By: benhamilton

Subscribers: acoomans, cfe-commits

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

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

6 years ago[X86] Add new scalar fma intrinsics with rounding mode that use f32/f64 types.
Craig Topper [Sun, 8 Jul 2018 01:10:47 +0000 (01:10 +0000)]
[X86] Add new scalar fma intrinsics with rounding mode that use f32/f64 types.

This allows us to handle masking in a very similar way to the default rounding version that uses llvm.fma

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

6 years ago[X86] Remove __builtin_ia32_vfnmsubsd3_mask3 and __builtin_ia32_vfnmsubss3_mask3...
Craig Topper [Sat, 7 Jul 2018 22:03:20 +0000 (22:03 +0000)]
[X86] Remove __builtin_ia32_vfnmsubsd3_mask3 and __builtin_ia32_vfnmsubss3_mask3 from clang.

They are no longer used by clang.

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

6 years ago[X86] Remove some unnecessarily escaped new lines from avx512fintrin.h
Craig Topper [Sat, 7 Jul 2018 22:03:19 +0000 (22:03 +0000)]
[X86] Remove some unnecessarily escaped new lines from avx512fintrin.h

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

6 years ago[X86] Fix a few intrinsics that were ignoring their rounding mode argument and hardco...
Craig Topper [Sat, 7 Jul 2018 22:03:16 +0000 (22:03 +0000)]
[X86] Fix a few intrinsics that were ignoring their rounding mode argument and hardcoded _MM_FROUND_CUR_DIRECTION internally.

I believe these have been broken since their introduction into clang.

I've enhanced the tests for these intrinsics to using a real rounding mode and checking all the intrinsic arguments instead of just the name.

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

6 years ago[analyzer] Add support for data() in DanglingInternalBufferChecker.
Reka Kovacs [Sat, 7 Jul 2018 20:29:24 +0000 (20:29 +0000)]
[analyzer] Add support for data() in DanglingInternalBufferChecker.

DanglingInternalBufferChecker now tracks use-after-free problems related
to the incorrect usage of std::basic_string::data().

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

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

6 years ago[analyzer] Highlight c_str() call in DanglingInternalBufferChecker.
Reka Kovacs [Sat, 7 Jul 2018 19:27:18 +0000 (19:27 +0000)]
[analyzer] Highlight c_str() call in DanglingInternalBufferChecker.

Add a bug visitor to DanglingInternalBufferChecker that places a note
at the point where the dangling pointer was obtained. The visitor is
handed over to MallocChecker and attached to the report there.

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

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

6 years ago[analyzer] Fix -Wcovered-switch-default warning in MallocChecker.
Reka Kovacs [Sat, 7 Jul 2018 18:37:37 +0000 (18:37 +0000)]
[analyzer] Fix -Wcovered-switch-default warning in MallocChecker.

Remove unnecessary default case that caused buildbot failures.

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

6 years ago[analyzer] Highlight container object destruction in MallocChecker.
Reka Kovacs [Sat, 7 Jul 2018 17:22:45 +0000 (17:22 +0000)]
[analyzer] Highlight container object destruction in MallocChecker.

Extend MallocBugVisitor to place a note at the point where objects with
AF_InternalBuffer allocation family are destroyed.

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

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

6 years ago[X86] Change _mm512_shuffle_pd and _mm512_shuffle_ps to use target specific shuffle...
Craig Topper [Sat, 7 Jul 2018 17:03:34 +0000 (17:03 +0000)]
[X86] Change _mm512_shuffle_pd and _mm512_shuffle_ps to use target specific shuffle builtins instead of generic __builtin_shufflevector.

I added the builtins for 128, 256, and 512 bits recently but looks like I failed to convert to using the 512 bit one.

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

6 years ago[X86] Fix various type mismatches in intrinsic headers and intrinsic tests that cause...
Craig Topper [Sat, 7 Jul 2018 17:03:32 +0000 (17:03 +0000)]
[X86] Fix various type mismatches in intrinsic headers and intrinsic tests that cause extra bitcasts to be emitted in the IR.

Found via imprecise grepping of the -O0 IR. There could still be more bugs out there.

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

6 years agoP0806R2 Implicit capture of this with a capture-default of [=] is
Richard Smith [Sat, 7 Jul 2018 05:58:48 +0000 (05:58 +0000)]
P0806R2 Implicit capture of this with a capture-default of [=] is
deprecated.

Add a -Wdeprecated warning for this in C++2a onwards. (In C++17 and
before, there isn't a reasonable alternative because [=,this] is
ill-formed.)

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

6 years ago[Sema] Emit -Wincomplete-implementation for partial methods.
Erik Pilkington [Sat, 7 Jul 2018 01:50:20 +0000 (01:50 +0000)]
[Sema] Emit -Wincomplete-implementation for partial methods.

Fixes rdar://40634455

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

6 years agoCheck returned type is valid before using it.
Richard Trieu [Sat, 7 Jul 2018 00:17:25 +0000 (00:17 +0000)]
Check returned type is valid before using it.

Add a .isNull() check to returned QualType.  Fixes PR38077

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

6 years ago[X86] When creating a select for scalar masked sqrt and div builtins make sure we...
Craig Topper [Fri, 6 Jul 2018 22:46:52 +0000 (22:46 +0000)]
[X86] When creating a select for scalar masked sqrt and div builtins make sure we optimize the all ones mask case.

This case occurs in the intrinsic headers so we should avoid emitting the mask in those cases.

Factor the code into a helper function to make this easy.

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

6 years ago[MachineOutliner] Properly pass -moutline along to the toolchain
Jessica Paquette [Fri, 6 Jul 2018 22:24:56 +0000 (22:24 +0000)]
[MachineOutliner] Properly pass -moutline along to the toolchain

This moves the LTO-specific code for outlining from ToolChains/Clang.cpp to
ToolChains/Darwin.cpp. Passing -mllvm flags isn't sufficient for making sure
that the specified pass will actually run in LTO. This makes sure that when
-moutline is passed, the MachineOutliner will actually be added to the LTO
pass pipeline as expected.

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

6 years ago[X86] Add missing scalar fma intrinsics with rounding, but no mask.
Craig Topper [Fri, 6 Jul 2018 22:08:43 +0000 (22:08 +0000)]
[X86] Add missing scalar fma intrinsics with rounding, but no mask.

We had the mask versions of the rounding intrinsics, but not one without masking.

Also change the rounding tests to not use the CUR_DIRECTION rounding mode.

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

6 years ago[ASTMatchers] A matcher for Objective-C @autoreleasepool
George Karpenkov [Fri, 6 Jul 2018 21:36:04 +0000 (21:36 +0000)]
[ASTMatchers] A matcher for Objective-C @autoreleasepool

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

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

6 years ago[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used.
Alexey Bataev [Fri, 6 Jul 2018 21:13:41 +0000 (21:13 +0000)]
[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used.

On Linux atomic constructs in OpenMP require libatomic library. Patch
links libatomic when -fopenmp is used.

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

6 years ago[OPENMP] Make clauses closing loc point to right bracket.
Alexey Bataev [Fri, 6 Jul 2018 19:35:42 +0000 (19:35 +0000)]
[OPENMP] Make clauses closing loc point to right bracket.

For some of the clauses the closing location erroneously points to the
beginning of the next clause rather than on the location of the closing
bracket of the clause.

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

6 years ago[Driver,AArch64] Add support for -mcpu=native.
Florian Hahn [Fri, 6 Jul 2018 10:49:59 +0000 (10:49 +0000)]
[Driver,AArch64] Add support for -mcpu=native.

This patches adds support for passing -mcpu=native for AArch64. It will
get turned into the host CPU name, before we get the target features.

CPU = native is handled in a similar fashion in
getAArch64MicroArchFetauresFromMtune and getAArch64TargetCPU already.

Having a good test case for this is hard, as it depends on the host CPU
of the machine running the test. But we can check that native has been
replaced with something else.

When cross-compiling, we will get a CPU name from the host architecture
and get ` the clang compiler does not support '-mcpu=native'` as error
message, which seems reasonable to me.

Reviewers: rengolin, peter.smith, dlj, javed.absar, t.p.northover

Reviewed By: peter.smith

Tags: #clang

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

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