Commit Graph

49094 Commits

Author SHA1 Message Date
Ivan A. Kosarev cbee219700 [CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base info
Differential Revision: https://reviews.llvm.org/D38795

llvm-svn: 315715
2017-10-13 17:34:18 +00:00
Ivan A. Kosarev 78f486d136 [CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info
This patch should not bring in any functional changes.

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

llvm-svn: 315708
2017-10-13 16:58:30 +00:00
Reid Kleckner 65fa869c23 [SEH] Use the SEH personality on frontend-outlined funclets
This allows __try inside __finally to work.

Fixes PR34939

llvm-svn: 315707
2017-10-13 16:55:14 +00:00
Ivan A. Kosarev 1590fd3aa8 [CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info
This patch should not bring in any functional changes.

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

llvm-svn: 315705
2017-10-13 16:50:50 +00:00
Ivan A. Kosarev 9029564e8c [CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info
This patch should not bring in any functional changes.

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

llvm-svn: 315704
2017-10-13 16:47:22 +00:00
Ivan A. Kosarev 229a6d8d17 [CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue base info
This patch should not bring in any functional changes.

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

llvm-svn: 315702
2017-10-13 16:38:32 +00:00
Reid Kleckner e257e18b1c Hide "#pragma optimize("", off)" from clang when it pretends to be MSVC 2017
These pragmas work around a bug in VC 1911 that isn't present in clang,
and clang warns about them.

llvm-svn: 315699
2017-10-13 16:18:32 +00:00
Haojian Wu 5b5c81f683 Fix an unused-variable warning.
llvm-svn: 315689
2017-10-13 15:37:53 +00:00
Haojian Wu 2fe98c2b37 Remove an unused variable.
Fix -Wunused-but-set-variable warning.

llvm-svn: 315688
2017-10-13 15:34:03 +00:00
Yaxun Liu b7318e02c1 [OpenCL] Add LangAS::opencl_private to represent private address space in AST
Currently Clang uses default address space (0) to represent private address space for OpenCL
in AST. There are two issues with this:

Multiple address spaces including private address space cannot be diagnosed.
There is no mangling for default address space. For example, if private int* is emitted as
i32 addrspace(5)* in IR. It is supposed to be mangled as PUAS5i but it is mangled as
Pi instead.

This patch attempts to represent OpenCL private address space explicitly in AST. It adds
a new enum LangAS::opencl_private and adds it to the variable types which are implicitly
private:

automatic variables without address space qualifier

function parameter

pointee type without address space qualifier (OpenCL 1.2 and below)

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

llvm-svn: 315668
2017-10-13 03:37:48 +00:00
Richard Smith 5b34958b46 Support for destroying operator delete, per C++2a proposal P0722.
This feature is not (yet) approved by the C++ committee, so this is liable to
be reverted or significantly modified based on committee feedback.

No functionality change intended for existing code (a new type must be defined
in namespace std to take advantage of this feature).

llvm-svn: 315662
2017-10-13 01:55:36 +00:00
Alex Lorenz ad38fbffad Recommit r315087 "[refactor] add support for refactoring options"
The recommit fixes a UB bug that occurred only on a small number of bots.

Original message:

This commit adds initial support for refactoring options. One can now use
optional and required std::string options.

This commit also adds a NewNameOption for the local-rename refactoring action to
allow rename to work with custom names.

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

llvm-svn: 315661
2017-10-13 01:53:13 +00:00
Reid Kleckner 3da37e05f7 [MS] Don't bail on replacing dllimport vbase dtors with base dtors
Fix PR32990 by effectively reverting r283063 and solving it a different
way.

We want to limit the hack to not replace equivalent available_externally
dtors specifically to libc++, which uses always_inline. It seems certain
versions of libc++ do not provide all the symbols that an explicit
template instantiation is expected to provide.

If we get to the code that forms a real alias, only *then* check if this
is available_externally, and do that by asking a better question, which
is "is this a declaration for the linker?", because *that's* what means
we can't form an alias to it.

As a follow-on simplification, remove the InEveryTU parameter. Its last
use guarded this code for forming aliases, but we should never form
aliases to declarations, regardless of what we know about every TU.

llvm-svn: 315656
2017-10-13 00:53:02 +00:00
George Karpenkov 9a542f7553 [Analyzer] Assume that CFBooleanRef const globals are non-null
Differential Revision: https://reviews.llvm.org/D38867

llvm-svn: 315655
2017-10-13 00:51:41 +00:00
Adam Nemet 7b1faaacbe Handle/assert on DK_Remark
We don't generate remarks during inline assembly parsing so no need to handle
these for now.

llvm-svn: 315643
2017-10-12 23:56:54 +00:00
Akira Hatanaka 73cab88c49 [Sema][ObjC] Complete merging ObjC methods before checking their
overriding methods.

This should fix test case Analysis/retain-release.m that was failing on
the reverse iteration bot:

http://lab.llvm.org:8011/builders/reverse-iteration

The test used to fail because the loop in CheckObjCMethodOverrides would
merge attribute ns_returns_retained on methods while checking whether
the overriding methods were compatible. Since OverrideSearch::Overridden
is a SmallPtrSet and the order in which the elements of the set are
visited is non-deterministic, the test would fail when method 'clone' of
the protocol 'F18P' was visited before F18(Cat)'s method 'clone' was
visited.

llvm-svn: 315639
2017-10-12 23:24:38 +00:00
Erich Keane 883f22ef7e [Sema][Crash] Correctly handle an non-dependent noexcept expr in function template
It seems that all of the other templated cases are handled correctly,
however the function template case was not correctly handled. This
patch recovers from this condition by setting the function to noexcept
after diagnosing. Previously it simply set NoexceptExpr to null,
which caused an Assert when this was evaluated during substitution.

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

llvm-svn: 315638
2017-10-12 23:01:53 +00:00
Roman Lebedev 6f405dbe5c Revert "[Sema] Diagnose tautological comparison with type's min/max values"
This reverts r315614,r315615,r315621,r315622
Breaks http://bb9.pgr.jp/#/builders/20/builds/59

/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:95:17: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare]
    if (max_sec > Lim::max()) return false;
        ~~~~~~~ ^ ~~~~~~~~~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:13: error: comparison 'long long' < -9223372036854775808 is always false [-Werror,-Wtautological-constant-compare]
    if (sec < Lim::min() || sec > Lim::max())   return false;
        ~~~ ^ ~~~~~~~~~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:33: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare]
    if (sec < Lim::min() || sec > Lim::max())   return false;
                            ~~~ ^ ~~~~~~~~~~
3 errors generated.
--

I'm not yet sure what is the proper fix.

llvm-svn: 315631
2017-10-12 22:03:20 +00:00
Artem Belevich 91cc00bde6 [CUDA] Added __hmma_m16n16k16_* builtins to support mma instructions on sm_70
Differential Revision: https://reviews.llvm.org/D38742

llvm-svn: 315624
2017-10-12 21:32:19 +00:00
Davide Italiano fe54b50583 [SemaChecking] Suppress a GCC warning. NFCI.
llvm-svn: 315621
2017-10-12 21:08:29 +00:00
Roman Lebedev bd1fc22043 [Sema] Diagnose tautological comparison with type's min/max values
Summary:
Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`),
and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the
`std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak

Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565

Reviewers: rjmccall, rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: rtrieu, jroelofs, cfe-commits

Tags: #clang

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

llvm-svn: 315614
2017-10-12 20:16:51 +00:00
Alexey Bataev a7b19157ba [OPENMP] Fix PR34927: Emit initializer for reduction array with declare
reduction.

If the reduction is an array or an array section and reduction operation
is declare reduction without initializer, it may lead to crash.

llvm-svn: 315611
2017-10-12 20:03:39 +00:00
Craig Topper 89cd7533f7 [X86] Add CLWB intrinsic. clang part
Reviewers: RKSimon, zvi, igorb

Reviewed By: RKSimon

Subscribers: cfe-commits

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

llvm-svn: 315607
2017-10-12 18:57:15 +00:00
Alexey Bataev 7b0f1f09a9 [OPENMP] Fix PR34926: Fix handling of the array sections passed as
function params.

Codegen could crash if the array section base expression is the
function parameter.

llvm-svn: 315586
2017-10-12 15:18:41 +00:00
Alexey Bataev 311a928359 [OPENMP] Fix PR34925: Fix getting thread_id lvalue for inlined regions
in C.

If we try to get the lvalue for thread_id variables in inlined regions,
we did not use the correct version of function. Fixed this bug by adding
overrided version of the function getThreadIDVariableLValue for inlined
regions.

llvm-svn: 315578
2017-10-12 13:51:32 +00:00
Ivan A. Kosarev f5f204679b [CodeGen] Generate TBAA info along with LValue base info
This patch enables explicit generation of TBAA information in all
cases where LValue base info is propagated or constructed in
non-trivial ways. Eventually, we will consider each of these
cases to make sure the TBAA information is correct and not too
conservative. For now, we just fall back to generating TBAA info
from the access type.

This patch should not bring in any functional changes.

This is part of D38126 reworked to be a separate patch to
simplify review.

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

llvm-svn: 315575
2017-10-12 11:29:46 +00:00
NAKAMURA Takumi 12ab07e000 Fix warnings. [-Wdocumentation]
llvm-svn: 315573
2017-10-12 09:42:14 +00:00
NAKAMURA Takumi 5dadfd4bde SVal::getAsSymbol(bool IncludeBaseRegions): Follow clang/StaticAnalyzer/Core/PathSensitive/SVals.h, s/IncludeBaseRegion/IncludeBaseRegions/g [-Wdocumentation]
llvm-svn: 315572
2017-10-12 09:42:12 +00:00
Martin Storsjo d8a44ed74c [COFF, ARM64] Add MS builtins __dmb, __dsb, __isb
Differential Revision: https://reviews.llvm.org/D38821

llvm-svn: 315567
2017-10-12 07:05:37 +00:00
Zachary Turner 41a9ee98f9 Revert "[ADT] Make Twine's copy constructor private."
This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5.

This is failing due to some code that isn't built on MSVC
so I didn't catch.  Not immediately obvious how to fix this
at first glance, so I'm reverting for now.

llvm-svn: 315536
2017-10-11 23:54:34 +00:00
Zachary Turner 337462b365 [ADT] Make Twine's copy constructor private.
There's a lot of misuse of Twine scattered around LLVM.  This
ranges in severity from benign (returning a Twine from a function
by value that is just a string literal) to pretty sketchy (storing
a Twine by value in a class).  While there are some uses for
copying Twines, most of the very compelling ones are confined
to the Twine class implementation itself, and other uses are
either dubious or easily worked around.

This patch makes Twine's copy constructor private, and fixes up
all callsites.

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

llvm-svn: 315530
2017-10-11 23:33:06 +00:00
Vedant Kumar f538018562 [Driver] Export symbols needed to use profile runtime
Apple's API verification tool (tapi) checks that the symbols exported
from a program match a whitelist. When the program uses the profile
runtime, some additional symbols which are typically not part of the
regular whitelist must be exported.

If we're using symbol export directives along with the profile runtime
on Darwin, the driver needs to export the additional symbols to avoid
verification failures.

rdar://problem/30067753

llvm-svn: 315518
2017-10-11 21:54:09 +00:00
Craig Topper 8c8e83a15f [X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.
The compiler-rt implementation already supported it, it just wasn't exposed.

llvm-svn: 315517
2017-10-11 21:42:02 +00:00
George Karpenkov c928e1f595 [Analyzer] Support bodyfarming libstdc++ implementation of std::call_once.
Differential Revision: https://reviews.llvm.org/D38810

llvm-svn: 315508
2017-10-11 20:53:01 +00:00
George Karpenkov 734cad8790 [Analyzer] Fix introduced regression: properly check for nullable attribute.
llvm-svn: 315492
2017-10-11 19:13:15 +00:00
George Karpenkov ead0162801 [Analyzer] Assume that string-like const globals are non-nil.
Differential Revision: https://reviews.llvm.org/D38764

llvm-svn: 315488
2017-10-11 18:39:40 +00:00
Craig Topper 189576f80e [X86] Correct type for argument to clflushopt intrinsic.
Summary: According to Intel docs this should take void const *. We had char*. The lack of const is the main issue.

Reviewers: RKSimon, zvi, igorb

Reviewed By: igorb

Subscribers: llvm-commits

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

llvm-svn: 315470
2017-10-11 16:06:08 +00:00
Alexey Bataev 3a03a7f636 [OPENMP] Remove extra if, NFC.
llvm-svn: 315467
2017-10-11 15:56:38 +00:00
Alexey Bataev e213f3e61a [OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.
If both taskloop and task directives are used at the same time in one
program, we may ran into the situation when the particular type for task
directive is reused for taskloop directives. Patch fixes this problem.

llvm-svn: 315464
2017-10-11 15:29:40 +00:00
Daniel Marjamaki d3d83681bc [Analyzer] Clarify error messages for undefined result
Differential Revision: https://reviews.llvm.org/D30295

llvm-svn: 315462
2017-10-11 14:49:35 +00:00
Alexey Bader 1f2779407e [OpenCL] Allow function declaration with empty argument list.
Treat 'f()' as 'f(void)' rather than a function w/o a prototype.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia, yaxunl

Subscribers: cfe-commits, echuraev, chapuni

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

Re-apply revision 306653.

llvm-svn: 315453
2017-10-11 11:16:31 +00:00
Haojian Wu 19d7299a8b [clang-rename] Don't add prefix qualifiers to the declaration and definition of the renamed symbol.
Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, arphaman

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

llvm-svn: 315452
2017-10-11 11:15:48 +00:00
Daniel Jasper 4a6d5b72af Revert r314955: "Remove PendingBody mechanism for function and ObjC method deserialization."
This is breaking a build of https://github.com/abseil/abseil-cpp and so
likely not really NFC. Also reverted subsequent r314956/7.

I'll forward reproduction instructions to Richard.

llvm-svn: 315439
2017-10-11 07:47:54 +00:00
Richard Smith 197f68da76 [modules] Fix visibility checking for using declarations via ADL.
We want to check whether the using (shadow) declaration itself is visible, not
whether its target is visible.

llvm-svn: 315408
2017-10-11 01:49:57 +00:00
Richard Smith b920f85d8e [modules] Only take visible using-directives into account during name lookup.
llvm-svn: 315402
2017-10-11 01:19:11 +00:00
Alex Lorenz c1e32fca96 A '<' with a trigraph '#' is not a valid editor placeholder
Credit to OSS-Fuzz for discovery:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3137#c5

rdar://34923985

llvm-svn: 315398
2017-10-11 00:41:20 +00:00
Richard Smith 18057cb34c [Modules TS] Diagnose missing/duplicate module-declaration.
llvm-svn: 315397
2017-10-11 00:36:56 +00:00
Adrian Prantl f3d9b488bd Include getting generated struct offsets in CodegenABITypes
This change adds a new function, CodeGen::getFieldNumber, that
enables a user of clang's code generation to get the field number
in a generated LLVM IR struct that corresponds to a particular field
in a C struct.

It is important to expose this information in Clang's code generation
interface because there is no reasonable way for users of Clang's code
generation to get this information. In particular:

LLVM struct types do not include field names.
Clang adds a non-trivial amount of logic to the code generation of LLVM IR types for structs, in particular to handle padding and bit fields.

Patch by Michael Ferguson!

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

llvm-svn: 315392
2017-10-10 23:54:21 +00:00
Richard Smith d97d35e150 [Modules TS] Diagnose attempts to enter module implementation units without the module interface being available.
llvm-svn: 315381
2017-10-10 22:35:27 +00:00
Richard Smith becb92dec8 [Modules TS] Module ownership semantics for redeclarations.
When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

This reinstates r315251 and r315256, reverted in r315309 and r315308
respectively, tweaked to avoid triggering a linkage calculation when declaring
implicit special members (this exposed our pre-existing issue with typedef
names for linkage changing the linkage of types whose linkage has already been
computed and cached in more cases). A testcase for that regression has been
added in r315366.

llvm-svn: 315379
2017-10-10 22:33:17 +00:00