Commit Graph

76348 Commits

Author SHA1 Message Date
Serge Pavlov acfcd78aec Diagnose friend function template redefinitions.
Friend function template defined in a class template becomes available if
the enclosing class template is instantiated. Until the function template
is used, it does not have a body, but still is considered a definition for
the purpose of redeclaration checks.

This change modifies redefinition check so that it can find the friend
function template definitions in instantiated classes.

Differential Revision: http://reviews.llvm.org/D21508

llvm-svn: 348473
2018-12-06 09:35:04 +00:00
Stephen Kelly fe8231ecca Add test for ObjC generics
llvm-svn: 348471
2018-12-06 09:23:59 +00:00
Stephen Kelly d6518a89e0 Extend OMP test
llvm-svn: 348470
2018-12-06 09:23:53 +00:00
Stephen Kelly 59c4ada8ab Make test resistant to line numbers changing
llvm-svn: 348469
2018-12-06 09:22:12 +00:00
Richard Trieu 587c1cb9f7 Remove unnecessary include.
llvm-svn: 348459
2018-12-06 06:32:40 +00:00
Richard Trieu 5337c74825 Remove CodeGen dependencies on Sema.
Move diagnostics from Sema to Frontend (or Common) so that CodeGen no longer
needs to include the Sema diagnostic IDs.

llvm-svn: 348458
2018-12-06 06:12:20 +00:00
Saleem Abdulrasool f587857c88 ARM, AArch64: support `__attribute__((__swiftcall__))`
Support the Swift calling convention on Windows ARM and AArch64.  Both
of these conform to the AAPCS, AAPCS64 calling convention, and LLVM has
been adjusted to account for the register usage.  Ensure that the
frontend passes this into the backend.  This allows the swift runtime to
be built for Windows.

llvm-svn: 348454
2018-12-06 03:28:37 +00:00
Alex Lorenz 1ae9cd7e6a [darwin] remove version number check when enabling -fobjc-subscripting-legacy-runtime
This subscripting feature actually works on older OS versions anyway.

rdar://36287065

llvm-svn: 348448
2018-12-06 02:44:23 +00:00
Douglas Yung 6d7706fcd8 Reapply fix from r348062 to fix test on Windows.
llvm-svn: 348447
2018-12-06 02:13:09 +00:00
George Karpenkov 0cd6b9b9f7 [attributes] Add more tests for os_returns_retained
llvm-svn: 348443
2018-12-06 01:21:38 +00:00
Leonard Chan ad7ac964e5 [Sema/Attribute] Check for noderef attribute
This patch adds the noderef attribute in clang and checks for dereferences of
types that have this attribute. This attribute is currently used by sparse and
would like to be ported to clang.

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

llvm-svn: 348442
2018-12-06 01:05:54 +00:00
Leonard Chan bf5fe2dbba [Sema] Push and Pop Expression Evaluation Context Records at the start and end of function definitions
This patch creates a new context for every function definition we enter.
Currently we do not push and pop on these, usually working off of the global
context record added in the Sema constructor, which never gets popped.

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

llvm-svn: 348434
2018-12-06 00:10:36 +00:00
Pete Cooper 324ccd5908 Fix title underlines being too short after r348429
llvm-svn: 348431
2018-12-06 00:01:44 +00:00
Pete Cooper 8adc72d176 Update ARC docs as objc_storeStrong returns void not id
llvm-svn: 348429
2018-12-05 23:49:52 +00:00
Douglas Yung 27d16370c3 Fix test change from r348365 to deal with Windows paths correctly.
llvm-svn: 348425
2018-12-05 23:10:14 +00:00
Krzysztof Parzyszek 2a0c7c9c30 [Hexagon] Add intrinsics for Hexagon V66
llvm-svn: 348419
2018-12-05 22:03:04 +00:00
Krzysztof Parzyszek 85393b28f9 [Hexagon] Add support for Hexagon V66
llvm-svn: 348415
2018-12-05 21:38:35 +00:00
Stephen Kelly d8744a7e9f NFC: Extract TextNodeDumper class
Summary:
Start by moving some utilities to it. It will eventually house dumping
of individual nodes (after indentation etc has already been accounted
for).

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348412
2018-12-05 21:12:39 +00:00
Stephen Kelly 0da68bae89 NFC: Extract TextTreeStructure class
Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348410
2018-12-05 20:53:14 +00:00
Stephen Kelly ec42aa036c NFC: Inline handling of DependentSizedArrayType
Summary:
Re-order handling of getElementType and getBracketsRange. It is
necessary to perform all printing before any traversal to child nodes.

This causes no change in the output of ast-dump-array.cpp due to the way
child nodes are printed with a delay.  This new order of the code is
also the order that produces the expected output anyway.

Subscribers: cfe-commits

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

