]> granicus.if.org Git - clang/log
clang
5 years agoModules: Invalidate out-of-date PCMs as they're discovered
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:44:01 +0000 (17:44 +0000)]
Modules: Invalidate out-of-date PCMs as they're discovered

Leverage the InMemoryModuleCache to invalidate a module the first time
it fails to import (and to lock a module as soon as it's built or
imported successfully).  For implicit module builds, this optimizes
importing deep graphs where the leaf module is out-of-date; see example
near the end of the commit message.

Previously the cache finalized ("locked in") all modules imported so far
when starting a new module build.  This was sufficient to prevent
loading two versions of the same module, but was somewhat arbitrary and
hard to reason about.

Now the cache explicitly tracks module state, where each module must be
one of:

- Unknown: module not in the cache (yet).
- Tentative: module in the cache, but not yet fully imported.
- ToBuild: module found on disk could not be imported; need to build.
- Final: module in the cache has been successfully built or imported.

Preventing repeated failed imports avoids variation in builds based on
shifting filesystem state.  Now it's guaranteed that a module is loaded
from disk exactly once.  It now seems safe to remove
FileManager::invalidateCache, but I'm leaving that for a later commit.

The new, precise logic uncovered a pre-existing problem in the cache:
the map key is the module filename, and different contexts use different
filenames for the same PCM file.  (In particular, the test
Modules/relative-import-path.c does not build without this commit.
r223577 started using a relative path to describe a module's base
directory when importing it within another module.  As a result, the
module cache sees an absolute path when (a) building the module or
importing it at the top-level, and a relative path when (b) importing
the module underneath another one.)

The "obvious" fix is to resolve paths using FileManager::getVirtualFile
and change the map key for the cache to a FileEntry, but some contexts
(particularly related to ASTUnit) have a shorter lifetime for their
FileManager than the InMemoryModuleCache.  This is worth pursuing
further in a later commit; perhaps by tying together the FileManager and
InMemoryModuleCache lifetime, or moving the in-memory PCM storage into a
VFS layer.

For now, use the PCM's base directory as-written for constructing the
filename to check the ModuleCache.

Example
=======

To understand the build optimization, first consider the build of a
module graph TU -> A -> B -> C -> D with an empty cache:

    TU builds A'
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

If we build TU again, where A, B, C, and D are in the cache and D is
out-of-date, we would previously get this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A'
       A' imports B
          imports C
          imports D (out-of-date)
          builds B'
          B' imports C
             imports D (out-of-date)
             builds C'
             C' imports D (out-of-date)
                builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
     TU imports A'
        imports B'
        imports C'
        imports D'

After this commit, we'll immediateley invalidate A, B, C, and D when we
first observe that D is out-of-date, giving this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A' // The same graph as an empty cache.
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

The new build matches what we'd naively expect, pretty closely matching
the original build with the empty cache.

rdar://problem/48545366

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

5 years agoModules: Rename MemoryBufferCache to InMemoryModuleCache
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:33:56 +0000 (17:33 +0000)]
Modules: Rename MemoryBufferCache to InMemoryModuleCache

Change MemoryBufferCache to InMemoryModuleCache, moving it from Basic to
Serialization.  Another patch will start using it to manage module build
more explicitly, but this is split out because it's mostly mechanical.

Because of the move to Serialization we can no longer abuse the
Preprocessor to forward it to the ASTReader.  Besides the rename and
file move, that means Preprocessor::Preprocessor has one fewer parameter
and ASTReader::ASTReader has one more.

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

5 years ago[CMake] Support stripping and linking output to .build-id directory
Petr Hosek [Sat, 9 Mar 2019 01:26:55 +0000 (01:26 +0000)]
[CMake] Support stripping and linking output to .build-id directory

When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

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

