]> granicus.if.org Git - clang/log
clang
6 years ago[Support] Avoid normalization in sys::getDefaultTargetTriple
Petr Hosek [Fri, 25 May 2018 20:39:37 +0000 (20:39 +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/D47153

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

6 years agoConvert clang-interpreter to ORC JIT API
Stephane Sezer [Fri, 25 May 2018 20:23:42 +0000 (20:23 +0000)]
Convert clang-interpreter to ORC JIT API

Summary: This mostly re-uses code from the KaleidoscopeJIT example.

Reviewers: ddunbar, lhames

Reviewed By: lhames

Subscribers: mgrang, alexshap, mgorny, xiaobai, cfe-commits

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

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

6 years ago[OPENMP, NVPTX] Fixed codegen for orphaned parallel region.
Alexey Bataev [Fri, 25 May 2018 20:16:03 +0000 (20:16 +0000)]
[OPENMP, NVPTX] Fixed codegen for orphaned parallel region.

If orphaned parallel region is found, the next code must be emitted:
```
if(__kmpc_is_spmd_exec_mode() || __kmpc_parallel_level(loc, gtid))
  Serialized execution.
else if (IsMasterThread())
  Prepare and signal worker.
else
  Outined function call.
```

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

6 years agoFollow-up fix for nonnull atomic non-member functions
JF Bastien [Fri, 25 May 2018 17:36:49 +0000 (17:36 +0000)]
Follow-up fix for nonnull atomic non-member functions

Handling of the third parameter was only checking for *_n and not for the C11 variant, which means that cmpxchg of a 'desired' 0 value was erroneously warning. Handle C11 properly, and add extgensive tests for this as well as NULL pointers in a bunch of places.

Fixes r333246 from D47229.

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

6 years ago[Sema] Add tests for weak functions
Jonas Hahnfeld [Fri, 25 May 2018 15:56:12 +0000 (15:56 +0000)]
[Sema] Add tests for weak functions

I found these checks to be missing, just add some simple cases.

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

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

6 years ago[analyzer] Added a getLValue method to ProgramState for bases
Kristof Umann [Fri, 25 May 2018 14:48:33 +0000 (14:48 +0000)]
[analyzer] Added a getLValue method to ProgramState for bases

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

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

6 years agoFix members initialization order in constructor (fails with -Werror)
Ivan Donchevskii [Fri, 25 May 2018 13:46:07 +0000 (13:46 +0000)]
Fix members initialization order in constructor (fails with -Werror)

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

6 years ago[analyzer] Added template argument lists to the Pathdiagnostic output
Kristof Umann [Fri, 25 May 2018 13:18:38 +0000 (13:18 +0000)]
[analyzer] Added template argument lists to the Pathdiagnostic output

Because template parameter lists were not displayed
in the plist output, it was difficult to decide in
some cases whether a given checker found a true or a
false positive. This patch aims to correct this.

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

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

6 years agoOptionally add code completion results for arrow instead of dot
Ivan Donchevskii [Fri, 25 May 2018 12:56:26 +0000 (12:56 +0000)]
Optionally add code completion results for arrow instead of dot

Currently getting such completions requires source correction, reparsing
and calling completion again. And if it shows no results and rollback is
required then it costs one more reparse.

With this change it's possible to get all results which can be later
filtered to split changes which require correction.

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

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

6 years ago[ASTImporter] Fix ClassTemplateSpecialization in wrong DC
Gabor Marton [Fri, 25 May 2018 11:21:24 +0000 (11:21 +0000)]
[ASTImporter] Fix ClassTemplateSpecialization in wrong DC

Summary:
ClassTemplateSpecialization is put in the wrong DeclContex if implicitly
instantiated. This patch fixes it.

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

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[x86] invpcid intrinsic
Gabor Buella [Fri, 25 May 2018 06:34:42 +0000 (06:34 +0000)]
[x86] invpcid intrinsic

An intrinsic for an old instruction, as described in the Intel SDM.

Reviewers: craig.topper, rnk

Reviewed By: craig.topper, rnk

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

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

6 years agoMake atomic non-member functions as nonnull
JF Bastien [Fri, 25 May 2018 00:07:09 +0000 (00:07 +0000)]
Make atomic non-member functions as nonnull

Summary:
As a companion to libc++ patch https://reviews.llvm.org/D47225, mark builtin atomic non-member functions which accept pointers as nonnull.

The atomic non-member functions accept pointers to std::atomic / std::atomic_flag as well as to the non-atomic value. These are all dereferenced unconditionally when lowered, and therefore will fault if null. It's a tiny gotcha for new users, especially when they pass in NULL as expected value (instead of passing a pointer to a NULL value).

<rdar://problem/18473124>

Reviewers: arphaman

Subscribers: aheejin, cfe-commits

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

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

6 years agoImprove diagonstic for braced-init-list as operand to ?: expression.
Richard Smith [Thu, 24 May 2018 22:02:52 +0000 (22:02 +0000)]
Improve diagonstic for braced-init-list as operand to ?: expression.

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

6 years agoSwitch a couple of users of LangOpts::GNUMode to the more appropriate LangOpts::GNUKe...
Richard Smith [Thu, 24 May 2018 21:51:52 +0000 (21:51 +0000)]
Switch a couple of users of LangOpts::GNUMode to the more appropriate LangOpts::GNUKeywords.

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

6 years agoImprove diagnostics for config mismatches with -fmodule-file.
Richard Smith [Thu, 24 May 2018 20:03:51 +0000 (20:03 +0000)]
Improve diagnostics for config mismatches with -fmodule-file.

Unless the user uses -Wno-module-file-config-mismatch (or -Wno-error=...),
allow the AST reader to produce errors describing the nature of the config
mismatch.

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

6 years ago[X86] Fix a bad cast in _mm512_mask_abs_epi32 and _mm512_maskz_abs_epi32.
Craig Topper [Thu, 24 May 2018 17:32:49 +0000 (17:32 +0000)]
[X86] Fix a bad cast in _mm512_mask_abs_epi32 and _mm512_maskz_abs_epi32.

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

6 years ago[bash-completion] Fix tab separation on macOS
Ben Langmuir [Thu, 24 May 2018 16:25:40 +0000 (16:25 +0000)]
[bash-completion] Fix tab separation on macOS

We have a regex that needs to match a tab character in the command
output, but on macOS sed doesn't support '\t', causing it to split on
the 't' character instead. Fix by having bash expand the \t first.

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

6 years agoDisable an in-memory vfs file path test on windows.
Eric Liu [Thu, 24 May 2018 13:52:48 +0000 (13:52 +0000)]
Disable an in-memory vfs file path test on windows.

The test uses unix paths and doesn't make sense to run on windows.

Fix bot failure caused by r333172:
 http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10799

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

6 years ago[analyzer] Move RangeSet related declarations into the RangedConstraintManager header.
Mikhail R. Gadelha [Thu, 24 May 2018 12:16:35 +0000 (12:16 +0000)]
[analyzer] Move RangeSet related declarations into the RangedConstraintManager header.

Summary: I could also move `RangedConstraintManager.h` under `include/` if you agree as it seems slightly out of place under `lib/`.

Patch by Réka Kovács

Reviewers: NoQ, george.karpenkov, dcoughlin, rnkovacs

Reviewed By: NoQ

Subscribers: mikhail.ramalho, whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, dkrupp, cfe-commits

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

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

6 years ago[VFS] Implement getRealPath in InMemoryFileSystem.
Eric Liu [Thu, 24 May 2018 11:17:00 +0000 (11:17 +0000)]
[VFS] Implement getRealPath in InMemoryFileSystem.

Reviewers: bkramer

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Fix putting ObjC message arguments in one line for multiline receiver
Jacek Olesiak [Thu, 24 May 2018 10:50:36 +0000 (10:50 +0000)]
[clang-format] Fix putting ObjC message arguments in one line for multiline receiver

Summary:
Reapply reverted changes from D46879.

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, krasimir

Reviewed By: benhamilton, krasimir

Subscribers: djasper, klimek, cfe-commits

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

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

6 years agoFix ASTImporterTest on Windows after r333082
Hans Wennborg [Thu, 24 May 2018 10:49:38 +0000 (10:49 +0000)]
Fix ASTImporterTest on Windows after r333082

With MS compatibility, Sema adds an implicit definition of type_info,
which was causing the matchers to return 3 instead of 2.

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

6 years ago[ASTImporter] Add unit tests for structural equivalence
Gabor Marton [Thu, 24 May 2018 08:41:07 +0000 (08:41 +0000)]
[ASTImporter] Add unit tests for structural equivalence

Summary:
This patch add new tests for structural equivalence. For that a new
common header is created which holds the test related language specific
types and functions.

Reviewers: a.sidorin, xazax.hun, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[X86] NFC Include immintrin.h in CodeGen tests
Gabor Buella [Thu, 24 May 2018 07:09:08 +0000 (07:09 +0000)]
[X86] NFC Include immintrin.h in CodeGen tests

Following r333110:
"Move all Intel defined intrinsic includes into immintrin.h"

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

6 years ago [Sparc] Use the leon arch for Leon3's when using an external assembler
Daniel Cederman [Thu, 24 May 2018 06:16:02 +0000 (06:16 +0000)]
 [Sparc] Use the leon arch for Leon3's when using an external assembler

Summary: This allows the use of the casa instruction available in most Leon3's.

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: joerg, fedor.sergeev, jrtc27, cfe-commits

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

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

6 years agoAdd Builtins.def support for fread and fwrite to ensure that -fno-builtin-
Eric Christopher [Thu, 24 May 2018 06:09:28 +0000 (06:09 +0000)]
Add Builtins.def support for fread and fwrite to ensure that -fno-builtin-
works with them and test accordingly.

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

6 years agoMigrate libcalls-fno-builtin.c test from checking optimized assembly
Eric Christopher [Thu, 24 May 2018 06:00:50 +0000 (06:00 +0000)]
Migrate libcalls-fno-builtin.c test from checking optimized assembly
to checking for attributes on the call site - and fix up builtin
functions that we were testing for but not ensuring wouldn't be
optimized by the backend.

Leave one set of asm tests to make sure that we're also communicating
builtin-ness to TLI.

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

6 years ago[Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExpr
Steven Wu [Thu, 24 May 2018 01:01:43 +0000 (01:01 +0000)]
[Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExpr

Summary:
Remove the call to DiagnoseUseOfDecl in LookupMemberExpr because:
1. LookupMemberExpr eagerly lookup both getter and setter, reguardless
if they are used or not. It causes wrong diagnostics if you are only
using getter.
2. LookupMemberExpr only diagnoses getter, but not setter.
3. ObjCPropertyOpBuilder already DiagnoseUseOfDecl when building getter
and setter. Doing it again in LookupMemberExpr causes duplicated
diagnostics.

rdar://problem/38479756

Reviewers: erik.pilkington, arphaman, doug.gregor

Reviewed By: arphaman

Subscribers: cfe-commits

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

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

6 years agoUse zeroinitializer for (trailing zero portion of) large array initializers
Richard Smith [Wed, 23 May 2018 23:41:38 +0000 (23:41 +0000)]
Use zeroinitializer for (trailing zero portion of) large array initializers
more reliably.

This re-commits r333044 with a fix for PR37560.

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

6 years agoRework __builtin_classify_type support to better match GCC and to not assert on
Richard Smith [Wed, 23 May 2018 21:18:00 +0000 (21:18 +0000)]
Rework __builtin_classify_type support to better match GCC and to not assert on
unusual types.

Following the observed behavior of GCC, we now return -1 for vector types
(along with all of our extensions that GCC doesn't support), and for atomic
types we classify the underlying type.

GCC appears to have changed its classification for function and array arguments
between version 5 and version 6. Previously it would classify them as pointers
in C and as functions or arrays in C++, but from version 6 onwards, it
classifies them as pointers. We now follow the more recent GCC behavior rather
than emulating what I can only assume to be a historical bug in their C++
support for this builtin.

Finally, no version of GCC that I can find has ever used the "method"
classification for C++ pointers to member functions. Instead, GCC classifies
them as record types, presumably reflecting an internal implementation detail,
but whatever the reason we now produce compatible results.

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

6 years ago[X86] Move the include of clzerointrin.h from immintrin.h back to x86intrin.h.
Craig Topper [Wed, 23 May 2018 21:04:26 +0000 (21:04 +0000)]
[X86] Move the include of clzerointrin.h from immintrin.h back to x86intrin.h.

This is an AMD intrinsic not an Intel intrinsic so it shouldn't be in immintrin.h

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

6 years ago[modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual
Raphael Isemann [Wed, 23 May 2018 20:59:46 +0000 (20:59 +0000)]
[modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual

Summary:
Since clang r332929 these two headers throw errors when included from somewhere else than their wrapper header. It seems marking them as textual is the best way to fix the builds.

Fixes this new module build error:
    While building module '_Builtin_intrinsics' imported from ...:
    In file included from <module-includes>:2:
    In file included from lib/clang/7.0.0/include/immintrin.h:54:
    In file included from lib/clang/7.0.0/include/wmmintrin.h:29:
    lib/clang/7.0.0/include/__wmmintrin_aes.h:25:2: error: "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."
    #error "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."

Reviewers: rsmith, v.g.vassilev, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

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

6 years ago[X86] Move all Intel defined intrinsic includes into immintrin.h
Craig Topper [Wed, 23 May 2018 18:32:58 +0000 (18:32 +0000)]
[X86] Move all Intel defined intrinsic includes into immintrin.h

This matches the Intel documentation which shows them available by importing immintrin.h. x86intrin.h also includes immintrin.h so anyone including x86intrin.h will still get them.

This is different than gcc, but I don't think we were a perfect match there already. I'm unclear what gcc's policy is about how they choose which to add things to.

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

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

6 years ago[CUDA] Fixed the list of GPUs supported by CUDA-9.
Artem Belevich [Wed, 23 May 2018 16:45:23 +0000 (16:45 +0000)]
[CUDA] Fixed the list of GPUs supported by CUDA-9.

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

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

6 years agoTest Commit. Fix namespace comment
Mikhail R. Gadelha [Wed, 23 May 2018 15:49:12 +0000 (15:49 +0000)]
Test Commit. Fix namespace comment

Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333094 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang-format] fix buildbots after r333085
Krasimir Georgiev [Wed, 23 May 2018 15:21:33 +0000 (15:21 +0000)]
[clang-format] fix buildbots after r333085

Old gcc versions don't like raw string literals in macros.

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

6 years ago[ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl
Gabor Marton [Wed, 23 May 2018 14:24:02 +0000 (14:24 +0000)]
[ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl

Summary:
Currently we do not import the implicit CXXRecordDecl of a
ClassTemplateSpecializationDecl. This patch fixes it.

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

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format] Break template declarations followed by comments
Krasimir Georgiev [Wed, 23 May 2018 14:18:19 +0000 (14:18 +0000)]
[clang-format] Break template declarations followed by comments

Summary:
This patch fixes two bugs in clang-format where the template wrapper doesn't skip over
comments causing a long template declaration to not be split into multiple lines.
These were latent and exposed by r332436.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

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

6 years agoFix duplicate class template definitions problem
Gabor Marton [Wed, 23 May 2018 13:53:36 +0000 (13:53 +0000)]
Fix duplicate class template definitions problem

Summary:
We fail to import a `ClassTemplateDecl` if the "To" context already
contains a definition and then a forward decl.  This is because
`localUncachedLookup` does not find the definition.  This is not a
lookup error, the parser behaves differently than assumed in the
importer code.  A `DeclContext` contains one DenseMap (`LookupPtr`)
which maps names to lists.  The list is a special list `StoredDeclsList`
which is optimized to have one element.  During building the initial
AST, the parser first adds the definition to the `DeclContext`.  Then
during parsing the second declaration (the forward decl) the parser
again calls `DeclContext::addDecl` but that will not add a new element
to the `StoredDeclsList` rarther it simply overwrites the old element
with the most recent one.  This patch fixes the error by finding the
definition in the redecl chain.  Added tests for the same issue with
`CXXRecordDecl` and with `ClassTemplateSpecializationDecl`.  These tests
pass and they pass because in `VisitRecordDecl` and in
`VisitClassTemplateSpecializationDecl` we already use
`D->getDefinition()` after the lookup.

Reviewers: a.sidorin, xazax.hun, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoTest commit
Kristof Umann [Wed, 23 May 2018 12:48:55 +0000 (12:48 +0000)]
Test commit

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

6 years agoFix unaligned memory access when reading INPUT_FILE_OFFSETS data
Raphael Isemann [Wed, 23 May 2018 09:02:40 +0000 (09:02 +0000)]
Fix unaligned memory access when reading INPUT_FILE_OFFSETS data

Summary: The blob data is unaligned, so we also should read it as such. Should fix the random failures with the sanitizer builds.

Reviewers: rsmith, v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

6 years agoRevert r333044 "Use zeroinitializer for (trailing zero portion of) large array initia...
Hans Wennborg [Wed, 23 May 2018 08:24:01 +0000 (08:24 +0000)]
Revert r333044 "Use zeroinitializer for (trailing zero portion of) large array initializers"

It caused asserts, see PR37560.

> Use zeroinitializer for (trailing zero portion of) large array initializers
> more reliably.
>
> Clang has two different ways it emits array constants (from InitListExprs and
> from APValues), and both had some ability to emit zeroinitializer, but neither
> was able to catch all cases where we could use zeroinitializer reliably. In
> particular, emitting from an APValue would fail to notice if all the explicit
> array elements happened to be zero. In addition, for large arrays where only an
> initial portion has an explicit initializer, we would emit the complete
> initializer (which could be huge) rather than emitting only the non-zero
> portion. With this change, when the element would have a suffix of more than 8
> zero elements, we emit the array constant as a packed struct of its initial
> portion followed by a zeroinitializer constant for the trailing zero portion.
>
> In passing, I found a bug where SemaInit would sometimes walk the entire array
> when checking an initializer that only covers the first few elements; that's
> fixed here to unblock testing of the rest.
>
> Differential Revision: https://reviews.llvm.org/D47166

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

6 years ago[DOXYGEN] Formatting changes for better intrinsics documentation rendering
Ekaterina Romanova [Wed, 23 May 2018 06:33:22 +0000 (06:33 +0000)]
[DOXYGEN] Formatting changes for better intrinsics documentation rendering

(1) I added some \see cross-references to a few select intrinsics that are related (and have the same or similar semantics).

(2) pmmintrin.h, smmintrin.h, xmmintrin.h have very few minor formatting changes. They make rendering of our intrinsics documentation better.

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

6 years ago[X86] Undef the vector reduction helper macros when we're done with them.
Craig Topper [Wed, 23 May 2018 06:31:36 +0000 (06:31 +0000)]
[X86] Undef the vector reduction helper macros when we're done with them.

These are implementation helper macros we shouldn't expose them to user code if we don't need to.

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

6 years ago[X86] In the floating point max reduction intrinsics, negate infinity before feeding...
Craig Topper [Wed, 23 May 2018 05:51:52 +0000 (05:51 +0000)]
[X86] In the floating point max reduction intrinsics, negate infinity before feeding it to set1.

Previously we negated the whole vector after splatting infinity. But its better to negate the infinity before splatting. This generates IR with the negate already folded with the infinity constant.

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

6 years ago[X86] Remove mask argument from more builtins that are handled completely in CGBuilti...
Craig Topper [Wed, 23 May 2018 04:51:54 +0000 (04:51 +0000)]
[X86] Remove mask argument from more builtins that are handled completely in CGBuiltin.cpp. Just wrap a select builtin around them in the header file instead.

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

6 years ago[analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer
David Carlier [Wed, 23 May 2018 04:38:25 +0000 (04:38 +0000)]
[analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer

Again, strlc* does not return a pointer so the zero size case doest not fit.

Reviewers: NoQ, george.karpenkov

Reviewed by: NoQ

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

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

6 years agoThis is a test commit.
David Carlier [Wed, 23 May 2018 04:27:39 +0000 (04:27 +0000)]
This is a test commit.

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

6 years ago[AST][ObjC] Print implicit property expression that only has a setter without crashing
Alex Lorenz [Wed, 23 May 2018 00:52:20 +0000 (00:52 +0000)]
[AST][ObjC] Print implicit property expression that only has a setter without crashing

rdar://40447209

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

6 years agoUse zeroinitializer for (trailing zero portion of) large array initializers
Richard Smith [Wed, 23 May 2018 00:09:29 +0000 (00:09 +0000)]
Use zeroinitializer for (trailing zero portion of) large array initializers
more reliably.

Clang has two different ways it emits array constants (from InitListExprs and
from APValues), and both had some ability to emit zeroinitializer, but neither
was able to catch all cases where we could use zeroinitializer reliably. In
particular, emitting from an APValue would fail to notice if all the explicit
array elements happened to be zero. In addition, for large arrays where only an
initial portion has an explicit initializer, we would emit the complete
initializer (which could be huge) rather than emitting only the non-zero
portion. With this change, when the element would have a suffix of more than 8
zero elements, we emit the array constant as a packed struct of its initial
portion followed by a zeroinitializer constant for the trailing zero portion.

In passing, I found a bug where SemaInit would sometimes walk the entire array
when checking an initializer that only covers the first few elements; that's
fixed here to unblock testing of the rest.

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

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

6 years ago[CodeGen] use nsw negation for builtin abs
Sanjay Patel [Tue, 22 May 2018 23:02:13 +0000 (23:02 +0000)]
[CodeGen] use nsw negation for builtin abs

The clang builtins have the same semantics as the stdlib functions.
The stdlib functions are defined in section 7.20.6.1 of the C standard with:
"If the result cannot be represented, the behavior is undefined."

That lets us mark the negation with 'nsw' because "sub i32 0, INT_MIN" would
be UB/poison.

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

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

6 years ago[X86] As mentioned in post-commit feedback in D47174, move the 128 bit f16c intrinsic...
Craig Topper [Tue, 22 May 2018 22:19:19 +0000 (22:19 +0000)]
[X86] As mentioned in post-commit feedback in D47174, move the 128 bit f16c intrinsics into f16cintrin.h and remove __emmintrin_f16c.h

These were included in emmintrin.h to match Intel Intrinsics Guide documentation. But this is because icc is capable of emulating them on targets that don't support F16C using library calls. Clang/LLVM doesn't have this emulation support. So it makes more sense to include them in immintrin.h instead.

I've left a comment behind to hopefully deter someone from trying to move them again in the future.

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

6 years ago[X86] Remove mask argument from some builtins that are handled completely in CGBuilti...
Craig Topper [Tue, 22 May 2018 20:48:24 +0000 (20:48 +0000)]
[X86] Remove mask argument from some builtins that are handled completely in CGBuiltin.cpp. Just wrap a select builtin around them in the header file instead.

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

6 years ago[X86] Another attempt at fixing the intrinsic module map for rr333014.
Craig Topper [Tue, 22 May 2018 20:48:20 +0000 (20:48 +0000)]
[X86] Another attempt at fixing the intrinsic module map for rr333014.

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

6 years ago[X86] Add two missing #endif directives to immintrin.h that should have been in r333014.
Craig Topper [Tue, 22 May 2018 20:33:04 +0000 (20:33 +0000)]
[X86] Add two missing #endif directives to immintrin.h that should have been in r333014.

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

6 years ago[X86] Add __emmintrin_f16c.h to module map and CMakeLists.
Craig Topper [Tue, 22 May 2018 20:19:05 +0000 (20:19 +0000)]
[X86] Add __emmintrin_f16c.h to module map and CMakeLists.

I missed this in r333014

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

6 years ago[X86] Move 128-bit f16c intrinsics to __emmintrin_f16c.h include from emmintrin.h...
Craig Topper [Tue, 22 May 2018 18:54:19 +0000 (18:54 +0000)]
[X86] Move 128-bit f16c intrinsics to __emmintrin_f16c.h include from emmintrin.h. Move 256-bit f16c intrinsics back to f16cintrin.h

Intel documents the 128-bit versions as being in emmintrin.h and the 256-bit version as being in immintrin.h.

This patch makes a new __emmtrin_f16c.h to hold the 128-bit versions to be included from emmintrin.h. And makes the existing f16cintrin.h contain the 256-bit versions and include it from immintrin.h with an error if its included directly.

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

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

6 years agoReland r332885, "CodeGen, Driver: Start using direct split dwarf emission in clang."
Peter Collingbourne [Tue, 22 May 2018 18:52:37 +0000 (18:52 +0000)]
Reland r332885, "CodeGen, Driver: Start using direct split dwarf emission in clang."

As well as two follow-on commits r332906, r332911 with a fix for
test clang/test/CodeGen/split-debug-filename.c.

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

6 years agoRevert "[clang-format] Fix putting ObjC message arguments in one line for multiline...
Jacek Olesiak [Tue, 22 May 2018 16:44:42 +0000 (16:44 +0000)]
Revert "[clang-format] Fix putting ObjC message arguments in one line for multiline receiver"

Summary: Reverts D46879

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: krasimir, klimek, cfe-commits

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

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

6 years agoRevert r332982 Call CreateTempMemWithoutCast for ActiveFlag
Yaxun Liu [Tue, 22 May 2018 16:13:07 +0000 (16:13 +0000)]
Revert r332982 Call CreateTempMemWithoutCast for ActiveFlag

Due to regression on arm.

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

6 years ago[CodeGen] produce the LLVM canonical form of abs
Sanjay Patel [Tue, 22 May 2018 15:36:50 +0000 (15:36 +0000)]
[CodeGen] produce the LLVM canonical form of abs

We chose the 'slt' form as canonical in IR with:
rL332819
...so we should generate that form directly for efficiency.

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

6 years ago[CodeGen] add tests for abs builtins; NFC
Sanjay Patel [Tue, 22 May 2018 15:11:59 +0000 (15:11 +0000)]
[CodeGen] add tests for abs builtins; NFC

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

6 years agoCall CreateTempMemWithoutCast for ActiveFlag
Yaxun Liu [Tue, 22 May 2018 14:36:26 +0000 (14:36 +0000)]
Call CreateTempMemWithoutCast for ActiveFlag

Introduced CreateMemTempWithoutCast and CreateTemporaryAllocaWithoutCast to emit alloca
without casting to default addr space.

ActiveFlag is a temporary variable emitted for clean up. It is defined as AllocaInst* type and there is
a cast to AlllocaInst in SetActiveFlag. An alloca casted to generic pointer causes assertion in
SetActiveFlag.

Since there is only load/store of ActiveFlag, it is safe to use the original alloca, therefore use
CreateMemTempWithoutCast is called.

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

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

6 years ago[CodeView] Enable debugging of captured variables within C++ lambdas
Brock Wyma [Tue, 22 May 2018 12:41:19 +0000 (12:41 +0000)]
[CodeView] Enable debugging of captured variables within C++ lambdas

This change will help Visual Studio resolve forward references to C++ lambda
routines used by captured variables.

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

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

6 years ago[clang-format] Add a test case for crash
Krasimir Georgiev [Tue, 22 May 2018 11:44:03 +0000 (11:44 +0000)]
[clang-format] Add a test case for crash

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

6 years agoRevert "CodeGen, Driver: Start using direct split dwarf emission in clang."
Amara Emerson [Tue, 22 May 2018 11:18:58 +0000 (11:18 +0000)]
Revert "CodeGen, Driver: Start using direct split dwarf emission in clang."

This reverts commit r332885 as it broke several greendragon buildbots.

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

6 years agoRevert "Fix another make_unique ambiguity."
Amara Emerson [Tue, 22 May 2018 11:18:49 +0000 (11:18 +0000)]
Revert "Fix another make_unique ambiguity."

This reverts commit r332906 as a dependency to revert r332885.

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

6 years agoRevert "Add missing x86-registered-target."
Amara Emerson [Tue, 22 May 2018 11:18:43 +0000 (11:18 +0000)]
Revert "Add missing x86-registered-target."

This reverts commit r332911, as a dependency to revert r332885.

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

6 years agoclang-format: [JS] do not wrap before any `is`.
Martin Probst [Tue, 22 May 2018 10:39:07 +0000 (10:39 +0000)]
clang-format: [JS] do not wrap before any `is`.

Summary:
`is` type annotations can occur at any nesting level. For example:

    function x() {
      return function y(): a is B { ... };
    }

Breaking before the `is` above breaks TypeScript parsing the code. This
change prevents the wrap.

Reviewers: krasimir

Subscribers: klimek, cfe-commits

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

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

6 years ago[objc-gnustep2] Use unsigned char to avoid potential UB in isalnum.
David Chisnall [Tue, 22 May 2018 10:13:17 +0000 (10:13 +0000)]
[objc-gnustep2] Use unsigned char to avoid potential UB in isalnum.

Suggested by Gabor Buella.

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

6 years ago[objc-gnu] Fix test.
David Chisnall [Tue, 22 May 2018 10:13:14 +0000 (10:13 +0000)]
[objc-gnu] Fix test.

The test was implicitly capturing the local filesystem layout.

Patch by Hans Wennborg!

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

6 years ago[objc-gnustep2] Use isalnum instead of a less efficient and nonportable equivalent.
David Chisnall [Tue, 22 May 2018 10:13:11 +0000 (10:13 +0000)]
[objc-gnustep2] Use isalnum instead of a less efficient and nonportable equivalent.

Patch by Hans Wennborg!

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

6 years agoRevert "Revert r332955 "GNUstep Objective-C ABI version 2""
David Chisnall [Tue, 22 May 2018 10:13:06 +0000 (10:13 +0000)]
Revert "Revert r332955 "GNUstep Objective-C ABI version 2""

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

6 years ago[clang-format] Fix crash in getLengthToMatchingParen
Krasimir Georgiev [Tue, 22 May 2018 09:46:55 +0000 (09:46 +0000)]
[clang-format] Fix crash in getLengthToMatchingParen

Summary:
Found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8212

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

6 years agoRevert r332955 "GNUstep Objective-C ABI version 2"
Bjorn Pettersson [Tue, 22 May 2018 08:16:45 +0000 (08:16 +0000)]
Revert r332955 "GNUstep Objective-C ABI version 2"

Reverted due to buildbot failures.
Seems like isnumber() is some Apple addition to cctype.

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

6 years agoAdd cctype include.
David Chisnall [Tue, 22 May 2018 07:22:50 +0000 (07:22 +0000)]
Add cctype include.

This appears to leak in already on libc++ platforms, but is breaking on
some other targets.

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

6 years agoGNUstep Objective-C ABI version 2
David Chisnall [Tue, 22 May 2018 06:09:23 +0000 (06:09 +0000)]
GNUstep Objective-C ABI version 2

Summary:
This includes initial support for the (hopefully final) updated Objective-C ABI, developed here:

https://github.com/davidchisnall/clang-gnustep-abi-2

It also includes some cleanups and refactoring from older GNU ABIs.

The current version is ELF only, other formats to follow.

Reviewers: rjmccall, DHowett-MSFT

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

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

6 years ago[X86] Prevent inclusion of __wmmintrin_aes.h and __wmmintrin_pclmul.h without includi...
Craig Topper [Tue, 22 May 2018 02:02:13 +0000 (02:02 +0000)]
[X86] Prevent inclusion of __wmmintrin_aes.h and __wmmintrin_pclmul.h without including wmmintrin.h

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

6 years agoAdd missing include for cstdint to Visibility.h
Raphael Isemann [Mon, 21 May 2018 22:27:22 +0000 (22:27 +0000)]
Add missing include for cstdint to Visibility.h

Summary: We use uint8_t in this header, so we need to include cstdint.

Subscribers: cfe-commits

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

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

6 years agoAdd missing x86-registered-target.
Peter Collingbourne [Mon, 21 May 2018 22:14:02 +0000 (22:14 +0000)]
Add missing x86-registered-target.

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

6 years ago[X86] Remove a builtin that should have been removed in r332882.
Craig Topper [Mon, 21 May 2018 22:10:02 +0000 (22:10 +0000)]
[X86] Remove a builtin that should have been removed in r332882.

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

6 years agoFix another make_unique ambiguity.
Peter Collingbourne [Mon, 21 May 2018 21:48:17 +0000 (21:48 +0000)]
Fix another make_unique ambiguity.

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

6 years ago[X86] Remove masking from pternlog llvm intrinsics and use a select instruction instead.
Craig Topper [Mon, 21 May 2018 20:58:23 +0000 (20:58 +0000)]
[X86] Remove masking from pternlog llvm intrinsics and use a select instruction instead.

Because the intrinsics in the headers are implemented as macros, we can't just use a select builtin and pternlog builtin. This would require one of the macro arguments to be used twice. Depending on what was passed to the macro we could expand an expression twice leading to weird behavior. We could maybe declare our local variable in the macro, but that would need to worry about name collisions.

To avoid that just generate IR directly in CGBuiltin.cpp.

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

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

6 years agoRevert r332847; it caused us to miscompile certain forms of reference initialization.
Richard Smith [Mon, 21 May 2018 20:36:58 +0000 (20:36 +0000)]
Revert r332847; it caused us to miscompile certain forms of reference initialization.

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

6 years agoCodeGen, Driver: Start using direct split dwarf emission in clang.
Peter Collingbourne [Mon, 21 May 2018 20:31:59 +0000 (20:31 +0000)]
CodeGen, Driver: Start using direct split dwarf emission in clang.

Fixes PR37466.

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

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

6 years ago[X86] Use __builtin_convertvector to implement some of the packed integer to packed...
Craig Topper [Mon, 21 May 2018 20:19:17 +0000 (20:19 +0000)]
[X86] Use __builtin_convertvector to implement some of the packed integer to packed float conversion intrinsics.

I believe this is safe assuming default default FP environment. The conversion might be inexact, but it can never overflow the FP type so this shouldn't be undefined behavior for the uitofp/sitofp instructions.

We already do something similar for scalar conversions.

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

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

6 years agoCodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to...
Peter Collingbourne [Mon, 21 May 2018 20:16:41 +0000 (20:16 +0000)]
CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output.

Part of PR37466.

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

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

6 years agoRevert r332028; see PR37545 for details.
Richard Smith [Mon, 21 May 2018 20:10:54 +0000 (20:10 +0000)]
Revert r332028; see PR37545 for details.

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

6 years ago[Clang Tablegen] Add llvm_unreachable() to getModifierName()
Mark Searles [Mon, 21 May 2018 17:29:08 +0000 (17:29 +0000)]
[Clang Tablegen] Add llvm_unreachable() to getModifierName()

Fix internal build failure:

../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o
../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef
{anonymous}::getModifierName({anonymous}::ModifierType)':
../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type]
}
^

Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8

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

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

6 years ago[OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.
Alexey Bataev [Mon, 21 May 2018 16:40:32 +0000 (16:40 +0000)]
[OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.

if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be
  defined. If `-fopenmp-simd` is specified along with the `-fopenmp`,
  `_OPENMP` macro should be defined with the value `201511`.

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

6 years ago[AMDGPU] fixes for lds f32 builtins
Daniil Fukalov [Mon, 21 May 2018 16:18:07 +0000 (16:18 +0000)]
[AMDGPU] fixes for lds f32 builtins

1. added restrictions to memory scope, order and volatile parameters
2. added custom processing for these builtins - currently is not used code,
   needed to switch off GCCBuiltin link to the builtins (ongoing change to llvm
   tree)
3. builtins renamed as requested

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

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

6 years ago[CodeGen] Recognize more cases of zero initialization
Serge Pavlov [Mon, 21 May 2018 16:09:54 +0000 (16:09 +0000)]
[CodeGen] Recognize more cases of zero initialization

If a variable has an initializer, codegen tries to build its value. If
the variable is large in size, building its value requires substantial
resources. It causes strange behavior from user viewpoint: compilation
of huge zero initialized arrays like:

    char data_1[2147483648u] = { 0 };

consumes enormous amount of time and memory.

With this change codegen tries to determine if variable initializer is
equivalent to zero initializer. In this case variable value is not
constructed.

This change fixes PR18978.

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

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

6 years ago[Sema] Fix incorrect packed aligned structure layout
Momchil Velikov [Mon, 21 May 2018 14:28:43 +0000 (14:28 +0000)]
[Sema] Fix incorrect packed aligned structure layout

Handle attributes before checking the record layout (e.g. underalignment check
during `alignas` processing), as layout may be cached without taking into
account attributes that may affect it.

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

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

6 years ago[CodeGen] Disable aggressive structor optimizations at -O0, take 2
Pavel Labath [Mon, 21 May 2018 11:47:45 +0000 (11:47 +0000)]
[CodeGen] Disable aggressive structor optimizations at -O0, take 2

The first version of the patch (r332228) was flawed because it was
putting structors into C5/D5 comdats very eagerly. This is correct only
if we can ensure the comdat contains all required versions of the
structor (which wasn't the case). This version uses a more nuanced
approach:
- for local structor symbols we use an alias because we don't have to
  worry about comdats or other compilation units.
- linkonce symbols are emitted separately, as we cannot guarantee we
  will have all symbols we need to form a comdat (they are emitted
  lazily, only when referenced).
- available_externally symbols are also emitted separately, as the code
  seemed to be worried about emitting an alias in this case.
- other linkage types are not affected by the optimization level. They
  either get put into a comdat (weak) or get aliased (external).

Reviewers: rjmccall, aprantl

Subscribers: cfe-commits

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

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

6 years ago[X86] Remove some preprocessor feature checks from intrinsic headers
Craig Topper [Mon, 21 May 2018 06:07:49 +0000 (06:07 +0000)]
[X86] Remove some preprocessor feature checks from intrinsic headers

Summary:
These look to be a couple things that weren't removed when we switched to target attribute.

The popcnt makes including just smmintrin.h also include popcntintrin.h. The popcnt file itself already contains target attrributes.

The prefetch ones are just wrappers around __builtin_prefetch which we have graceful fallbacks for in the backend if the exact instruction isn't available. So there's no reason to hide them. And it makes them available in functions that have the write target attribute but not a -march command line flag.

Reviewers: echristo, RKSimon, spatel, DavidKreitzer

Reviewed By: echristo

Subscribers: cfe-commits

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

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

6 years ago[X86] Remove some unused builtins.
Craig Topper [Mon, 21 May 2018 03:36:57 +0000 (03:36 +0000)]
[X86] Remove some unused builtins.

These were upgraded to native shufflevectors months ago.

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

6 years ago[X86] Remove mask arguments from permvar builtins/intrinsics. Use a select in IR...
Craig Topper [Sun, 20 May 2018 23:34:10 +0000 (23:34 +0000)]
[X86] Remove mask arguments from permvar builtins/intrinsics. Use a select in IR instead.

Someday maybe we'll use selects for all the builtins.

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

6 years agoRevert 332750, clang part (see comment on D46910).
Nico Weber [Sun, 20 May 2018 23:02:20 +0000 (23:02 +0000)]
Revert 332750, clang part (see comment on D46910).

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

6 years agoSema: diagnose invalid catch parameter in ObjC
Saleem Abdulrasool [Sun, 20 May 2018 19:26:44 +0000 (19:26 +0000)]
Sema: diagnose invalid catch parameter in ObjC

Ensure that the type being used has an associated interface when
declaring the parameter for `@catch`.

Resolves PR37384!

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

6 years agoPrint the qualified name when dumping deserialized decls.
Vassil Vassilev [Sun, 20 May 2018 09:38:52 +0000 (09:38 +0000)]
Print the qualified name when dumping deserialized decls.

This is useful to understand and debug the lazy template specializations
used in the pch and modules.

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

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