]> granicus.if.org Git - clang/log
clang
6 years ago[Support] Avoid normalization in sys::getDefaultTargetTriple
Petr Hosek [Fri, 18 May 2018 18:33:07 +0000 (18:33 +0000)]
[Support] Avoid normalization in sys::getDefaultTargetTriple

The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.

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

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

6 years agoMC: Change the streamer ctors to take an object writer instead of a stream. NFCI.
Peter Collingbourne [Fri, 18 May 2018 18:26:45 +0000 (18:26 +0000)]
MC: Change the streamer ctors to take an object writer instead of a stream. NFCI.

The idea is that a client that wants split dwarf would create a
specific kind of object writer that creates two files, and use it to
create the streamer.

Part of PR37466.

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

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

6 years ago[X86] Fix a bad cast from mask16 to mask8 in _mm256_mask_cvtepi16_epi8 introduced...
Craig Topper [Fri, 18 May 2018 17:18:46 +0000 (17:18 +0000)]
[X86] Fix a bad cast from mask16 to mask8 in _mm256_mask_cvtepi16_epi8 introduced in r332266.

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

6 years agoFix unused variable warning in r332724
Eric Liu [Fri, 18 May 2018 16:29:42 +0000 (16:29 +0000)]
Fix unused variable warning in r332724

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

6 years ago[Tooling] Add an overload of runToolOnCodeWithArgs that takes VFS
Eric Liu [Fri, 18 May 2018 16:06:19 +0000 (16:06 +0000)]
[Tooling] Add an overload of runToolOnCodeWithArgs that takes VFS

Summary: ... to support purely VFS-based tools.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

6 years ago[ASTImporter] Enable disabled but passing test
Gabor Marton [Fri, 18 May 2018 15:46:18 +0000 (15:46 +0000)]
[ASTImporter] Enable disabled but passing test

Summary:
There is a test which passes since D32947, but it was forgotten to be enabled.
This patch enables that disabled test.

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

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format/ObjC] Correctly annotate single-component ObjC method invocations
Ben Hamilton [Fri, 18 May 2018 15:27:02 +0000 (15:27 +0000)]
[clang-format/ObjC] Correctly annotate single-component ObjC method invocations

Summary:
Previously, clang-format's parser would fail to annotate the
selector in a single-component Objective-C method invocation with
`TT_SelectorName`. For example, the following:

  [foo bar];

would parse `bar` as `TT_Unknown`:

  M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=identifier L=34 PPK=2
  FakeLParens= FakeRParens=0 II=0x559d5db51770 Text='bar'

This caused us to fail to insert a space after a closing cast rparen,
so the following:

  [((Foo *)foo) bar];

would format as:

  [((Foo *)foo)bar];

This diff fixes the issue by ensuring we annotate the selector
in a single-component Objective-C method invocation as
`TT_SelectorName`.

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

Reviewers: djasper, jolesiak

Reviewed By: jolesiak

Subscribers: Wizard, klimek, hokein, cfe-commits

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

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

6 years ago[HIP] Support offloading by linker script
Yaxun Liu [Fri, 18 May 2018 15:07:56 +0000 (15:07 +0000)]
[HIP] Support offloading by linker script

To support linking device code in different source files, it is necessary to
embed fat binary at host linking stage.

This patch emits an external symbol for fat binary in host codegen, then
embed the fat binary by lld through a linker script.

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

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

6 years agoMove #include manipulation code to new lib/Tooling/Inclusions.
Eric Liu [Fri, 18 May 2018 14:16:37 +0000 (14:16 +0000)]
Move #include manipulation code to new lib/Tooling/Inclusions.

Summary:
clangToolingCore is linked into almost everything (incl. clang), but
not few tools need #include manipulation at this point. So pull this into a
separate library in Tooling.

Reviewers: ilya-biryukov

Subscribers: klimek, mgorny, cfe-commits, thakis

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

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

6 years ago[VFS] Implement getRealPath for OverlayFileSystem.
Eric Liu [Fri, 18 May 2018 13:22:49 +0000 (13:22 +0000)]
[VFS] Implement getRealPath for OverlayFileSystem.

Reviewers: bkramer

Subscribers: cfe-commits

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

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

6 years agoThis patch aims to match the changes introduced
Alexander Ivchenko [Fri, 18 May 2018 11:56:21 +0000 (11:56 +0000)]
This patch aims to match the changes introduced
in gcc by https://gcc.gnu.org/ml/gcc-cvs/2018-04/msg00534.html.
The -mibt feature flag is being removed, and the -fcf-protection
option now also defines a CET macro and causes errors when used
on non-X86 targets, while X86 targets no longer check for -mibt
and -mshstk to determine if -fcf-protection is supported. -mshstk
is now used only to determine availability of shadow stack intrinsics.

Comes with an LLVM patch (D46882).

Patch by mike.dvoretsky

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

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

6 years agoDo not try to remove invisible Decls from DeclContext
Gabor Marton [Fri, 18 May 2018 09:08:47 +0000 (09:08 +0000)]
Do not try to remove invisible Decls from DeclContext

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

6 years agoSupport: Add a raw_ostream::write_zeros() function. NFCI.
Peter Collingbourne [Thu, 17 May 2018 22:11:43 +0000 (22:11 +0000)]
Support: Add a raw_ostream::write_zeros() function. NFCI.

This will eventually replace MCObjectWriter::WriteZeros.

Part of PR37466.

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

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

6 years agoAdd missing test case for r332639
Reid Kleckner [Thu, 17 May 2018 18:34:05 +0000 (18:34 +0000)]
Add missing test case for r332639

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

6 years agoFix a mangling failure on clang-cl C++17
Reid Kleckner [Thu, 17 May 2018 18:12:18 +0000 (18:12 +0000)]
Fix a mangling failure on clang-cl C++17