llvm-svn: 348409
2018-12-05 20:34:07 +00:00
Stephen Kelly 9f358871d5 Add dump tests for inherited default template parameters
llvm-svn: 348408
2018-12-05 20:21:13 +00:00
Mandeep Singh Grang b0895f04bc Revert "[RISCV] Mark unit tests as "requires: riscv-registered-target""
This reverts commit 8908dd12e7bbfc74e264233e900206ad31e285f0.

llvm-svn: 348402
2018-12-05 19:19:38 +00:00
Aaron Ballman c3463f6ba8 Do not check for parameters shadowing fields in function declarations.
We would issue a false-positive diagnostic for parameters in function declarations shadowing fields; we now only issue the diagnostic on a function definition instead.

llvm-svn: 348400
2018-12-05 18:56:57 +00:00
Aaron Ballman 83efe2f1f6 Adding tests for -ast-dump; NFC.
This adds tests for various function and class template declarations.

llvm-svn: 348399
2018-12-05 18:53:57 +00:00
Adrian Prantl 56acd5a66e Honor -fdebug-prefix-map when creating function names for the debug info.
This adds a callback to PrintingPolicy to allow CGDebugInfo to remap
file paths according to -fdebug-prefix-map. Otherwise the debug info
(particularly function names for C++ lambdas) may contain paths that
should have been remapped in the debug info.

<rdar://problem/46128056>

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

llvm-svn: 348397
2018-12-05 18:37:44 +00:00
George Karpenkov a717bc78b7 [analyzer] Attribute for RetainCountChecker for OSObject should propagate with inheritance
rdar://46388388

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

llvm-svn: 348396
2018-12-05 18:34:54 +00:00
Ilya Biryukov 88aef52a5d Mention changes to libc++ include dir lookup in release notes.
Summary: The change itself landed as r348365, see the comment for more details.

Reviewers: arphaman, EricWF

Reviewed By: arphaman

Subscribers: cfe-commits

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

llvm-svn: 348394
2018-12-05 18:32:05 +00:00
Erik Pilkington f7357c335f Address a post-commit review comment on r348325.
llvm-svn: 348388
2018-12-05 17:43:26 +00:00
Ilya Biryukov 98397555a5 [CodeComplete] Fix a crash in access checks of inner classes
Summary: The crash was introduced in r348135.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

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

llvm-svn: 348387
2018-12-05 17:38:39 +00:00
Bruno Ricci ac52954703 [Basic] Cleanups in IdentifierInfo following the removal of PTH
The Entry pointer in IdentifierInfo was only null for IdentifierInfo
created from a PTH. Now that PTH support has been removed we can remove
some PTH specific code in IdentifierInfo::getLength and
IdentifierInfo::getNameStart.

Also make the constructor of IdentifierInfo private to make sure that
they are only created by IdentifierTable, and move it to the header so
that it can be inlined in IdentifierTable::get and IdentifierTable::getOwn.

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

Reviewed By: erichkeane

llvm-svn: 348384
2018-12-05 17:16:55 +00:00
Anastasia Stulova 12e3a8af81 [OpenCL] Diagnose conflicting address spaces in templates.
Added new diagnostic when templates are instantiated with
different address space from the one provided in its definition.

This also prevents deducing generic address space in pointer
type of templates to allow giving them concrete address space
during instantiation.

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

llvm-svn: 348382
2018-12-05 17:02:22 +00:00
Jan Korous c8e97b480a [NFC] Use clang-format on PrintingPolicy::PrintingPolicy() after fd5c386f743
The white-space change was causing conflicts downstream.

rdar://problem/46486841

