]> granicus.if.org Git - clang/log
clang
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

6 years ago[analyzer] Ignore the nullability quantifiers for autoreleasewritechecker
George Karpenkov [Fri, 11 May 2018 20:39:19 +0000 (20:39 +0000)]
[analyzer] Ignore the nullability quantifiers for autoreleasewritechecker

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

6 years ago[analyzer] Fix the filename for the exploration_order test.
George Karpenkov [Fri, 11 May 2018 20:38:39 +0000 (20:38 +0000)]
[analyzer] Fix the filename for the exploration_order test.

Ensures that the test is being run.

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

6 years ago[libclang] Stop assuming that the internal C++ ABI ExceptionSpecificationType enumera...
Richard Smith [Fri, 11 May 2018 19:46:31 +0000 (19:46 +0000)]
[libclang] Stop assuming that the internal C++ ABI ExceptionSpecificationType enumeration is the same as CXCursor_ExceptionSpecificationKind.

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

6 years ago[OPENMP, NVPTX] Do not use SPMD mode for target simd and target teams
Alexey Bataev [Fri, 11 May 2018 19:45:14 +0000 (19:45 +0000)]
[OPENMP, NVPTX] Do not use SPMD mode for target simd and target teams
distribute simd directives.

Directives `target simd` and `target teams distribute simd` must be
executed in non-SPMD mode.

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

6 years ago[HIP] Set proper triple and offload kind for the toolchain
Yaxun Liu [Fri, 11 May 2018 19:21:39 +0000 (19:21 +0000)]
[HIP] Set proper triple and offload kind for the toolchain

Also introduce --hip-link option to indicate HIP for linking.

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

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

6 years ago[HIP] Diagnose unsupported host triple
Yaxun Liu [Fri, 11 May 2018 19:14:34 +0000 (19:14 +0000)]
[HIP] Diagnose unsupported host triple

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

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

6 years ago[HIP] Let clang-offload-bundler support HIP
Yaxun Liu [Fri, 11 May 2018 19:02:18 +0000 (19:02 +0000)]
[HIP] Let clang-offload-bundler support HIP

When bundle/unbundle intermediate files for HIP, there may be multiple
sub archs, therefore BoundArch needs to be included in the target
and output file names for clang-offload-bundler.

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

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

6 years ago[X86] Fix the file header name on fmaintrin.h
Craig Topper [Fri, 11 May 2018 17:37:40 +0000 (17:37 +0000)]
[X86] Fix the file header name on fmaintrin.h

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

6 years ago[Hexagon] Implement checking arguments of builtin calls
Krzysztof Parzyszek [Fri, 11 May 2018 16:41:51 +0000 (16:41 +0000)]
[Hexagon] Implement checking arguments of builtin calls

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

6 years ago[X86] Assume alignment of movdir64b dst argument
Gabor Buella [Fri, 11 May 2018 14:22:04 +0000 (14:22 +0000)]
[X86] Assume alignment of movdir64b dst argument

Reviewers: craig.topper

Reviewed By: craig.topper

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

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

6 years agoImprove diagnostics and error recovery for template name lookup.
Richard Smith [Fri, 11 May 2018 02:43:08 +0000 (02:43 +0000)]
Improve diagnostics and error recovery for template name lookup.

For 'x::template y', consistently give a "no member named 'y' in 'x'"
diagnostic if there is no such member, and give a 'template keyword not
followed by a template' name error if there is such a member but it's not a
template. In the latter case, add a note pointing at the non-template.

Don't suggest inserting a 'template' keyword in 'X::Y<' if X is dependent
if the lookup of X::Y was actually not a dependent lookup and found only
non-templates.

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

6 years agoDon't propagate dllimport to base class template static data members
Reid Kleckner [Fri, 11 May 2018 01:26:11 +0000 (01:26 +0000)]
Don't propagate dllimport to base class template static data members

MSVC doesn't, so we shouldn't. Fixes PR37232.

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

6 years agoSupport XRay in the NetBSD driver
Kamil Rytarowski [Fri, 11 May 2018 01:00:38 +0000 (01:00 +0000)]
Support XRay in the NetBSD driver

Summary:
While there, perform a small cleanup, reducing delta
with drivers for other OSes.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, dberris

Reviewed By: dberris

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

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

6 years agoPermit -fxray-instrument for NetBSD/amd64
Kamil Rytarowski [Fri, 11 May 2018 00:58:55 +0000 (00:58 +0000)]
Permit -fxray-instrument for NetBSD/amd64

Summary:
Use the same branch as FreeBSD and OpenBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dberris, vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, llvm-commits

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

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

6 years ago[clang-cl] Make -f[no-]coverage-mapping available
Reid Kleckner [Thu, 10 May 2018 22:24:00 +0000 (22:24 +0000)]
[clang-cl] Make -f[no-]coverage-mapping available

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