MethodVFTableLocations in MigrosoftVTableContext contains canonicalized
decl. But, it's sometimes asked to lookup for non-canonicalized decl,
and that causes assertion failure, and compilation failure.

Fixes PR37481.

Patch by Taiju Tsuiki!

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

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

6 years ago[sanitizer] Don't add --export-dynamic for Myriad
Walter Lee [Thu, 17 May 2018 18:04:39 +0000 (18:04 +0000)]
[sanitizer] Don't add --export-dynamic for Myriad

This is to work around a bug in some versions of gnu ld, where
--export-dynamic implies -shared even if -static is explicitly given.
Myriad supports static linking only, so --export-dynamic is never
needed.

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

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

6 years ago[CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces.
Justin Lebar [Thu, 17 May 2018 16:15:07 +0000 (16:15 +0000)]
[CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces.

Summary:
Previously this triggered a -Wundefined-internal warning.  But it's not
an undefined variable -- any variable of this form is a pointer to the
base of GPU core's shared memory.

Reviewers: tra

Subscribers: sanjoy, rsmith

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

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

6 years ago[CUDA] Make std::min/max work when compiling in C++14 mode with a C++11 stdlib.
Justin Lebar [Thu, 17 May 2018 16:12:42 +0000 (16:12 +0000)]
[CUDA] Make std::min/max work when compiling in C++14 mode with a C++11 stdlib.

Reviewers: rsmith

Subscribers: sanjoy, cfe-commits, tra

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

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

6 years agoFix __uuidof handling on non-type template parameter in C++17
Nico Weber [Thu, 17 May 2018 15:26:37 +0000 (15:26 +0000)]
Fix __uuidof handling on non-type template parameter in C++17

Clang used to pass the base lvalue of a non-type template parameter
to the template instantiation phase when the base part is __uuidof
and it's running in C++17 mode.
However, that drops its LValuePath, and unintentionally transforms
&__uuidof(...) to __uuidof(...).

This CL fixes that by passing whole expr. Fixes PR24986.

https://reviews.llvm.org/D46820?id=146557
Patch from Taiju Tsuiki <tzik@chromium.org>!

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

6 years ago[AArch64] Correct inline assembly test case for S modifier [NFC]
Peter Smith [Thu, 17 May 2018 13:17:33 +0000 (13:17 +0000)]
[AArch64] Correct inline assembly test case for S modifier [NFC]

The existing test for the AArch64 inline assembly constraint S uses the
A and L modifiers. These modifiers were implemented in the original
AArch64 backend but were not carried forward to the merged backend. The
A is associated with ADRP and does nothing, the L is associated with
:lo12: . Given that A and L are not supported by GCC and not supported
by the new implementation of constraint S in LLVM (see D46745) I've
altered the test to put :lo12: directly in the string so that A and L
are not needed.

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

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

6 years agoUse dotted format of version tuple for availability diagnostics
Jan Korous [Thu, 17 May 2018 11:51:49 +0000 (11:51 +0000)]
Use dotted format of version tuple for availability diagnostics

E. g. use "10.11" instead of "10_11".

We are maintaining backward compatibility by parsing underscore-delimited version tuples but no longer keep track of the separator and using dot format for output.

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

rdar://problem/39845032

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

6 years agoCodeGen: Fix invalid bitcast for lifetime.start/end
Yaxun Liu [Thu, 17 May 2018 11:16:35 +0000 (11:16 +0000)]
CodeGen: Fix invalid bitcast for lifetime.start/end

lifetime.start/end expects pointer argument in alloca address space.
However in C++ a temporary variable is in default address space.

This patch changes API CreateMemTemp and CreateTempAlloca to
get the original alloca instruction and pass it lifetime.start/end.

It only affects targets with non-zero alloca address space.

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

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

6 years agoAdd vfs::FileSystem::getRealPath
Eric Liu [Thu, 17 May 2018 10:26:23 +0000 (10:26 +0000)]
Add vfs::FileSystem::getRealPath

Summary: And change `FileManager::getCanonicalName` to use getRealPath.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Fix missing implict CXXRecordDecl
Gabor Marton [Thu, 17 May 2018 09:46:07 +0000 (09:46 +0000)]
[ASTImporter] Fix missing implict CXXRecordDecl

Summary:
Implicit CXXRecordDecl is not added to its DeclContext during import, but in
the original AST it is. This patch fixes this.

Reviewers: xazax.hun, a.sidorin, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[libclang] Allow skipping function bodies in preamble only
Ivan Donchevskii [Thu, 17 May 2018 09:24:37 +0000 (09:24 +0000)]
[libclang] Allow skipping function bodies in preamble only

Second attempt. Fix line endings and warning.

As an addition to CXTranslationUnit_SkipFunctionBodies, provide the
new option CXTranslationUnit_LimitSkipFunctionBodiesToPreamble,
which constraints the skipping of functions bodies to the preamble
only. Function bodies in the main file are not affected if this
option is set.

Skipping function bodies only in the preamble is what clangd already
does and the introduced flag implements it for libclang clients.

Patch by Nikolai Kosjar.

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

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

6 years ago[Frontend] Avoid running plugins during code completion parse
Ivan Donchevskii [Thu, 17 May 2018 09:21:07 +0000 (09:21 +0000)]
[Frontend] Avoid running plugins during code completion parse

Second attempt. Proper line endings.

The parsing that is done for code completion is a special case that will
discard any generated diagnostics, so avoid running plugins for this
case in the first place to avoid performance penalties due to the
plugins.

A scenario for this is for example libclang with extra plugins like tidy.

Patch by Nikolai Kosjar

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

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

6 years agoRevert https://reviews.llvm.org/D46050 and https://reviews.llvm.org/D45815
Ivan Donchevskii [Thu, 17 May 2018 09:15:22 +0000 (09:15 +0000)]
Revert https://reviews.llvm.org/D46050 and https://reviews.llvm.org/D45815

Windows line endings.
Requires proper resubmission.

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

6 years ago[clang-format] Fix putting ObjC message arguments in one line for multiline receiver
Jacek Olesiak [Thu, 17 May 2018 08:35:15 +0000 (08:35 +0000)]
[clang-format] Fix putting ObjC message arguments in one line for multiline receiver

Summary:
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.

Test Plan:
make -j12 FormatTests && tools/clang/unittests/Format/FormatTests

Reviewers: benhamilton, djasper

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

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

6 years ago[libclang] Allow skipping function bodies in preamble only
Ivan Donchevskii [Thu, 17 May 2018 07:31:29 +0000 (07:31 +0000)]
[libclang] Allow skipping function bodies in preamble only

As an addition to CXTranslationUnit_SkipFunctionBodies, provide the
new option CXTranslationUnit_LimitSkipFunctionBodiesToPreamble,
which constraints the skipping of functions bodies to the preamble
only. Function bodies in the main file are not affected if this
option is set.

Skipping function bodies only in the preamble is what clangd already
does and the introduced flag implements it for libclang clients.

Patch by Nikolai Kosjar.

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

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

6 years agoFix rL332458: [AST] Added a helper to extract a user-friendly text of a comment.
Clement Courbet [Thu, 17 May 2018 06:46:15 +0000 (06:46 +0000)]
Fix rL332458: [AST] Added a helper to extract a user-friendly text of a comment.

Older gcc versions do not support raw string literals within macros.

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

6 years ago[analyzer] Extend ObjCAutoreleaseWriteChecker to catch block declarations with autore...
George Karpenkov [Wed, 16 May 2018 22:47:05 +0000 (22:47 +0000)]
[analyzer] Extend ObjCAutoreleaseWriteChecker to catch block declarations with autoreleasing variables

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

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

6 years ago[ASTMatchers] Introduce a blockDecl matcher for matching block declarations
George Karpenkov [Wed, 16 May 2018 22:47:03 +0000 (22:47 +0000)]
[ASTMatchers] Introduce a blockDecl matcher for matching block declarations

Blocks can be matched just as well as functions or Objective-C methods.

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

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

6 years ago[analyzer] Change the warning message for GCD antipattern checker
George Karpenkov [Wed, 16 May 2018 22:46:47 +0000 (22:46 +0000)]
[analyzer] Change the warning message for GCD antipattern checker

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

6 years ago[Sema] Fix assertion when constructor is disabled with partially specialized template.
Volodymyr Sapsai [Wed, 16 May 2018 18:28:58 +0000 (18:28 +0000)]
[Sema] Fix assertion when constructor is disabled with partially specialized template.

The added test case was triggering assertion

> Assertion failed: (!SpecializedTemplate.is<SpecializedPartialSpecialization*>() && "Already set to a class template partial specialization!"), function setInstantiationOf, file clang/include/clang/AST/DeclTemplate.h, line 1825.

It was happening with ClassTemplateSpecializationDecl
`enable_if_not_same<int, int>`. Because this template is specialized for
equal types not to have a definition, it wasn't instantiated and its
specialization kind remained TSK_Undeclared. And because it was implicit
instantiation, we didn't mark the decl as invalid. So when we try to
find the best matching partial specialization the second time, we hit
the assertion as partial specialization is already set.

Fix by reusing stored partial specialization when available, instead of
looking for the best match every time.

rdar://problem/39524996

Reviewers: rsmith, arphaman

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years agoAdd lit tests forgotten for R332470
Erich Keane [Wed, 16 May 2018 17:04:47 +0000 (17:04 +0000)]
Add lit tests forgotten for R332470

I forgot to svn-add the lit tests for R332470.
Added here!

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

6 years ago[Modules] Do not diagnose missing import in recovery mode if there isn't a decl to...
Bruno Cardoso Lopes [Wed, 16 May 2018 17:00:24 +0000 (17:00 +0000)]
[Modules] Do not diagnose missing import in recovery mode if there isn't a decl to lookup

Clang often tries to create implicit module import for error recovery,
which does a great job helping out with diagnostics. However, sometimes
clang does not have enough information given that it's using an invalid
context to move on. Be more strict in those cases to avoid crashes.

We hit crash on invalids because of this but unfortunately there are no
testcases and I couldn't manage to create one. The crashtrace however
indicates pretty clear why it's happening.

rdar://problem/39313933

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

6 years ago[Attr] Don't print fake MSInheritance argument
Joel E. Denny [Wed, 16 May 2018 15:18:30 +0000 (15:18 +0000)]
[Attr] Don't print fake MSInheritance argument

This was discovered at:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html

Reviewed by: aaron.ballman

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

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

6 years agoRevert r332474: [Attr] Don't print fake MSInheritance argument
Joel E. Denny [Wed, 16 May 2018 15:18:27 +0000 (15:18 +0000)]
Revert r332474: [Attr] Don't print fake MSInheritance argument

I botched the commit log attributes.

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

6 years ago[OPENMP] DO not crash on combined constructs in declare target
Alexey Bataev [Wed, 16 May 2018 15:08:32 +0000 (15:08 +0000)]
[OPENMP] DO not crash on combined constructs in declare target
functions.

If the combined construct is specified in the declare target function
and the device code is emitted, the compiler crashes because of the
incorrectly chosen captured stmt. We should choose the innermost
captured statement, not the outermost.

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

6 years ago[Attr] Don't print fake MSInheritance argument
Joel E. Denny [Wed, 16 May 2018 14:51:18 +0000 (14:51 +0000)]
[Attr] Don't print fake MSInheritance argument

This was discovered at:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html

Reviewed by: aaron.ballman

https://reviews.llvm.org/D46905

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

6 years ago[OpenCL] make test independent of optimizer
Sanjay Patel [Wed, 16 May 2018 14:38:07 +0000 (14:38 +0000)]
[OpenCL] make test independent of optimizer

There shouldn't be any tests that run the entire optimizer here,
but the last test in this file is definitely going to break with
a change in LLVM IR canonicalization. Change that part to check
the unoptimized IR because that's the real intent of this file.

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

6 years agoAdd support for __declspec(code_seg("segname"))
Erich Keane [Wed, 16 May 2018 13:57:17 +0000 (13:57 +0000)]
Add support for __declspec(code_seg("segname"))

Add support for __declspec(code_seg("segname"))

This patch is built on the existing support for #pragma code_seg. The code_seg
declspec is allowed on functions and classes. The attribute enables the
placement of code into separate named segments, including compiler-generated
members and template instantiations.

For more information, please see the following:
https://msdn.microsoft.com/en-us/library/dn636922.aspx

A new CodeSeg attribute is used instead of adding a new spelling to the existing
Section attribute since they don’t apply to the same Subjects. Section
attributes are also added for the code_seg declspec since they are used for
#pragma code_seg. No CodeSeg attributes are added to the AST.

The patch is written to match with the Microsoft compiler’s behavior even where
that behavior is a little complicated (see https://reviews.llvm.org/D22931, the
Microsoft feedback page is no longer available since MS has removed the page).
That code is in getImplicitSectionAttrFromClass routine.

Diagnostics messages are added to match with the Microsoft compiler for code-seg
attribute mismatches on base and derived classes and virtual overrides.

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

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

6 years ago[Frontend] Avoid running plugins during code completion parse
Ivan Donchevskii [Wed, 16 May 2018 13:50:05 +0000 (13:50 +0000)]
[Frontend] Avoid running plugins during code completion parse

The parsing that is done for code completion is a special case that will
discard any generated diagnostics, so avoid running plugins for this
case in the first place to avoid performance penalties due to the
plugins.

A scenario for this is for example libclang with extra plugins like tidy.

Patch by Nikolai Kosjar

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

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

6 years ago[OPENMP, NVPTX] Add check for SPMD mode in orphaned parallel directives.
Alexey Bataev [Wed, 16 May 2018 13:36:30 +0000 (13:36 +0000)]
[OPENMP, NVPTX] Add check for SPMD mode in orphaned parallel directives.

If the orphaned directive is executed in SPMD mode, we need to emit the
check for the SPMD mode and run the orphaned parallel directive in
sequential mode.

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

6 years agoFix an Index test caused by a clang-format change (r332436).
Eric Liu [Wed, 16 May 2018 12:58:13 +0000 (12:58 +0000)]
Fix an Index test caused by a clang-format change (r332436).

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

6 years ago[analyzer] Improve the modeling of memset().
Henry Wong [Wed, 16 May 2018 12:37:53 +0000 (12:37 +0000)]
[analyzer] Improve the modeling of memset().

Since there is no perfect way bind the non-zero value with the default binding, this patch only considers the case where buffer's offset is zero and the char value is 0. And according to the value for overwriting, decide how to update the string length.

Reviewers: dcoughlin, NoQ, xazax.hun, a.sidorin, george.karpenkov

Reviewed By: NoQ

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

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

6 years ago[AST] Added a helper to extract a user-friendly text of a comment.
Ilya Biryukov [Wed, 16 May 2018 12:30:09 +0000 (12:30 +0000)]
[AST] Added a helper to extract a user-friendly text of a comment.

Summary:
The helper is used in clangd for documentation shown in code completion
and storing the docs in the symbols. See D45999.

This patch reuses the code of the Doxygen comment lexer, disabling the
bits that do command and html tag parsing.
The new helper works on all comments, including non-doxygen comments.
However, it does not understand or transform any doxygen directives,
i.e. cannot extract brief text, etc.

Reviewers: sammccall, hokein, ioeric

Reviewed By: ioeric

Subscribers: mgorny, cfe-commits

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

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

6 years ago[CodeComplete] Expose helpers to get RawComment of completion result.
Ilya Biryukov [Wed, 16 May 2018 12:30:01 +0000 (12:30 +0000)]
[CodeComplete] Expose helpers to get RawComment of completion result.

Summary: Used in clangd, see D45999.

Reviewers: sammccall, hokein, ioeric, arphaman

Reviewed By: sammccall

Subscribers: arphaman, cfe-commits

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

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

6 years agoTest commit access: remove superflous spaces
Gabor Marton [Wed, 16 May 2018 11:48:11 +0000 (11:48 +0000)]
Test commit access: remove superflous spaces

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

6 years ago[diagtool] Add diagtool to install target.
Jonas Devlieghere [Wed, 16 May 2018 10:23:25 +0000 (10:23 +0000)]
[diagtool] Add diagtool to install target.

Although not very well known, diagtool is an incredibly convenient
utility for dealing with diagnostics.
Particularly useful are the "tree" and "show-enabled" commands:

 - The former prints the hierarchy of diagnostic (warning) flags and
   which of them are enabled by default.
 - The latter can be used to replace an invocation to clang and will
   print which diagnostics are disabled, warnings or errors.
   For instance: `diagtool show-enabled -Wall -Werror /tmp/test.c` will
   print that -Wunused-variable (warn_unused_variable) will be treated as
   an error.

This patch adds them to the install target so it gets shipped with the
LLVM release. It also adds a very basic man page and mentions this
change in the release notes.

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

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

6 years agoclang-format: Allow optimizer to break template declaration.
Francois Ferrand [Wed, 16 May 2018 08:25:03 +0000 (08:25 +0000)]
clang-format: Allow optimizer to break template declaration.

Summary:
Introduce `PenaltyBreakTemplateDeclaration` to control the penalty,
and change `AlwaysBreakTemplateDeclarations` to an enum with 3 modes:
* `No` for regular, penalty based, wrapping of template declaration
* `MultiLine` for always wrapping before multi-line declarations (e.g.
  same as legacy behavior when `AlwaysBreakTemplateDeclarations=false`)
* `Yes` for always wrapping (e.g. same as legacy behavior when
  `AlwaysBreakTemplateDeclarations=true`)

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

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

6 years agoclang-format: tweak formatting of variable initialization blocks
Francois Ferrand [Wed, 16 May 2018 08:03:52 +0000 (08:03 +0000)]
clang-format: tweak formatting of variable initialization blocks

Summary:
This patch changes the behavior of PenaltyBreakBeforeFirstCallParameter
so that is does not apply after a brace, when Cpp11BracedListStyle is
false.

This way, variable initialization is wrapped more like an initializer
than like a function call, which is more consistent with user
expectations for this braced list style.

With PenaltyBreakBeforeFirstCallParameter=200, this gives the following
code: (with Cpp11BracedListStyle=false)

Before :

  const std::unordered_map<std::string, int> Something::MyHashTable =
      { { "aaaaaaaaaaaaaaaaaaaaa", 0 },
        { "bbbbbbbbbbbbbbbbbbbbb", 1 },
        { "ccccccccccccccccccccc", 2 } };

After :

  const std::unordered_set<std::string> Something::MyUnorderedSet = {
    { "aaaaaaaaaaaaaaaaaaaaa", 0 },
    { "bbbbbbbbbbbbbbbbbbbbb", 1 },
    { "ccccccccccccccccccccc", 2 }
  };

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

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

6 years agoFix 32-bit buildbots.
Richard Smith [Wed, 16 May 2018 01:08:07 +0000 (01:08 +0000)]
Fix 32-bit buildbots.

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

6 years ago[analyzer] Do not crash on callback for call_once passed by value
George Karpenkov [Wed, 16 May 2018 00:29:13 +0000 (00:29 +0000)]
[analyzer] Do not crash on callback for call_once passed by value

https://bugs.llvm.org/show_bug.cgi?id=37312
rdar://40270582

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

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

6 years agoRevert commits r332160, r332164, r332236.
Douglas Yung [Wed, 16 May 2018 00:27:43 +0000 (00:27 +0000)]
Revert commits r332160, r332164, r332236.

It was decided this is the wrong approach to fix this issue.

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

6 years ago[analyzer] Make plist-html diagnostic consumer produce multi-file reports.
Artem Dergachev [Wed, 16 May 2018 00:11:24 +0000 (00:11 +0000)]
[analyzer] Make plist-html diagnostic consumer produce multi-file reports.

Previously plist-html output produced multi-file HTML reports
but only single-file Plist reports.

Change plist-html output to produce multi-file Plist reports as well.

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

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

6 years ago[Attr] Don't print implicit attributes
Joel E. Denny [Tue, 15 May 2018 22:16:47 +0000 (22:16 +0000)]
[Attr] Don't print implicit attributes

Fixes bug reported at:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html

Reviewed by: aaron.ballman

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

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

6 years ago[Documentation] Fix Release Notes format issues.
Eugene Zelenko [Tue, 15 May 2018 21:45:01 +0000 (21:45 +0000)]
[Documentation] Fix Release Notes format issues.

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

6 years agoDon't produce a redundant "auto type is incompatible with C++98" on every lambda...
Richard Smith [Tue, 15 May 2018 21:27:30 +0000 (21:27 +0000)]
Don't produce a redundant "auto type is incompatible with C++98" on every lambda with no explicit return type.

We already warned about the lambda, and we don't have a source location for the imagined "auto" anyway.

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

6 years agoMove helper classes into anonymous namespaces. NFCI.
Benjamin Kramer [Tue, 15 May 2018 21:26:47 +0000 (21:26 +0000)]
Move helper classes into anonymous namespaces. NFCI.

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

6 years agoAddress post-commit review comments after r328731. NFC.
Akira Hatanaka [Tue, 15 May 2018 21:00:30 +0000 (21:00 +0000)]
Address post-commit review comments after r328731. NFC.

- Define a function (canPassInRegisters) that determines whether a
record can be passed in registers based on language rules and
target-specific ABI rules.

- Set flag RecordDecl::ParamDestroyedInCallee to true in MSVC mode and
remove ASTContext::isParamDestroyedInCallee, which is no longer needed.

- Use the same type (unsigned) for RecordDecl's bit-field members.

For more background, see the following discussions that took place on
cfe-commits.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180326/223498.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180402/223688.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180409/224754.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226494.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180507/227647.html

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

6 years agoFixed some rtti-options tests.
Sunil Srivastava [Tue, 15 May 2018 18:28:42 +0000 (18:28 +0000)]
Fixed some rtti-options tests.

Certain tests in rtti-options.cpp are not really testing anything because they are testing for the absence of -frtti option to the cc1 process. Since the cc1 process does not take -frtti option, these tests are passing tautologically.

The RTTI mode is enabled by default in cc1, and -fno-rtti disables it. Therefore the correct way to check for enabling of RTTI is to check for the absence of -fno-rtti to cc1, and the correct way to check for disabling of RTTI is to check for the presence of -fno-rtti to cc1.

This patch fixes those tests.

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

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

6 years ago[Hexagon] Add driver options for subtarget features
Krzysztof Parzyszek [Tue, 15 May 2018 18:15:59 +0000 (18:15 +0000)]
[Hexagon] Add driver options for subtarget features

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

6 years ago[OPENMP, NVPTX] Do not globalize variables with reference/pointer types.
Alexey Bataev [Tue, 15 May 2018 18:01:01 +0000 (18:01 +0000)]
[OPENMP, NVPTX] Do not globalize variables with reference/pointer types.

In generic data-sharing mode we do not need to globalize
variables/parameters of reference/pointer types. They already are placed
in the global memory.

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

6 years agoupdate two comments as suggested on https://reviews.llvm.org/D46843
Nico Weber [Tue, 15 May 2018 16:37:00 +0000 (16:37 +0000)]
update two comments as suggested on https://reviews.llvm.org/D46843

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

6 years ago[clang] Update uses of DEBUG macro to LLVM_DEBUG.
Nicola Zaghen [Tue, 15 May 2018 13:30:56 +0000 (13:30 +0000)]
[clang] Update uses of DEBUG macro to LLVM_DEBUG.

The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
- git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM

Explicitly avoided changing the strings in the clang-format tests.

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

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

6 years ago[Solaris] Only define _REENTRANT if -pthread
Rainer Orth [Tue, 15 May 2018 11:36:00 +0000 (11:36 +0000)]
[Solaris] Only define _REENTRANT if -pthread

When looking at lib/Basic/Targets/OSTargets.h, I noticed that _REENTRANT is defined
unconditionally on Solaris, unlike all other targets and what either Studio cc (only define
it with -mt) or gcc (only define it with -pthread) do.

This patch follows that lead.

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

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

6 years ago[ASTImporter] Extend lookup logic in class templates
Aleksei Sidorin [Tue, 15 May 2018 11:09:07 +0000 (11:09 +0000)]
[ASTImporter] Extend lookup logic in class templates

During import of a class template, lookup may find a forward
declaration and structural match falsely reports equivalency
between a forward decl and a definition. The result is that
some definitions are not imported if we had imported a forward
decl previously. This patch gives a fix.

Patch by Gabor Marton!

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

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

6 years agoMake ast-print-record-decl.c pass on Windows after r332314
Hans Wennborg [Tue, 15 May 2018 10:19:24 +0000 (10:19 +0000)]
Make ast-print-record-decl.c pass on Windows after r332314

It was failing because on Windows, -ast-print prints
__single_inheritance(1) before T1.

Adding a triple is a stop-gap fix until it can be fixed properly.

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

6 years ago[X86] Revert part of r332266: Use __builtin_convertvector to replace some of the...
Craig Topper [Tue, 15 May 2018 03:17:52 +0000 (03:17 +0000)]
[X86] Revert part of r332266: Use __builtin_convertvector to replace some of the avx512 truncate builtins.

The masking doesn't work right in the backend for the ones that produce byte or word elements without avx512bw.

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

6 years ago[AST] Fix printing tag decl groups in decl contexts
Joel E. Denny [Tue, 15 May 2018 00:44:14 +0000 (00:44 +0000)]
[AST] Fix printing tag decl groups in decl contexts

For example, given:

  struct T1 {
    struct T2 *p0;
  };

-ast-print produced:

  struct T1 {
    struct T2;
    struct T2 *p0;
  };

Compiling that produces a warning that the first struct T2 declaration
does not declare anything.

Details:

A tag decl group is one or more decls that share a type specifier that
is a tag decl (that is, a struct/union/class/enum decl).  Within
functions, the parser builds such a tag decl group as part of a
DeclStmt.  However, in decl contexts, such as file scope or a member
list, the parser does not group together the members of a tag decl
group.  Previously, detection of tag decl groups during printing was
implemented but only if the tag decl was unnamed.  Otherwise, as in
the above example, the members of the group did not print together and
so sometimes introduced warnings.

This patch extends detection of tag decl groups in decl contexts to
any tag decl that is recorded in the AST as not free-standing.

Reviewed by: rsmith

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

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

6 years agoEnable control flow pruning of float overflow warnings.
Richard Trieu [Mon, 14 May 2018 23:21:48 +0000 (23:21 +0000)]
Enable control flow pruning of float overflow warnings.

Like other conversion warnings, allow float overflow warnings to be disabled
in known dead paths of template instantiation.  This often occurs when a
template template type is a numeric type and the template will check the
range of the numeric type before performing the conversion.

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

6 years ago[c++17] Fix assertion on synthesizing deduction guides after a fatal error.
Volodymyr Sapsai [Mon, 14 May 2018 22:49:44 +0000 (22:49 +0000)]
[c++17] Fix assertion on synthesizing deduction guides after a fatal error.

After a fatal error Sema::InstantiatingTemplate doesn't allow further
instantiation and doesn't push a CodeSynthesisContext. When we tried to
synthesize implicit deduction guides from constructors we hit the
assertion

> Assertion failed: (!CodeSynthesisContexts.empty() && "Cannot perform an instantiation without some context on the " "instantiation stack"), function SubstType, file clang/lib/Sema/SemaTemplateInstantiate.cpp, line 1580.

Fix by avoiding deduction guide synthesis if InstantiatingTemplate is invalid.

rdar://problem/39051732

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Re-apply r331096 "CStringChecker: Add support for BSD strlcpy()...".
Artem Dergachev [Mon, 14 May 2018 22:32:24 +0000 (22:32 +0000)]
[analyzer] Re-apply r331096 "CStringChecker: Add support for BSD strlcpy()...".

Fixed after revert in r331401.

Patch by David Carlier!

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

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

6 years ago[analyzer] Extend the ObjCAutoreleaseWriteChecker to warn on captures as well
George Karpenkov [Mon, 14 May 2018 21:39:54 +0000 (21:39 +0000)]
[analyzer] Extend the ObjCAutoreleaseWriteChecker to warn on captures as well

A common pattern is that the code in the block does not write into the
variable explicitly, but instead passes it to a helper function which
performs the write.

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

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

6 years ago[CodeView] Improve debugging of virtual base class member variables
Brock Wyma [Mon, 14 May 2018 21:21:22 +0000 (21:21 +0000)]
[CodeView] Improve debugging of virtual base class member variables

Initial support for passing the virtual base pointer offset to CodeViewDebug.

https://reviews.llvm.org/D46271

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

6 years agoFix test fail on some buildbots, caused by r332281.
Joel E. Denny [Mon, 14 May 2018 21:06:04 +0000 (21:06 +0000)]
Fix test fail on some buildbots, caused by r332281.

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

6 years agoFix regression in r332076.
Richard Smith [Mon, 14 May 2018 20:52:48 +0000 (20:52 +0000)]
Fix regression in r332076.

If the name after 'template' is an unresolved using declaration (not containing
'typename'), then we don't yet know if it's a valid template-name, so don't
reject it prior to instantiation. Instead, treat it as naming a dependent
member of the current instantiation.

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

6 years agoRemove the fixit for the diagnostics regarding capturing autoreleasing variables...
George Karpenkov [Mon, 14 May 2018 20:29:16 +0000 (20:29 +0000)]
Remove the fixit for the diagnostics regarding capturing autoreleasing variables in a block

The fixit is actively harmful, as it encourages developers to ignore the
warning and to write unsafe code.
It is almost impossible to write safe code while capturing autoreleasing
variables in the block, as in order to check that the block is never
called in the autoreleasing pool the developer has to check the
transitive closure of all potential callers of the block.

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

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

6 years ago[Tooling] Pull #include manipulation code from clangFormat into libToolingCore.
Eric Liu [Mon, 14 May 2018 20:17:53 +0000 (20:17 +0000)]
[Tooling] Pull #include manipulation code from clangFormat into libToolingCore.

Summary: Also pull #include related style out of FormatStyle as tooling::IncludeStyle.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, mgorny, cfe-commits, djasper

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

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

6 years agoPR37450: Fix bug that disabled some type checks for variables with deduced types.
Richard Smith [Mon, 14 May 2018 20:15:04 +0000 (20:15 +0000)]
PR37450: Fix bug that disabled some type checks for variables with deduced types.

Also improve diagnostic for the case where a type is non-literal because it's a lambda.

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

6 years ago[clang-format] Move #include related style to libToolingCore
Eric Liu [Mon, 14 May 2018 19:51:33 +0000 (19:51 +0000)]
[clang-format] Move #include related style to libToolingCore

Summary: This will be shared by include insertion/deletion library.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, klimek, cfe-commits

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

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

6 years ago[AST] Print correct tag decl for tag specifier
Joel E. Denny [Mon, 14 May 2018 19:36:45 +0000 (19:36 +0000)]
[AST] Print correct tag decl for tag specifier

For example, given:

  void fn() {
    struct T *p0;
    struct T { int i; } *p1;
  }

-ast-print produced:

  void fn() {
    struct T { int i; } *p0;
    struct T { int i; } *p1;
  }

Compiling that fails with a redefinition error.

Given:

  void fn() {
    struct T *p0;
    struct __attribute__((deprecated)) T *p1;
  }

-ast-print dropped the attribute.

Details:

For a tag specifier (that is, struct/union/class/enum used as a type
specifier in a declaration) that was also a tag declaration (that is,
first occurrence of the tag) or tag redeclaration (that is, later
occurrence that specifies attributes or a member list), clang printed
the tag specifier as either (1) the full tag definition if one
existed, or (2) the first tag declaration otherwise.  Redefinition
errors were sometimes introduced, as in the first example above.  Even
when that was impossible because no member list was ever specified,
attributes were sometimes lost, thus changing semantics and
diagnostics, as in the second example above.

This patch fixes a major culprit for these problems.  It does so by
creating an ElaboratedType with a new OwnedDecl member wherever an
occurrence of a tag type is a (re)declaration of that tag type.
PrintingPolicy's IncludeTagDefinition used to trigger printing of the
member list, attributes, etc. for a tag specifier by using a tag
(re)declaration selected as described above.  Now, it triggers the
same thing except it uses the tag (re)declaration stored in the
OwnedDecl.  Of course, other tooling can now make use of the new
OwnedDecl as well.

Also, to be more faithful to the original source, this patch
suppresses printing of attributes inherited from previous
declarations.

Reviewed by: rsmith, aaron.ballman

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

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

6 years agoCodeGen: Emit string literal in constant address space
Yaxun Liu [Mon, 14 May 2018 19:20:12 +0000 (19:20 +0000)]
CodeGen: Emit string literal in constant address space

Some targets have constant address space (e.g. amdgcn). For them string literal should be
emitted in constant address space then casted to default address space.

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

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

6 years ago[AST] Fix -ast-print for _Bool when have diagnostics
Joel E. Denny [Mon, 14 May 2018 18:41:44 +0000 (18:41 +0000)]
[AST] Fix -ast-print for _Bool when have diagnostics

For example, given:

  #define bool _Bool
  _Bool i;
  void fn() { 1; }

-ast-print produced:

  tmp.c:3:13: warning: expression result unused
  void fn() { 1; }
              ^
  bool i;
  void fn() {
      1;
  }

That fails to compile because bool is undefined.

Details:

Diagnostics print _Bool as bool when the latter is defined as the
former.  However, diagnostics were altering the printing policy for
-ast-print as well.  The printed source was then invalid because the
preprocessor eats the bool definition.

Problematic diagnostics included suppressed warnings (e.g., add
-Wno-unused-value to the above example), including those that are
suppressed by default.

This patch fixes this bug and cleans up some related comments.

Reviewed by: aaron.ballman, rsmith

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

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

6 years ago[X86] Use __builtin_convertvector to replace some of the avx512 truncate builtins.
Craig Topper [Mon, 14 May 2018 17:50:40 +0000 (17:50 +0000)]
[X86] Use __builtin_convertvector to replace some of the avx512 truncate builtins.

As long as the destination type is a 256 or 128 bit vector with the same number of elements we can use __builtin_convertvector to directly generate trunc IR instruction which will be handled natively by the backend.

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

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

6 years ago[ASTImporter] Turn StringRefs back to std::strings to avoid use-after-free
Aleksei Sidorin [Mon, 14 May 2018 16:12:31 +0000 (16:12 +0000)]
[ASTImporter] Turn StringRefs back to std::strings to avoid use-after-free

This is a workaround for the issue in buildASTFromCodeWithArgs()
where a local buffer can be used to store the program text
referred by SourceManager.
FIXME: Fix the root issue in buildASTFromCodeWithArgs().

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

6 years ago[CodeComplete] Provide completion in decls even for incomplete types
Ilya Biryukov [Mon, 14 May 2018 13:50:36 +0000 (13:50 +0000)]
[CodeComplete] Provide completion in decls even for incomplete types

Summary:
This change fixes lack of completions in the following case
('^'designates completion points) :

    void f(^);
    struct Incomplete;
    Incomplete g(^);

Reviewers: bkramer, aaron.ballman, sammccall

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years agoRedirect output to /dev/null in the tests added in r332160.
Eric Liu [Mon, 14 May 2018 12:07:56 +0000 (12:07 +0000)]
Redirect output to /dev/null in the tests added in r332160.

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

6 years agoRevert "[CodeGen] Disable aggressive structor optimizations at -O0"
Pavel Labath [Mon, 14 May 2018 11:35:44 +0000 (11:35 +0000)]
Revert "[CodeGen] Disable aggressive structor optimizations at -O0"

It breaks the sanitizer build
<http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/23739>

This reverts commit r332228.

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

6 years ago[CodeGen] Disable aggressive structor optimizations at -O0
Pavel Labath [Mon, 14 May 2018 11:02:23 +0000 (11:02 +0000)]
[CodeGen] Disable aggressive structor optimizations at -O0

Summary:
Removing the full structor and replacing all usages with the base one
can degrade debug quality as it will leave the debugger unable to locate
the full object structor. This is apparent when evaluating an expression
in the debugger which requires constructing an object of class which has
had this optimization applied to it.  When compiling the expression, we
pretend that the class and its methods have been defined in another
compilation unit, so the expression compiler assumes the structor
definition must be available. This didn't use to be the case for
structors with internal linkage. Less aggressive optimizations like
emitting the full structor as an alias remain in place, as they do not
cause the structor symbol to disappear completely.

This improves debug quality on non-darwin platforms (darwin does not
have -mconstructor-aliases on by default, so it is spared these
problems) and enable us to remove some workarounds from LLDB which attempt to
mitigate this issue.

Reviewers: rjmccall, aprantl

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Continue after non-scope-closers in getLengthToMatchingParen
Krasimir Georgiev [Mon, 14 May 2018 10:33:40 +0000 (10:33 +0000)]
[clang-format] Continue after non-scope-closers in getLengthToMatchingParen

Summary:
This fixes a regression introduced by `r331857` where we stop the search for
the End token as soon as we hit a non-scope-closer, which prematurely stops before
semicolons for example, which should otherwise be considered as part of the unbreakable tail.

Subscribers: klimek, cfe-commits

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

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

6 years ago[RISCV][NFC] Use more appropriate label for CHECK lines
Alex Bradbury [Mon, 14 May 2018 09:14:43 +0000 (09:14 +0000)]
[RISCV][NFC] Use more appropriate label for CHECK lines

'CC1' was a misleading prefix. Committing so as to simplify the diff for a
patch I'm about to put up for review.

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

6 years ago[X86] Use select instrution and fpextend in the implementation of _mm512_mask_cvtps_p...
Craig Topper [Mon, 14 May 2018 04:57:46 +0000 (04:57 +0000)]
[X86] Use select instrution and fpextend in the implementation of _mm512_mask_cvtps_pd and _mm512_maskz_cvtps_pd.

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

6 years ago[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.
Craig Topper [Mon, 14 May 2018 04:05:06 +0000 (04:05 +0000)]
[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.

If we're using default rounding mode we can let __builtin_convertvector to generate an fpextend. This matches 128 and 256 bit.

If we're using the version that takes an explicit rounding mode argument we would need to look at the immediate to see if its CUR_DIRECTION.

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

6 years ago[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu6...
Craig Topper [Sun, 13 May 2018 23:03:30 +0000 (23:03 +0000)]
[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu64_ss.

We can use direct C code for these that will use uitofp and insertelement instructions.

For the versions that take an explicit rounding mode we can't do this.

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

6 years agoAdded atomic_fetch_min, max, umin, umax intrinsics to clang.
Elena Demikhovsky [Sun, 13 May 2018 07:45:58 +0000 (07:45 +0000)]
Added atomic_fetch_min, max, umin, umax intrinsics to clang.

These intrinsics work exactly as all other atomic_fetch_* intrinsics and allow to create *atomicrmw* with ordering.
Updated the clang-extensions document.

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

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

6 years agoAdd requirement of x86 target for test.
Douglas Yung [Sat, 12 May 2018 00:39:17 +0000 (00:39 +0000)]
Add requirement of x86 target for test.

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

6 years agoForce the PS4 clang ABI version to 6.
Douglas Yung [Sat, 12 May 2018 00:06:59 +0000 (00:06 +0000)]
Force the PS4 clang ABI version to 6.

The PS4 requires clang ABI version 6 for compatibility reasons. This change forces this and if the user specifies a different version when the PS4 target is specified, the compiler emits a warning that the specified version is being ignored.

Reviewers: probinson

Subscribers: cfe-commits

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

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

6 years ago[Driver] Only use -lc++ on Fuchsia
Petr Hosek [Fri, 11 May 2018 20:42:31 +0000 (20:42 +0000)]
[Driver] Only use -lc++ on Fuchsia

The fact that libc++ depends on libc++abi and libunwind is an internal
detail that's captured by the libc++.so linker script.

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

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