llvm-svn: 348379
2018-12-05 16:19:49 +00:00
Kristina Brooks 1051bb7463 [Haiku] Support __float128 for x86 and x86_64
This patch addresses a compilation error with clang when
running in Haiku being unable to compile code using
float128 (throws compilation error such as 'float128 is
not supported on this target').

Patch by kallisti5 (Alexander von Gluck IV)

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

llvm-svn: 348368
2018-12-05 15:05:06 +00:00
Ilya Biryukov 44a40046c8 Move detection of libc++ include dirs to Driver on MacOS
Summary:
The intention is to make the tools replaying compilations from 'compile_commands.json'
(clang-tidy, clangd, etc.) find the same standard library as the original compiler
specified in 'compile_commands.json'.

Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied
on the value of resource dir as an approximation of the compiler install dir. The new logic
uses the actual compiler install dir and is performed in the driver. This is consistent with
the C++ standard library detection on other platforms and allows to override the resource dir
in the tools using the compile_commands.json without altering the
standard library detection mechanism. The tools have to override the resource dir to make sure
they use a consistent version of the builtin headers.

There is still logic in InitHeaderSearch that attemps to add the absolute includes for the
the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend
via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too,
but it could potentially break the library detection on other systems, so we don't tackle it in this
patch to keep its scope manageable.

This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675.
The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the
driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke
the libc++ detection in clang itself, which caused LLDB tests to break.

The LLDB tests pass with new fix.

Reviewers: JDevlieghere, arphaman, EricWF

Reviewed By: arphaman

Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits

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

llvm-svn: 348365
2018-12-05 14:24:14 +00:00
Renato Golin 5419a3ce12 Revert: Honor -fdebug-prefix-map when creating function names for the debug info.
This commit reverts r348060 and r348062 due to it breaking the AArch64 Full
buildbot: https://bugs.llvm.org/show_bug.cgi?id=39892

llvm-svn: 348364
2018-12-05 13:56:26 +00:00
Michal Gorny 29935acdb1 [test] Disable Modules/prune.m on NetBSD as it requires 'touch -a'
llvm-svn: 348356
2018-12-05 11:17:50 +00:00
George Rimar ab090337c5 [clang] - Simplify tools::SplitDebugName.
This is an updated version of the D54576, which was reverted.

Problem was that SplitDebugName calls the InputInfo::getFilename
which asserts if InputInfo given is not of type Filename:

const char *getFilename() const {
  assert(isFilename() && "Invalid accessor.");
  return Data.Filename;
}
At the same time at that point, it can be of type Nothing and
we need to use getBaseInput(), like original code did.

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

llvm-svn: 348352
2018-12-05 11:09:10 +00:00
Vitaly Buka 8076c57fd2 [asan] Add clang flag -fsanitize-address-use-odr-indicator
Reviewers: eugenis, m.ostapenko, ygribov

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 348327
2018-12-05 01:44:31 +00:00
Erik Pilkington 4b897a3704 [Sema] Remove some conditions of a failing assert
We should have been checking that this state is consistent, but its
possible for it to be filled later, so it isn't really sound to check
it here anyways.

Fixes llvm.org/PR39742

llvm-svn: 348325
2018-12-05 00:43:11 +00:00
Richard Smith 6e67142142 Fix crash if an in-class explicit function specialization has explicit
template arguments referring to template paramaeters.

llvm-svn: 348313
2018-12-04 22:26:32 +00:00
Aaron Ballman baea55c920 Adding tests for -ast-dump; NFC.
This adds tests for the definition data of C++ record objects as well as special member functions.

llvm-svn: 348309
2018-12-04 21:50:08 +00:00
Aaron Ballman e445005c03 Add tests for dumping base classes; NFC.
llvm-svn: 348308
2018-12-04 21:49:24 +00:00
Stefan Pintilie c75a9651d7 [PowerPC] Make no-PIC default to match GCC - CLANG
Make -fno-PIC default on PowerPC LE.

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

llvm-svn: 348299
2018-12-04 20:15:37 +00:00
Bruno Ricci 32a728298c [AST] Assert that no type class is polymorphic
Add a static_assert checking that no type class is polymorphic.
People should use LLVM style RTTI instead.

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

Reviewed By: aaron.ballman

llvm-svn: 348281
2018-12-04 16:36:28 +00:00
Ilya Biryukov 660d233ea5 Revert "Avoid emitting redundant or unusable directories in DIFile metadata entries."
This reverts commit r348154 and follow-up commits r348211 and r3248213.
Reason: the original commit broke compiler-rt tests and a follow-up fix
(r348203) broke our integrate and was reverted.

llvm-svn: 348280
2018-12-04 16:30:45 +00:00
Bruno Ricci 65034b8698 [AST] Assert that no statement/expression class is polymorphic
Add a static_assert checking that no statement/expression class
is polymorphic. People should use LLVM style RTTI instead.

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

Reviewed By: aaron.ballman

llvm-svn: 348278
2018-12-04 16:04:19 +00:00
Bruno Ricci f6d5e141f4 [AST][NFC] Make ArrayTypeTraitExpr non polymorphic
ArrayTypeTraitExpr is the only expression class which is polymorphic.
As far as I can tell this is completely pointless.

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

Reviewed By: aaron.ballman

llvm-svn: 348276
2018-12-04 16:01:24 +00:00
Krzysztof Parzyszek d2e8dd76b5 [Hexagon] Update builtin definitions
llvm-svn: 348275
2018-12-04 15:47:07 +00:00
Alexey Bataev 2c1ff9dda7 [OPENMP][NVPTX]Fixed emission of the critical region.
Critical regions in NVPTX are the constructs, which, generally speaking,
are not supported by the NVPTX target. Instead we're using special
technique to handle the critical regions. Currently they are supported
only within the loop and all the threads in the loop must execute the
same critical region.
Inside of this special regions the regions still must be emitted as
critical, to avoid possible data races between the teams +
synchronization must use __kmpc_barrier functions.

llvm-svn: 348272
2018-12-04 15:25:01 +00:00
Alexey Bataev c3028cac24 [OPENMP][NVPTX]Mark __kmpc_barrier functions as convergent.
__kmpc_barrier runtime functions must be marked as convergent to prevent
some dangerous optimizations. Also, for NVPTX target all barriers must
be emitted as simple barriers.

llvm-svn: 348271
2018-12-04 15:03:25 +00:00