6 years agoimplementing Cursor.get_included_file in python bindings
Jonathan Coe [Thu, 10 May 2018 21:39:29 +0000 (21:39 +0000)]
implementing Cursor.get_included_file in python bindings

Summary:
adding function: `Cursor.get_included_file` , so the C API's `clang_getIncludedFile` function is available on the python binding interface
also adding test to unittests

related ticket: https://bugs.llvm.org/show_bug.cgi?id=15223

Reviewers: mgorny, arphaman, jbcoe

Reviewed By: jbcoe

Subscribers: cfe-commits

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

Patch by jlaz (József Láz)

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

6 years ago[Itanium] Emit type info names with external linkage.
Eric Fiselier [Thu, 10 May 2018 19:51:56 +0000 (19:51 +0000)]
[Itanium] Emit type info names with external linkage.

Summary:
The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed.  Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos.
For example:

```
// header.h
struct T;
extern std::type_info const& Info;

// tu_one.cpp
#include "header.h"
std::type_info const& Info = typeid(T*);

// tu_two.cpp
#include "header.h"
struct T {};
int main() {
  auto &TI1 = Info;
  auto &TI2 = typeid(T*);
  assert(TI1 == TI2); // Fails
  assert(TI1.hash_code() == TI2.hash_code()); // Fails
}
```

This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type.

Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to:

(A) Always perform strcmp/string hashes.
(B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++.

Reviewers: rsmith, rjmccall, majnemer, vsapsai

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

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

6 years agoReland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'
Julie Hockett [Thu, 10 May 2018 19:05:36 +0000 (19:05 +0000)]
Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'

This commit relands r331904.

Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are
system
headers.

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

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

6 years agoAllow dllimport non-type template arguments in C++17
Reid Kleckner [Thu, 10 May 2018 18:57:35 +0000 (18:57 +0000)]
Allow dllimport non-type template arguments in C++17

Summary:
Fixes PR35772.

Reviewers: rsmith

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

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

6 years ago[OPENMP, NVPTX] Initial support for L2 parallelism in SPMD mode.
Alexey Bataev [Thu, 10 May 2018 18:32:08 +0000 (18:32 +0000)]
[OPENMP, NVPTX] Initial support for L2 parallelism in SPMD mode.

Added initial support for L2 parallelism in SPMD mode. Note, though,
that the orphaned parallel directives are not currently supported in
SPMD mode.

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

6 years agoThis patch provides that bitfields are splitted even in case
Strahinja Petrovic [Thu, 10 May 2018 12:31:12 +0000 (12:31 +0000)]
This patch provides that bitfields are splitted even in case
when current field is not legal integer type.

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

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

6 years agoAdd support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Sylvestre Ledru [Thu, 10 May 2018 08:45:43 +0000 (08:45 +0000)]
Add support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Patch by Adam Conrad

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

6 years agoRevert "[Itanium] Emit type info names with external linkage."
Eric Fiselier [Thu, 10 May 2018 08:10:57 +0000 (08:10 +0000)]
Revert "[Itanium] Emit type info names with external linkage."

This reverts commit r331957. It seems to be causing failures
on ppc64le-linux.

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

6 years ago[X86] ptwrite intrinsic
Gabor Buella [Thu, 10 May 2018 07:28:54 +0000 (07:28 +0000)]
[X86] ptwrite intrinsic

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper

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

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

6 years ago[X86] Change the implementation of scalar masked load/store intrinsics to not use...
Craig Topper [Thu, 10 May 2018 05:43:43 +0000 (05:43 +0000)]
[X86] Change the implementation of scalar masked load/store intrinsics to not use a 512-bit intermediate vector.

This is unnecessary for AVX512VL supporting CPUs like SKX. We can just emit a 128-bit masked load/store here no matter what. The backend will widen it to 512-bits on KNL CPUs.

Fixes the frontend portion of PR37386. Need to fix the backend to optimize the new sequences well.

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

6 years ago[Itanium] Emit type info names with external linkage.
Eric Fiselier [Thu, 10 May 2018 05:25:15 +0000 (05:25 +0000)]
[Itanium] Emit type info names with external linkage.

Summary:
The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed.  Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos.
For example:

```
// header.h
struct T;
extern std::type_info const& Info;

// tu_one.cpp
#include "header.h"
std::type_info const& Info = typeid(T*);

// tu_two.cpp
#include "header.h"
struct T {};
int main() {
  auto &TI1 = Info;
  auto &TI2 = typeid(T*);
  assert(TI1 == TI2); // Fails
  assert(TI1.hash_code() == TI2.hash_code()); // Fails
}
```

This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type.

Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to:

(A) Always perform strcmp/string hashes.
(B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++.

Reviewers: rsmith, rjmccall, majnemer, vsapsai

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

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