5 years ago[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments...
Eric Fiselier [Fri, 8 Mar 2019 22:06:48 +0000 (22:06 +0000)]
[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

Summary:
The following code is accepted by Clang 7 and prior but rejected by the upcoming 8 release and in trunk [1]

```
// error {{never produces a constant expression}}
void foo(const char* s) __attribute__((enable_if(__builtin_constant_p(*s) == false, "trap"))) {}
void test() { foo("abc"); }
```

Prior to Clang 8, the call to `__builtin_constant_p` was a constant expression returning false. Currently, it's not a valid constant expression.

The bug is caused because we failed to set `InConstantContext` when attempting to evaluate unevaluated constant expressions.

[1]  https://godbolt.org/z/ksAjmq

Reviewers: rsmith, hans, sbenza

Reviewed By: rsmith

Subscribers: kristina, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Remove debug service variable.
Alexey Bataev [Fri, 8 Mar 2019 20:48:54 +0000 (20:48 +0000)]
[OPENMP]Remove debug service variable.

Removed not required service variable for the debug info.

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

5 years ago[docs] Fix checkers.rst doc for PointerSorting checker
Mandeep Singh Grang [Fri, 8 Mar 2019 20:35:25 +0000 (20:35 +0000)]
[docs] Fix checkers.rst doc for PointerSorting checker

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

5 years agoRevert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
Matthew Voss [Fri, 8 Mar 2019 20:33:55 +0000 (20:33 +0000)]
Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

This broke the windows bots.

This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0.

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

5 years agoRevert "Recommit "Support attribute used in member funcs of class templates""
Rafael Auler [Fri, 8 Mar 2019 20:23:57 +0000 (20:23 +0000)]
Revert "Recommit "Support attribute used in member funcs of class templates""

There is nontrivial bug caused in lld that I need to further
investigate. Meanwhile, I'll revert this.

This reverts commit 8297e93480c636dc90fd14653c5a66406193363f.

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

5 years ago[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements
Mandeep Singh Grang [Fri, 8 Mar 2019 20:13:53 +0000 (20:13 +0000)]
[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

Summary:
Added a new category of checkers for non-determinism. Added a checker for non-determinism
caused due to sorting containers with pointer-like elements.

Reviewers: NoQ, george.karpenkov, whisperity, Szelethus

Reviewed By: NoQ, Szelethus

Subscribers: Charusso, baloghadamsoftware, jdoerfert, donat.nagy, dkrupp, martong, dblaikie, MTC, Szelethus, mgorny, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Fix infinite recursion in printing macros
Kristof Umann [Fri, 8 Mar 2019 16:26:29 +0000 (16:26 +0000)]
[analyzer] Fix infinite recursion in printing macros

In the commited testfile, macro expansion (the one implemented for the plist
output) runs into an infinite recursion. The issue originates from the algorithm
being faulty, as in

#define value REC_MACRO_FUNC(value)

the "value" is being (or at least attempted) expanded from the same macro.

The solved this issue by gathering already visited macros in a set, which does
resolve the crash, but will result in an incorrect macro expansion, that would
preferably be fixed down the line.

Patch by Tibor Brunner!

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

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

5 years ago[analyzer] Emit an error rather than assert on invalid checker option input
Kristof Umann [Fri, 8 Mar 2019 16:00:42 +0000 (16:00 +0000)]
[analyzer] Emit an error rather than assert on invalid checker option input

Asserting on invalid input isn't very nice, hence the patch to emit an error
instead.

This is the first of many patches to overhaul the way we handle checker options.

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

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

5 years ago[analyzer] Use the new infrastructure of expressing taint propagation, NFC
Kristof Umann [Fri, 8 Mar 2019 15:47:56 +0000 (15:47 +0000)]
[analyzer] Use the new infrastructure of expressing taint propagation, NFC

In D55734, we implemented a far more general way of describing taint propagation
rules for functions, like being able to specify an unlimited amount of
source and destination parameters. Previously, we didn't have a particularly
elegant way of expressing the propagation rules for functions that always return
(either through an out-param or return value) a tainted value. In this patch,
we model these functions similarly to other ones, by assigning them a
TaintPropagationRule that describes that they "create a tainted value out of
nothing".

The socket C function is somewhat special, because for certain parameters (for
example, if we supply localhost as parameter), none of the out-params should
be tainted. For this, we added a general solution of being able to specify
custom taint propagation rules through function pointers.

Patch by Gábor Borsik!

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

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

5 years agoUse {{.*}} in test case to match the type of wide string literals.
Akira Hatanaka [Fri, 8 Mar 2019 15:20:12 +0000 (15:20 +0000)]
Use {{.*}} in test case to match the type of wide string literals.

The type of wide string literals varies depending on the target.

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

5 years agoRe-fix _lrotl/_lrotr to always take Long, no matter the platform.
Erich Keane [Fri, 8 Mar 2019 15:10:07 +0000 (15:10 +0000)]
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.

r355322 fixed this, however is being reverted due to concerns with
enabling it in other modes.

Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29

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

5 years agoRevert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."
Erich Keane [Fri, 8 Mar 2019 15:10:05 +0000 (15:10 +0000)]
Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."

This reverts commit 24400dafe16716f28cd0e7e5fa6e004c0e50686a.

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

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Fri, 8 Mar 2019 10:44:06 +0000 (10:44 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

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

5 years ago[clang][Index] Fix msan failure
Kadir Cetinkaya [Fri, 8 Mar 2019 10:18:40 +0000 (10:18 +0000)]
[clang][Index] Fix msan failure

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

5 years agoclang-cl : Parse all /d2 options
Hans Wennborg [Fri, 8 Mar 2019 10:00:42 +0000 (10:00 +0000)]
clang-cl : Parse all /d2 options

We will now warn about such options being unused,
which is better than the current
"no such file or directory: '/d2foo'" errors.

Note that we can still handle specific flags separately,
e.g. we were already ignoring /d2FastFail and /d2Zi+

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

5 years ago[clang][Tooling] Delete dots and dotdots when generating absolute paths
Kadir Cetinkaya [Fri, 8 Mar 2019 09:42:04 +0000 (09:42 +0000)]
[clang][Tooling] Delete dots and dotdots when generating absolute paths

Summary:
GetAllFiles interface returns absolute paths, but keeps dots and dot
dots. This patch makes those paths canonical by deleting them.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd another test for r354937 that came up in PR40890
Hans Wennborg [Fri, 8 Mar 2019 09:01:10 +0000 (09:01 +0000)]
Add another test for r354937 that came up in PR40890

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

5 years ago[clang][Index] Mark references from Constructors and Destructors to class as NameRefe...
Kadir Cetinkaya [Fri, 8 Mar 2019 08:30:20 +0000 (08:30 +0000)]
[clang][Index] Mark references from Constructors and Destructors to class as NameReference

Summary:
In current indexing logic we get references to class itself when we see
a constructor/destructor which is only syntactically true. Semantically
this information is not correct. This patch marks that reference as
NameReference to let clients deal with it.

Reviewers: akyrtzi, gribozavr, nathawes, benlangmuir

Reviewed By: gribozavr, nathawes

Subscribers: nathawes, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[Clang] Include the test directory ommited in r355665
Petr Hosek [Fri, 8 Mar 2019 06:16:32 +0000 (06:16 +0000)]
[Clang] Include the test directory ommited in r355665

This was omitted in r355655 causing the test to fail.

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

5 years ago[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/
Petr Hosek [Fri, 8 Mar 2019 05:35:22 +0000 (05:35 +0000)]
[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/

This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory.  Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/<target> and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.

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

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

5 years agoFix test case committed in r355662.
Akira Hatanaka [Fri, 8 Mar 2019 05:30:54 +0000 (05:30 +0000)]
Fix test case committed in r355662.

Build bots were failing because wide string literals don't have type
'int *' on some targets.

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

5 years ago[ObjC] Emit a boxed expression as a compile-time constant if the
Akira Hatanaka [Fri, 8 Mar 2019 04:45:37 +0000 (04:45 +0000)]
[ObjC] Emit a boxed expression as a compile-time constant if the
expression inside the parentheses is a valid UTF-8 string literal.

Previously clang emitted an expression like @("abc") as a message send
to stringWithUTF8String. This commit makes clang emit the boxed
expression as a compile-time constant instead.

This commit also has the effect of silencing the nullable-to-nonnull
conversion warning clang started emitting after r317727, which
originally motivated this commit (see https://oleb.net/2018/@keypath).

rdar://problem/42684601

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

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

5 years agoVariable auto-init: split out small arrays
JF Bastien [Fri, 8 Mar 2019 01:26:49 +0000 (01:26 +0000)]
Variable auto-init: split out small arrays

Summary: Following up with r355181, initialize small arrays as well.

LLVM stage2 shows a tiny size gain.

<rdar://48523005>

Reviewers: glider, pcc, kcc, rjmccall

Subscribers: jkorous, dexonsmith, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Make x86-intrinsics-headers-clean.cpp stricter.
Craig Topper [Fri, 8 Mar 2019 01:15:18 +0000 (01:15 +0000)]
[X86] Make x86-intrinsics-headers-clean.cpp stricter.

Remove the -Wno-ignored-attributes.

Add -fno-lax-vector-conversions

Also use -ffreestanding instead of defining _MM_MALLOC_H.

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

5 years agoRecommit "Support attribute used in member funcs of class templates"
Rafael Auler [Thu, 7 Mar 2019 19:14:30 +0000 (19:14 +0000)]
Recommit "Support attribute used in member funcs of class templates"

The patch originally broke code that was incompatible with GCC, but
we want to follow GCC behavior here according to the discussion in
https://reviews.llvm.org/D58216

Original commit message:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

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

5 years agoFix some clang analysis tests passing arguments incorrectly
Reid Kleckner [Thu, 7 Mar 2019 18:57:04 +0000 (18:57 +0000)]
Fix some clang analysis tests passing arguments incorrectly

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

5 years agoDelete x86_64 ShadowCallStack support
Vlad Tsyrklevich [Thu, 7 Mar 2019 18:56:36 +0000 (18:56 +0000)]
Delete x86_64 ShadowCallStack support

Summary:
ShadowCallStack on x86_64 suffered from the same racy security issues as
Return Flow Guard and had performance overhead as high as 13% depending
on the benchmark. x86_64 ShadowCallStack was always an experimental
feature and never shipped a runtime required to support it, as such
there are no expected downstream users.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mgorny, javed.absar, hiraditya, jdoerfert, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

5 years agoRollback of rL355585.
Mitch Phillips [Thu, 7 Mar 2019 18:13:39 +0000 (18:13 +0000)]
Rollback of rL355585.

Introduces memory leak in FunctionTest.GetPointerAlignment that breaks sanitizer buildbots:

```
=================================================================
==2453==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x16936bc in llvm::User::operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/User.cpp:151:19
    #2 0x7c3fe9 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:12
    #3 0x7c3fe9 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #4 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #5 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #6 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #7 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #8 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #9 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #10 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #11 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #12 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #13 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

Indirect leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x151be6b in make_unique<llvm::ValueSymbolTable> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/ADT/STLExtras.h:1349:29
    #2 0x151be6b in llvm::Function::Function(llvm::FunctionType*, llvm::GlobalValue::LinkageTypes, unsigned int, llvm::Twine const&, llvm::Module*) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/Function.cpp:241
    #3 0x7c4006 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:16
    #4 0x7c4006 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #5 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #6 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #7 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #8 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #9 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #10 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #11 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #12 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #13 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #14 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

SUMMARY: AddressSanitizer: 168 byte(s) leaked in 2 allocation(s).
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/11358/steps/check-llvm%20asan/logs/stdio for more information.

Also introduces use-of-uninitialized-value in ConstantsTest.FoldGlobalVariablePtr:
```
==7070==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x14e703c in User /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5
    #1 0x14e703c in Constant /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/Constant.h:44
    #2 0x14e703c in llvm::GlobalValue::GlobalValue(llvm::Type*, llvm::Value::ValueTy, llvm::Use*, unsigned int, llvm::GlobalValue::LinkageTypes, llvm::Twine const&, unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalValue.h:78
    #3 0x14e5467 in GlobalObject /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalObject.h:34:9
    #4 0x14e5467 in llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&, llvm::GlobalValue::ThreadLocalMode, unsigned int, bool) /b/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/Globals.cpp:314
    #5 0x6938f1 in llvm::(anonymous namespace)::ConstantsTest_FoldGlobalVariablePtr_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm/unittests/IR/ConstantsTest.cpp:565:18
    #6 0x1a240a1 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #7 0x1a240a1 in testing::Test::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #8 0x1a26d26 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #9 0x1a2815f in testing::TestCase::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #10 0x1a43de8 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #11 0x1a42c47 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #12 0x1a42c47 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #13 0x1a0dfba in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #14 0x1a0dfba in main /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #15 0x7f2081c412e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #16 0x4dff49 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/unittests/IR/IRTests+0x4dff49)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5 in User
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/30222/steps/check-llvm%20msan/logs/stdio for more information.

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

5 years ago[OPENMP 5.0]Add initial support for 'allocate' directive.
Alexey Bataev [Thu, 7 Mar 2019 17:54:44 +0000 (17:54 +0000)]
[OPENMP 5.0]Add initial support for 'allocate' directive.

Added parsing/sema analysis/serialization/deserialization support for
'allocate' directive.

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

5 years ago[Sema] Change addr space diagnostics in casts to follow C++ style.
Anastasia Stulova [Thu, 7 Mar 2019 17:06:30 +0000 (17:06 +0000)]
[Sema] Change addr space diagnostics in casts to follow C++ style.

This change adds a new diagnostic for mismatching address spaces
to be used for C++ casts (only enabled in C style cast for now,
the rest will follow!).

The change extends C-style cast rules to account for address spaces.
It also adds a separate function for address space cast checking that
can be used to map from a separate address space cast operator
addrspace_cast (to be added as a follow up patch).

Note, that after this change clang will no longer allows arbitrary
address space conversions in reinterpret_casts because they can lead
to accidental errors. The implicit safe conversions would still be
allowed.

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

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

5 years ago[PR40778][Sema] Adjust addr space of operands in builtin operators.
Anastasia Stulova [Thu, 7 Mar 2019 16:43:41 +0000 (16:43 +0000)]
[PR40778][Sema] Adjust addr space of operands in builtin operators.

Adjust address space for references and pointer operands of builtin operators.

Currently this change only fixes addr space in assignment (= and |=) operator,
that is needed for the test case reported in the bug. Wider support for all
other operations will follow.

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

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

5 years ago[PR40778] Preserve addr space in Derived to Base cast.
Anastasia Stulova [Thu, 7 Mar 2019 16:23:15 +0000 (16:23 +0000)]
[PR40778] Preserve addr space in Derived to Base cast.

The address space for the Base class pointer when up-casting
from Derived should be taken from the Derived class pointer.

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

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

5 years ago[analyzer] handle modification of vars inside an expr with comma operator
Petar Jovanovic [Thu, 7 Mar 2019 15:50:52 +0000 (15:50 +0000)]
[analyzer] handle modification of vars inside an expr with comma operator

We should track mutation of a variable within a comma operator expression.
Current code in ExprMutationAnalyzer does not handle it.

This will handle cases like:

(a, b) ++ < == b is modified
(a, b) = c < == b is modifed

Patch by Djordje Todorovic.

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

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

5 years agoexpected-no-diagnostics@ does not make sense, switching to a more idiomatic form...
Aaron Ballman [Thu, 7 Mar 2019 15:03:06 +0000 (15:03 +0000)]
expected-no-diagnostics@ does not make sense, switching to a more idiomatic form; NFC.

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

5 years ago[ASTImporter] Changed use of Import to Import_New in ASTImporter.
Balazs Keri [Thu, 7 Mar 2019 14:09:18 +0000 (14:09 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTImporter.

Reviewers: a.sidorin, shafik, a_sidorin, martong

Reviewed By: a_sidorin

Subscribers: rnkovacs, jdoerfert, davide, aprantl, llvm-commits, gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Import member expr with explicit template args
Gabor Marton [Thu, 7 Mar 2019 13:38:20 +0000 (13:38 +0000)]
[ASTImporter] Import member expr with explicit template args

Summary:
Member expressions with explicit template arguments were not imported
correctly: the DeclRefExpr was missing. This patch fixes.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years ago[ASTImporter] Handle redecl chain of FunctionTemplateDecls
Gabor Marton [Thu, 7 Mar 2019 13:01:51 +0000 (13:01 +0000)]
[ASTImporter] Handle redecl chain of FunctionTemplateDecls

Summary:
Redecl chains of function templates are not handled well currently. We
want to handle them similarly to functions, i.e. try to keep the
structure of the original AST as much as possible. The aim is to not
squash a prototype with a definition, rather we create both and put them
in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years ago[analyzer] Handle comparison between non-default AS symbol and constant
David Stenberg [Thu, 7 Mar 2019 13:01:17 +0000 (13:01 +0000)]
[analyzer] Handle comparison between non-default AS symbol and constant

Summary:
When comparing a symbolic region and a constant, the constant would be
widened or truncated to the width of a void pointer, meaning that the
constant could be incorrectly truncated when handling symbols for
non-default address spaces. In the attached test case this resulted in a
false positive since the constant was truncated to zero. To fix this,
widen/truncate the constant to the width of the symbol expression's
type.

This commit does not consider non-symbolic regions as I'm not sure how
to generalize getting the type there.

This fixes PR40814.

Reviewers: NoQ, zaks.anna, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, jdoerfert, Charusso, cfe-commits

Tags: #clang

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

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

5 years ago[libclang] Fix CXTranslationUnit_KeepGoing
Ivan Donchevskii [Thu, 7 Mar 2019 10:13:50 +0000 (10:13 +0000)]
[libclang] Fix CXTranslationUnit_KeepGoing

Since
  commit 56f548bbbb7e4387a69708f70724d00e9e076153
  [modules] Round-trip -Werror flag through explicit module build.
the behavior of CXTranslationUnit_KeepGoing changed:
Unresolved #includes are fatal errors again. As a consequence, some
templates are not instantiated and lead to confusing errors.

Revert to the old behavior: With CXTranslationUnit_KeepGoing fatal
errors are mapped to errors.

Patch by Nikolai Kosjar.

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

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

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Thu, 7 Mar 2019 09:15:23 +0000 (09:15 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

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

5 years ago[PGO] Re-submit: Clang part of change for context-sensitive PGO (part2)
Rong Xu [Wed, 6 Mar 2019 23:00:38 +0000 (23:00 +0000)]
[PGO] Re-submit: Clang part of change for context-sensitive PGO (part2)

Part 2 of CSPGO change in Clang: Add test cases.

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

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

5 years ago[CUDA][HIP][DebugInfo] Skip reference device function
Michael Liao [Wed, 6 Mar 2019 21:16:27 +0000 (21:16 +0000)]
[CUDA][HIP][DebugInfo] Skip reference device function

Summary:
- A device functions could be used as a non-type template parameter in a
  global/host function template. However, we should not try to retrieve that
  device function and reference it in the host-side debug info as it's
  only valid at device side.

Subscribers: aprantl, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoAMDGPU: Fix the mapping of sub group sync scope
Konstantin Zhuravlyov [Wed, 6 Mar 2019 20:54:48 +0000 (20:54 +0000)]
AMDGPU: Fix the mapping of sub group sync scope

Map memory_scope_sub_group to "wavefront" sync scope

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

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

5 years agoPassthrough compiler launcher
JF Bastien [Wed, 6 Mar 2019 20:36:00 +0000 (20:36 +0000)]
Passthrough compiler launcher

Summary: Not having this seems like an oversight, and makes stage2 builds odd.

Reviewers: ddunbar, dexonsmith

Subscribers: mgorny, jkorous, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoRevert "[IR][ARM] Add function pointer alignment to datalayout"
Mitch Phillips [Wed, 6 Mar 2019 19:17:18 +0000 (19:17 +0000)]
Revert "[IR][ARM] Add function pointer alignment to datalayout"

This reverts commit 2391bfca97290181ae65796ea6da135d1b6d037b.

This reverts rL355522 (https://reviews.llvm.org/D57335).

Kills buildbots that use '-Werror' with the following error:
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm/lib/IR/Value.cpp:657:7: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]

See buildbots http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/30200/steps/check-llvm%20asan/logs/stdio for more information.

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

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Wed, 6 Mar 2019 17:24:11 +0000 (17:24 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

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

5 years agoReland "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"
Francis Visoiu Mistrih [Wed, 6 Mar 2019 15:20:13 +0000 (15:20 +0000)]
Reland "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"

This allows us to store more info about where we're emitting the remarks
without cluttering LLVMContext. This is needed for future support for
the remark section.

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

Original llvm-svn: 355507

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

5 years agoRevert "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"
Francis Visoiu Mistrih [Wed, 6 Mar 2019 14:52:37 +0000 (14:52 +0000)]
Revert "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"

This reverts commit 2e8c4997a2089f8228c843fd81b148d903472e02.

Breaks bots.

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

5 years ago[Remarks] Refactor remark diagnostic emission in a RemarkStreamer
Francis Visoiu Mistrih [Wed, 6 Mar 2019 14:32:08 +0000 (14:32 +0000)]
[Remarks] Refactor remark diagnostic emission in a RemarkStreamer

This allows us to store more info about where we're emitting the remarks
without cluttering LLVMContext. This is needed for future support for
the remark section.

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

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

5 years ago[PR40778] Add addr space conversion when binding reference to a temporary.
Anastasia Stulova [Wed, 6 Mar 2019 13:02:41 +0000 (13:02 +0000)]
[PR40778] Add addr space conversion when binding reference to a temporary.

This change fixes temporary materialization to happen in the right
(default) address space when binding to it a reference of different type.

It adds address space conversion afterwards to match the addr space
of a reference.

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

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

5 years agoInline asm constraints: allow ICE-like pointers for the "n" constraint (PR40890)
Hans Wennborg [Wed, 6 Mar 2019 10:26:19 +0000 (10:26 +0000)]
Inline asm constraints: allow ICE-like pointers for the "n" constraint (PR40890)

Apparently GCC allows this, and there's code relying on it (see bug).

The idea is to allow expression that would have been allowed if they
were cast to int. So I based the code on how such a cast would be done
(the CK_PointerToIntegral case in IntExprEvaluator::VisitCastExpr()).

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

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

5 years agoclang-cl: Parse /Qspectre and a few other missing options (PR40964)
Hans Wennborg [Wed, 6 Mar 2019 09:38:04 +0000 (09:38 +0000)]
clang-cl: Parse /Qspectre and a few other missing options (PR40964)

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

5 years ago[clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists"
Roman Lebedev [Wed, 6 Mar 2019 07:45:10 +0000 (07:45 +0000)]
[clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists"

Summary:
This reverts rL352390 / D57280.

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

Now, here's the caveat. I have read @ABataev's
> Well, I think it would be good to filter out OMPC_flush somehow
> because there is no such clause actually, it is a pseudo clause
> for better handling of the flush directive.
as if that clause is pseudo clause that only exists for the sole
purpose of simplifying the parser. As in, it never reaches AST.

I did not however try to verify that. Too bad, i was wrong.
It absolutely *does* reach AST. Therefore my understanding/justification
for the change was flawed, which makes the patch a regression which **must** be reverted.

@gribozavr has brought that up again in https://reviews.llvm.org/D57112#inline-521238

> > ...
> Sorry to be late for this discussion, but I don't think this conclusion
> follows. ASTMatchers are supposed to match the AST as it is.
> Even if OMPC_flush is synthetic, it exists in the AST, and users might
> want to match it. I think users would find anything else (trying to filter
> out AST nodes that are not in the source code) to be surprising. For example,
> there's a matcher materializeTemporaryExpr even though this AST node is a
> Clang invention and is not a part of the C++ spec.
>
> Matching only constructs that appear in the source code is not feasible with
> ASTMatchers, because they are based on Clang's AST that exposes tons of semantic
> information, and its design is dictated by the structure of the semantic information.
> See "RFC: Tree-based refactorings with Clang" in cfe-dev for a library that will
> focus on representing source code as faithfully as possible.
>
> Not to even mention that this code is in ASTTypeTraits, a general library for
> handling AST nodes, not specifically for AST Matchers...

Reviewers: gribozavr, ABataev, rjmccall, aaron.ballman

Reviewed By: gribozavr, ABataev

Subscribers: dylanmckay, guansong, arphaman, jdoerfert, cfe-commits, gribozavr, ABataev

Tags: #clang, #openmp

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

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

5 years agoFix slashes in path references in -Rmodule-import test from r355477
Duncan P. N. Exon Smith [Wed, 6 Mar 2019 05:42:56 +0000 (05:42 +0000)]
Fix slashes in path references in -Rmodule-import test from r355477

Fixup for r355477 to fix the Windows bot:
  http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/16217

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

5 years agoModules: Add -Rmodule-import
Duncan P. N. Exon Smith [Wed, 6 Mar 2019 02:50:46 +0000 (02:50 +0000)]
Modules: Add -Rmodule-import

Add a remark for importing modules.  Depending on whether this is a
direct import (into the TU being built by this compiler instance) or
transitive import (into an already-imported module), the diagnostic has
two forms:

    importing module 'Foo' from 'path/to/Foo.pcm'
    importing module 'Foo' into 'Bar' from 'path/to/Foo.pcm'

Also drop a redundant FileCheck invocation in Rmodule-build.m that was
using -Reverything, since the notes from -Rmodule-import were confusing
it.

https://reviews.llvm.org/D58891

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

5 years ago[Fixed Point Arithmetic] Fixed Point and Integer Conversions
Leonard Chan [Wed, 6 Mar 2019 00:28:43 +0000 (00:28 +0000)]
[Fixed Point Arithmetic] Fixed Point and Integer Conversions

This patch includes the necessary code for converting between a fixed point type and integer.
This also includes constant expression evaluation for conversions with these types.

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

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

5 years agoRevert r355432 for buildbot failures in ppc64be-linux and s390x-linux
Rong Xu [Tue, 5 Mar 2019 23:02:06 +0000 (23:02 +0000)]
Revert r355432 for buildbot failures in ppc64be-linux and s390x-linux

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

5 years ago[clang-format] broken after lambda with return type template with boolean literal
Paul Hoad [Tue, 5 Mar 2019 22:20:25 +0000 (22:20 +0000)]
[clang-format] broken after lambda with return type template with boolean literal

Summary:
A Lamdba with a return type template with a boolean literal (true,false) behaves differently to an integer literal

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

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, jkorous

Reviewed By: jkorous

Subscribers: jkorous, cfe-commits

Tags: #clang-tools-extra

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

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

5 years ago[docs] Add some architectures into the list of supported ThreadSanitizer platforms
Vitaly Buka [Tue, 5 Mar 2019 21:10:42 +0000 (21:10 +0000)]
[docs] Add some architectures into the list of supported ThreadSanitizer platforms

Some platforms for which TSAN has build rules are omitted for the lack of
known build bots.

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

5 years ago[docs] Update the list of ThreadSanitizer supported OSes
Vitaly Buka [Tue, 5 Mar 2019 20:53:34 +0000 (20:53 +0000)]
[docs] Update the list of ThreadSanitizer supported OSes

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

5 years ago[cmake] Add libRemarks to LLVM_DISTRIBUTION_COMPONENTS
Francis Visoiu Mistrih [Tue, 5 Mar 2019 20:47:34 +0000 (20:47 +0000)]
[cmake] Add libRemarks to LLVM_DISTRIBUTION_COMPONENTS

Add this in the Apple-stage2.cmake to ship the remark tooling library
with the compiler.

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

5 years ago[clang-format] Fix lambdas returning template specialization that contains operator...
Jan Korous [Tue, 5 Mar 2019 19:27:24 +0000 (19:27 +0000)]
[clang-format] Fix lambdas returning template specialization that contains operator in parameter

A template specialization of a template foo<int N> can contain integer constants and a whole bunch of operators - e. g.  foo< 1 ? !0 : (3+1)%4 >

Inspired by https://reviews.llvm.org/D58922

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

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

5 years ago[PGO] Clang part of change for context-sensitive PGO (part2)
Rong Xu [Tue, 5 Mar 2019 19:09:56 +0000 (19:09 +0000)]
[PGO] Clang part of change for context-sensitive PGO (part2)

Part 2 of CSPGO change in Clang: Add test cases.

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

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

5 years ago[CUDA][HIP][Sema] Fix template kernel with function as template parameter
Yaxun Liu [Tue, 5 Mar 2019 18:19:35 +0000 (18:19 +0000)]
[CUDA][HIP][Sema] Fix template kernel with function as template parameter

If a kernel template has a function as its template parameter, a device function should be
allowed as template argument since a kernel can call a device function. However,
currently if the kernel template is instantiated in a host function, clang will emit an error
message saying the device function is an invalid candidate for the template parameter.

This happens because clang checks the reference to the device function during parsing
the template arguments. At this point, the template is not instantiated yet. Clang incorrectly
assumes the device function is called by the host function and emits the error message.

This patch fixes the issue by disabling checking of device function during parsing template
arguments and deferring the check to the instantion of the template. At that point, the
template decl is already available, therefore the check can be done against the instantiated
function template decl.

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

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

5 years agoAllow bundle size to be 0 in clang-offload-bundler
Yaxun Liu [Tue, 5 Mar 2019 17:52:32 +0000 (17:52 +0000)]
Allow bundle size to be 0 in clang-offload-bundler

HIP uses clang-offload-bundler to create fat binary. The bundle for host is empty.
Currently clang-offload-bundler checks if the bundle size is 0 when unbundling.
If so it will exit without unbundling the remaining bundles. This causes
clang-offload-bundler not being able to unbundle fat binaries generated for HIP.

This patch allows bundles size to be 0 when clang-offload-bundler unbundles
input files.

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

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

5 years ago[OPENMP]Target region: emit const firstprivates as globals with constant
Alexey Bataev [Tue, 5 Mar 2019 17:47:18 +0000 (17:47 +0000)]
[OPENMP]Target region: emit const firstprivates as globals with constant
memory.

If the variable with the constant non-scalar type is firstprivatized in
the target region, the local copy is created with the data copying.
Instead, we allocate the copy in the constant memory and avoid extra
copying in the outlined target regions. This global copy is used in the
target regions without loss of the performance.

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

5 years ago[HIP] Do not unbundle object files for -fno-gpu-rdc
Yaxun Liu [Tue, 5 Mar 2019 16:07:56 +0000 (16:07 +0000)]
[HIP] Do not unbundle object files for -fno-gpu-rdc

When -fno-gpu-rdc is set, device code is compiled, linked, and assembled into fat binary
and embedded as string in object files. The object files are normal object files which
can be linked by host linker. In the linking stage, the object files should not be unbundled
when -fno-gpu-rdc is set since they are normal object files, not bundles. The object files
only need to be unbundled when -fgpu-rdc is set.

Currently clang always unbundles object files, disregarding -fgpu-rdc option.

This patch fixes that.

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

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

5 years ago[analyzer] Fix taint propagation in GenericTaintChecker
Kristof Umann [Tue, 5 Mar 2019 12:42:59 +0000 (12:42 +0000)]
[analyzer] Fix taint propagation in GenericTaintChecker

The gets function has no SrcArgs. Because the default value for isTainted was
false, it didn't mark its DstArgs as tainted.

Patch by Gábor Borsik!

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

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

5 years ago[ASTMatchers] Improved formatting in a documentation comment
Dmitri Gribenko [Tue, 5 Mar 2019 12:38:18 +0000 (12:38 +0000)]
[ASTMatchers] Improved formatting in a documentation comment

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

5 years ago[ASTImporter] Fix redecl failures of Class and ClassTemplate
Gabor Marton [Tue, 5 Mar 2019 11:23:24 +0000 (11:23 +0000)]
[ASTImporter] Fix redecl failures of Class and ClassTemplate

Summary:
Redecl chains of classes and class templates are not handled well
currently. We want to handle them similarly to functions, i.e. try to
keep the structure of the original AST as much as possible. The aim is
to not squash a prototype with a definition, rather we create both and
put them in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years agoReplace clang::FileData with llvm::vfs::Status
Harlan Haskins [Tue, 5 Mar 2019 02:27:12 +0000 (02:27 +0000)]
Replace clang::FileData with llvm::vfs::Status

Summary:
FileData was only ever used as a container for the values in
llvm::vfs::Status, so they might as well be consolidated.

The `InPCH` member was also always set to false, and unused.

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang-format][docs][NFC] Fix example for Allman brace breaking style
Jan Korous [Tue, 5 Mar 2019 01:45:31 +0000 (01:45 +0000)]
[clang-format][docs][NFC] Fix example for Allman brace breaking style

I assume the example is wrong as it's clearly missing line-breaks before
braces.

I just ran the example through clang-format with .clang-format like
this:
BreakBeforeBraces: Allman

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

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

5 years ago[cmake] Create exports for umbrella library targets
Shoaib Meenai [Tue, 5 Mar 2019 00:38:32 +0000 (00:38 +0000)]
[cmake] Create exports for umbrella library targets

When using the umbrella llvm-libraries and clang-libraries targets, we
should export all library targets, otherwise they'll be part of our
distribution but not usable from the CMake package.

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

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

5 years ago[build] Rename clang-headers to clang-resource-headers
Shoaib Meenai [Mon, 4 Mar 2019 21:19:53 +0000 (21:19 +0000)]
[build] Rename clang-headers to clang-resource-headers

Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].

I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html

Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille

Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #lldb, #openmp, #llvm

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

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

5 years agoOrder File Instrumentation: add clang support for -forder-file-instrumentation
Manman Ren [Mon, 4 Mar 2019 20:30:30 +0000 (20:30 +0000)]
Order File Instrumentation: add clang support for -forder-file-instrumentation

When -forder-file-instrumentation is on, we pass llvm flag to enable the order file instrumentation pass.

https://reviews.llvm.org/D58751

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

5 years ago[ASTImporter] Handle built-in when importing SourceLocation and FileID
Shafik Yaghmour [Mon, 4 Mar 2019 20:25:54 +0000 (20:25 +0000)]
[ASTImporter] Handle built-in when importing SourceLocation and FileID

Summary:
Currently when we see a built-in we try and import the include location. Instead what we do now is find the buffer like we do for the invalid case and copy that over to the to context.

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

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

5 years ago[PGO] Clang part of change for context-sensitive PGO (part1)
Rong Xu [Mon, 4 Mar 2019 20:21:31 +0000 (20:21 +0000)]
[PGO] Clang part of change for context-sensitive PGO (part1)

Part 1 of CSPGO change in Clang. This includes changes in clang options
and calls to llvm PassManager. Tests will be committed in part2.
This change needs the PassManager change in llvm.

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

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

5 years agoEnable _rotl, _lrotl, _rotr, _lrotr on all platforms.
Erich Keane [Mon, 4 Mar 2019 18:47:21 +0000 (18:47 +0000)]
Enable _rotl, _lrotl, _rotr, _lrotr on all platforms.

The above builtins are currently implemented for MSVC mode, however GCC
also implements these.  This patch enables them for all platforms.

Additionally, this corrects the type for these builtins to always be
'long int' to match the specification in the Intel Intrinsics Guide.

Change-Id: Ida34be98078709584ef5136c8761783435ec02b1

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

5 years agoGive builtins and alloc/dealloc operators the default calling convention.
Erich Keane [Mon, 4 Mar 2019 14:54:52 +0000 (14:54 +0000)]
Give builtins and alloc/dealloc operators the default calling convention.

On SPIR targets, the default calling convention is SpirFunction.
However, operator new/delete and builtins were being created with CC_C.
The result is indirect references to new/delete (or builtins that are permitted
to be called indirectly have a mismatched type, as well as questionable codegen
in some cases.

This patch sets both to the default calling convention, so that it
properly matches the calling convention of the target.

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

Change-Id: I52065bb00bc2655945caea8f29c409ba1e0ac24a

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

5 years ago[analyzer] Enable subcheckers to possess checker options
Kristof Umann [Mon, 4 Mar 2019 00:28:16 +0000 (00:28 +0000)]
[analyzer] Enable subcheckers to possess checker options

Under the term "subchecker", I mean checkers that do not have a checker class on
their own, like unix.MallocChecker to unix.DynamicMemoryModeling.

Since a checker object was required in order to retrieve checker options,
subcheckers couldn't possess options on their own.

This patch is also an excuse to change the argument order of getChecker*Option,
it always bothered me, now it resembles the actual command line argument
(checkername:option=value).

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

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

5 years agoModules: Document that ReadASTCore exits its final loop via `return`, NFC
Duncan P. N. Exon Smith [Sun, 3 Mar 2019 20:17:53 +0000 (20:17 +0000)]
Modules: Document that ReadASTCore exits its final loop via `return`, NFC

The final loop never breaks.  Document that by following it with
llvm_unreachable.

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

5 years ago[clang] [ToolChains/NetBSD] Support relative libc++ header path
Michal Gorny [Sun, 3 Mar 2019 10:06:34 +0000 (10:06 +0000)]
[clang] [ToolChains/NetBSD] Support relative libc++ header path

Support locating the libc++ header files relatively to the clang
executable, in addition to the default system path.  This is meant
to cover two use cases: running just-built clang from the install
directory, and running installed clang from non-standard location
(e.g. /usr/local).

This is the first step towards ensuring that tests of more LLVM projects
can work out-of-the-box within the build tree, and use the correct set
of headers (rather than e.g. mixing just-built clang+libcxx with system
install of libcxx).  It avoids requiring the user to hack around missing
include paths, or LLVM build system to replicate system-specific C++
library defaults in order to append appropriate paths implicitly.

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

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

5 years agoTweak r355278 for compatibility with gcc 6 and earlier.
James Y Knight [Sat, 2 Mar 2019 21:55:36 +0000 (21:55 +0000)]
Tweak r355278 for compatibility with gcc 6 and earlier.

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

5 years agoTweak r355278 for compatibility with gcc 6 and earlier.
James Y Knight [Sat, 2 Mar 2019 21:20:30 +0000 (21:20 +0000)]
Tweak r355278 for compatibility with gcc 6 and earlier.

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

5 years agoMake the new SanitizerMask code added in r355190 constexpr.
James Y Knight [Sat, 2 Mar 2019 20:22:48 +0000 (20:22 +0000)]
Make the new SanitizerMask code added in r355190 constexpr.

Then, as a consequence, remove the complex set of workarounds for
initialization order -- which are apparently not 100% reliable.

The only downside is that some of the member functions are now
specific to kNumElem == 2, and will need to be updated if that
constant is increased in the future.

Unfortunately, the current code caused an initialization-order runtime
failure for me in some compilation modes. It appears that in a
toolchain without init-array enabled, the order of initialization of
static data members of a template can be reversed w.r.t. the order
within a file.

This caused e.g. SanitizerKind::CFI to be initialized to 0.

I'm not quite sure if that is an allowable ordering variation, or
nonconforming behavior, but in any case, making everything constexpr
eliminates the possibility of such an issue.

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

5 years ago[clang-format] clang-format off/on not respected when using C Style comments
Paul Hoad [Sat, 2 Mar 2019 09:08:51 +0000 (09:08 +0000)]
[clang-format] clang-format off/on not respected when using C Style comments

Summary:
If the clang-format on/off is in a /* comment */ then the sorting of headers is not ignored

PR40901 - https://bugs.llvm.org/show_bug.cgi?id=40901

Reviewers: djasper, klimek, JonasToth, krasimir, alexfh

Reviewed By: alexfh

Subscribers: alexfh, cfe-commits, llvm-commits

Tags: #clang, #clang-tools-extra

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

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

5 years agolib/Header: Simplify CMakeLists.txt
Tom Stellard [Sat, 2 Mar 2019 00:50:13 +0000 (00:50 +0000)]
lib/Header: Simplify CMakeLists.txt

Summary:
Replace cut and pasted code with cmake macros and reduce the number of
install commands.  This fixes an issue where the headers were being
installed twice.

This clean up should also make future modifications easier, like
adding a cmake option to install header files into a custom resource
directory.

Reviewers: chandlerc, smeenai, mgorny, beanz, phosek

Reviewed By: smeenai

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[WebAssembly] Temporarily disable bulk-memory with -pthread
Thomas Lively [Sat, 2 Mar 2019 00:18:09 +0000 (00:18 +0000)]
[WebAssembly] Temporarily disable bulk-memory with -pthread

Summary:
To prevent the instability of bulk-memory in the wasm backend from
blocking separate pthread testing, temporarily remove the logic that
adds -mbulk-memory in the presence of -pthread. Since browsers will
ship bulk memory before or alongside threads, this change will be
reverted as soon as bulk memory has stabilized in the backend.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, jfb, cfe-commits

Tags: #clang

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

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

5 years ago[DWARF] Make -g with empty assembler source work better.
Paul Robinson [Fri, 1 Mar 2019 20:58:04 +0000 (20:58 +0000)]
[DWARF] Make -g with empty assembler source work better.

This was sometimes causing clang or llvm-mc to crash, and in other
cases could emit a bogus DWARF line-table header. I did an interim
patch in r352541; this patch should be a cleaner and more complete
fix, and retains the test.

Addresses PR40538.

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

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

5 years ago[PGO] Use the explicit parameter in ProfileSummary API. NFC
Rong Xu [Fri, 1 Mar 2019 17:50:20 +0000 (17:50 +0000)]
[PGO] Use the explicit parameter in ProfileSummary API. NFC

Use the explicit parameter in setProfileSummary() and getSummary().
This is a follow-up of r355131.

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

5 years ago[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer...
Pierre Gousseau [Fri, 1 Mar 2019 10:05:15 +0000 (10:05 +0000)]
[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer checks, NFC.

enum SanitizerOrdinal has reached maximum capacity, this change extends the capacity to 128 sanitizer checks.
This can eventually allow us to add gcc 8's options "-fsanitize=pointer-substract" and "-fsanitize=pointer-compare".

This is a recommit of r354873 but with a fix for unqualified lookup error in lldb cmake build bot.

Fixes: https://llvm.org/PR39425
Differential Revision: https://reviews.llvm.org/D57914

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

5 years ago[clang-format] [NFC] clang-format the Format library
Paul Hoad [Fri, 1 Mar 2019 09:09:54 +0000 (09:09 +0000)]
[clang-format] [NFC] clang-format the Format library

Previously revisions commited non-clang-formatted changes to the Format library, this means submitting any revision e.g. {D55170} can cause additional whitespace changes to potentially be included in a revision.

Commit a non functional change using latest build Windows clang-format r351376 with no other changes, to remove these differences

All FormatTests
pass [==========] 652 tests from 20 test cases ran.

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

5 years agoCodeGen: Fix PR40605 by splitting constant struct initializers
Alexander Potapenko [Fri, 1 Mar 2019 09:00:41 +0000 (09:00 +0000)]
CodeGen: Fix PR40605 by splitting constant struct initializers

When emitting initializers for local structures for code built with
-ftrivial-auto-var-init, replace constant structures with sequences of
stores.

This appears to greatly help removing dead initialization stores to those
locals that are later overwritten by other data.
This also removes a lot of .rodata constants (see PR40605), replacing most
of them with immediate values (for Linux kernel the .rodata size is
reduced by ~1.9%)

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

5 years agoFix file headers. NFC
Fangrui Song [Fri, 1 Mar 2019 06:49:51 +0000 (06:49 +0000)]
Fix file headers. NFC

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

5 years ago[Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings by
Akira Hatanaka [Fri, 1 Mar 2019 06:43:20 +0000 (06:43 +0000)]
[Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings by
declaring an unavailable method in the subclass's extension that
overrides the designated initializer in the base class.

r243676 made changes to allow declaring the unavailable method in the
subclass interface to silence the warning. This commit additionally
allows declaring the unavailable method in the class extension.

rdar://problem/42731306

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

5 years ago[CodeGen] Fix calling llvm.var.annotation outside of a basic block.
Volodymyr Sapsai [Fri, 1 Mar 2019 02:15:39 +0000 (02:15 +0000)]
[CodeGen] Fix calling llvm.var.annotation outside of a basic block.

When we have an annotated local variable after a function returns, we
generate IR that fails verification with the error

> Instruction referencing instruction not embedded in a basic block!

And it means that bitcast referencing alloca doesn't have a parent basic
block.

Fix by checking if we are at an unreachable point and skip emitting
annotations. This approach is similar to the way we emit variable
initializer and debug info.

rdar://problem/46200420

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: aprantl, jkorous, dexonsmith, cfe-commits

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

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

5 years ago[clang-format][TableGen] Don't add spaces around items in square braces.
Jordan Rupprecht [Fri, 1 Mar 2019 00:12:18 +0000 (00:12 +0000)]
[clang-format][TableGen] Don't add spaces around items in square braces.

Summary:
clang-formatting wants to add spaces around items in square braces, e.g. [1, 2] -> [ 1, 2 ]. Based on a quick check [1], it seems like most cases are using the [1, 2] format, so make that the consistent one.

[1] in llvm `.td` files, the regex `\[[^ ]` (bracket followed by not-a-space) shows up ~400 times, but `\[\s[^ ]` (bracket followed by one space and one not-a-space) shows up ~40 times => ~90% uses this format.

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, arphaman, cfe-commits

Tags: #clang

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

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