]> granicus.if.org Git - clang/log
clang
5 years ago[Fuchsia] Support multilib for -fsanitize=address and -fno-exceptions
Petr Hosek [Sat, 27 Apr 2019 00:25:13 +0000 (00:25 +0000)]
[Fuchsia] Support multilib for -fsanitize=address and -fno-exceptions

This introduces a support for multilibs to Fuchsia driver. Unlike the
existing multilibs that are used primarily for handling different
architecture variants, we use multilibs to handle different variants
of Clang runtime libraries: -fsanitize=address and -fno-exceptions
are the two we support initially. This replaces the existing support
for sanitized runtimes libraries that was only used by Fuchsia driver
and it also refactors some of the logic to allow sharing between GNU
and Fuchsia drivers.

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

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

5 years ago[Driver] Support priority for multilibs
Petr Hosek [Sat, 27 Apr 2019 00:25:11 +0000 (00:25 +0000)]
[Driver] Support priority for multilibs

When more than one multilib flag matches, try to select the best
possible match based on priority. When two different multilibs with
the same same priority match, we still throw an error matching the
existing behavior.

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

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

5 years ago[clang][driver] Weaken the test from 359353 to appease Windows bots
Alex Lorenz [Fri, 26 Apr 2019 22:58:31 +0000 (22:58 +0000)]
[clang][driver] Weaken the test from 359353 to appease Windows bots

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

5 years ago[driver][macOS] Link libarclite from the default toolchain when clang
Alex Lorenz [Fri, 26 Apr 2019 22:40:47 +0000 (22:40 +0000)]
[driver][macOS] Link libarclite from the default toolchain when clang
is running in a toolchain outside of xcode

'libarclite' usually lives in the same toolchain as 'clang'. However, the
Swift open source toolchains for macOS distribute Clang without 'libarclite'.
In that case, to allow the linker to find 'libarclite', we point to the
'libarclite' that should be in the XcodeDefault toolchain instead. The
path to the toolchain is inferred from the SDK path if it's specified.

https://bugs.swift.org/browse/SR-9972
rdar://49947573

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

5 years agoAdd to the release notes the fact that UninitializedObject checker is now
Sylvestre Ledru [Fri, 26 Apr 2019 21:46:33 +0000 (21:46 +0000)]
Add to the release notes the fact that UninitializedObject checker is now
considered as stable

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

5 years ago[AArch64] Add support for MTE intrinsics
Javed Absar [Fri, 26 Apr 2019 21:08:11 +0000 (21:08 +0000)]
[AArch64] Add support for MTE intrinsics
This provides intrinsics support for Memory Tagging Extension (MTE),
which was introduced with the Armv8.5-a architecture.
These intrinsics are available when __ARM_FEATURE_MEMORY_TAGGING is defined.
Each intrinsic is described in detail in the ACLE Q1 2019 documentation:
https://developer.arm.com/docs/101028/latest
Reviewed By: Tim Nortover, David Spickett
Differential Revision: https://reviews.llvm.org/D60485

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

5 years ago[MinGW] Always emit local typeinfo
Martin Storsjo [Fri, 26 Apr 2019 19:31:51 +0000 (19:31 +0000)]
[MinGW] Always emit local typeinfo

This makes sure that code built with headers for a statically linked
libc++ also works when linking to the DLL version, when the DLL
hasn't been built with --export-all-symbols.

This matches what GCC for MinGW does for this test case.

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

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

5 years ago[HIP] Fix visibility of `__constant__` variables.
Michael Liao [Fri, 26 Apr 2019 19:31:48 +0000 (19:31 +0000)]
[HIP] Fix visibility of `__constant__` variables.

Summary:
- `__constant__` variables should not be `hidden` as the linker may turn
  them into `LOCAL` symbols.

Reviewers: yaxunl

Subscribers: jvesely, nhaehnle, cfe-commits

Tags: #clang

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

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

5 years ago[MinGW] Do dllexport inline methods in template instantiation
Martin Storsjo [Fri, 26 Apr 2019 19:31:46 +0000 (19:31 +0000)]
[MinGW] Do dllexport inline methods in template instantiation

Normally, in MinGW mode, inline methods aren't dllexported.

However, in the case of a dllimported template instantiation,
the inline methods aren't instantiated locally, but referenced
from the instantiation. Therefore, those methods also need to
be dllexported, in the case of an instantiation.

GCC suffers from the same issue, reported at [1], but the issue
is still unresolved there.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89088

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

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

5 years ago[MinGW] Don't let template instantiation declarations cover nested classes
Martin Storsjo [Fri, 26 Apr 2019 19:31:39 +0000 (19:31 +0000)]
[MinGW] Don't let template instantiation declarations cover nested classes

An explicit template instantiation declaration used to let
callers assume both outer and nested classes instantiations were
defined in a different translation unit.

If the instantiation is marked dllexport, only the outer class
is exported, but the caller will try to reference the instantiation
of both outer and inner classes.

This makes MinGW mode match both MSVC and Windows Itanium, by
having instantations only cover the outer class, and locally emitting
definitions of the nested classes. Windows Itanium was changed to
use this behavious in SVN r300804.

This deviates from what GCC does, but should be safe (and only
inflate the object file size a bit, but MSVC and Windows Itanium
modes do the same), and fixes cases where inner classes aren't
dllexported.

This fixes missing references in combination with dllexported/imported
template intantiations.

GCC suffers from the same issue, reported at [1], but the issue
is still unresolved there. The issue can probably be solved either
by making dllexport cover all nested classes as well, or this
way (matching MSVC).

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89087

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

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

5 years ago[OPENMP]Added check for non-random access types for the dependent loop
Alexey Bataev [Fri, 26 Apr 2019 19:28:37 +0000 (19:28 +0000)]
[OPENMP]Added check for non-random access types for the dependent loop
counters.

According to the OpenMP 5.0, For any associated loop where the b or lb
expression is not loop invariant with respect to the outermost loop, the
var-outer that appears in the expression may not have a random access
iterator type.

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

5 years ago[ASTImporter] Copy Argument Passing Restrictions setting when importing a CXXRecordDe...
Shafik Yaghmour [Fri, 26 Apr 2019 18:51:28 +0000 (18:51 +0000)]
[ASTImporter] Copy Argument Passing Restrictions setting when importing a CXXRecordDecl definition

Summary:
For a CXXRecordDecl the RecordDeclBits are stored in the DeclContext. Currently when we import the definition of a CXXRecordDecl via the ASTImporter we do not copy over this data.
This change will add support for copying the ArgPassingRestrictions from RecordDeclBits to fix an LLDB expression parsing bug where we would set it to not pass in registers.
Note, we did not copy over any other of the RecordDeclBits since we don't have tests for those. We know that copying over LoadedFieldsFromExternalStorage would be a error and that may be the case for others as well.

The companion LLDB review: https://reviews.llvm.org/D61146

Differential Review: https://reviews.llvm.org/D61140

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

5 years ago[BPF] do not generate predefined macro bpf
Yonghong Song [Fri, 26 Apr 2019 15:35:51 +0000 (15:35 +0000)]
[BPF] do not generate predefined macro bpf

"DefineStd(Builder, "bpf", Opts)" generates the following three
macros:
  bpf
  __bpf
  __bpf__
and the macro "bpf" is due to the fact that the target language
is C which allows GNU extensions.

The name "bpf" could be easily used as variable name or type
field name. For example, in current linux kernel, there are
four places where bpf is used as a field name. If the corresponding
types are included in bpf program, the compilation error will
occur.

This patch removed predefined macro "bpf" as well as "__bpf" which
is rarely used if used at all.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D61173

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

5 years ago[MinGW] Fix dllexport of explicit template instantiation
Martin Storsjo [Fri, 26 Apr 2019 08:09:51 +0000 (08:09 +0000)]
[MinGW] Fix dllexport of explicit template instantiation

Contrary to MSVC, GCC/MinGW needs to have the dllexport attribute
on the template instantiation declaration, not on the definition.

Previously clang never marked explicit template instantiations as
dllexport in MinGW mode, if the instantiation had a previous
declaration, regardless of where the attribute was placed. This
makes Clang behave like GCC in this regard, and allows using the
same attribute form for both MinGW compilers.

This fixes PR40256.

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

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

5 years ago[Analyzer] Iterator Checkers - Do an early return after handling calls
Adam Balogh [Fri, 26 Apr 2019 07:30:07 +0000 (07:30 +0000)]
[Analyzer] Iterator Checkers - Do an early return after handling calls

This patch is more of a fix than a real improvement: in checkPostCall()
we should return immediately after finding the right call and handling
it. This both saves unnecessary processing and double-handling calls by
mistake.

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

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

5 years ago[clang-format] Fix documentation for FixNamespaceComments
Owen Pan [Fri, 26 Apr 2019 07:05:47 +0000 (07:05 +0000)]
[clang-format] Fix documentation for FixNamespaceComments

Fixes PR40409

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

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

5 years agoPR41607: Don't forget to substitute outer template arguments into a
Richard Smith [Fri, 26 Apr 2019 02:11:23 +0000 (02:11 +0000)]
PR41607: Don't forget to substitute outer template arguments into a
class-scope explicit specialization of a class template.

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

5 years ago[analyzer] RetainCount: Add a suppression for "the Matching rule".
Artem Dergachev [Fri, 26 Apr 2019 02:05:18 +0000 (02:05 +0000)]
[analyzer] RetainCount: Add a suppression for "the Matching rule".

In the OSObject universe there appears to be another slightly popular contract,
apart from "create" and "get", which is "matching". It optionally consumes
a "table" parameter and if a table is passed, it fills in the table and
returns it at +0; otherwise, it creates a new table, fills it in and
returns it at +1.

For now suppress false positives by doing a conservative escape on all functions
that end with "Matching", which is the naming convention that seems to be
followed by all such methods.

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

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

5 years ago[analyzer] RetainCount: Allow offsets in return values.
Artem Dergachev [Fri, 26 Apr 2019 02:05:15 +0000 (02:05 +0000)]
[analyzer] RetainCount: Allow offsets in return values.

Because RetainCountChecker has custom "local" reasoning about escapes,
it has a separate facility to deal with tracked symbols at end of analysis
and check them for leaks regardless of whether they're dead or not.
This facility iterates over the list of tracked symbols and reports
them as leaks, but it needs to treat the return value specially.

Some custom allocators tend to return the value with an offset, storing
extra metadata at the beginning of the buffer. In this case the return value
would be a non-base region. In order to avoid false positives, we still need to
find the original symbol within the return value, otherwise it'll be unable
to match it to the item in the list of tracked symbols.

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

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

5 years ago[analyzer] Fix crash when returning C++ objects from ObjC messages-to-nil.
Artem Dergachev [Fri, 26 Apr 2019 02:05:12 +0000 (02:05 +0000)]
[analyzer] Fix crash when returning C++ objects from ObjC messages-to-nil.

the assertion is in fact incorrect: there is a cornercase in Objective-C++
in which a C++ object is not constructed with a constructor, but merely
zero-initialized. Namely, this happens when an Objective-C message is sent
to a nil and it is supposed to return a C++ object.

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

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

5 years ago[www] Rebuild cxx_dr_status.
Richard Smith [Fri, 26 Apr 2019 01:51:08 +0000 (01:51 +0000)]
[www] Rebuild cxx_dr_status.

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

5 years agoC++ DR2387: a variable template declared wtih (or instantiated with) a
Richard Smith [Fri, 26 Apr 2019 01:51:08 +0000 (01:51 +0000)]
C++ DR2387: a variable template declared wtih (or instantiated with) a
const-qualified type is not implicitly given internal linkage. But a
variable template declared 'static' is.

This reinstates part of r359048, reverted in r359076.

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

5 years agoAdd missing diagnostic for explicit instantiation declarations naming
Richard Smith [Fri, 26 Apr 2019 01:51:07 +0000 (01:51 +0000)]
Add missing diagnostic for explicit instantiation declarations naming
internal linkage entities.

Such constructs are ill-formed by [temp.explicit]p13. We make a special
exception to permit an invalid construct used by libc++ in some build
modes: its <valarray> header declares some functions with the
internal_linkage attribute and then (meaninglessly) provides explicit
instantiation declarations for them. Luckily, Clang happens to
effectively ignore the explicit instantiation declaration when
generating code in this case, and this change codifies that behavior.

This reinstates part of r359048, reverted in r359076. (The libc++ issue
triggering the rollback has been addressed.)

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

5 years agoRevert lib/Header: Fix Visual Studio builds
Tom Stellard [Fri, 26 Apr 2019 01:43:59 +0000 (01:43 +0000)]
Revert lib/Header: Fix Visual Studio builds

This reverts r359257 (git commit 00d9789509a4c573a48f60893b95314a119edd42)

This broke check-clang.

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

5 years agolib/Header: Fix Visual Studio builds
Tom Stellard [Fri, 26 Apr 2019 01:18:59 +0000 (01:18 +0000)]
lib/Header: Fix Visual Studio builds

Summary:
This is a follow up to r355253, which inadvertently broke Visual
Studio builds by trying to copy files from CMAKE_CFG_INTDIR.

See https://reviews.llvm.org/D58537#inline-532492

Reviewers: smeenai, vzakhari, phosek

Reviewed By: smeenai

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years agoRevert [COFF] Statically link certain runtime library functions
Reid Kleckner [Thu, 25 Apr 2019 23:30:41 +0000 (23:30 +0000)]
Revert [COFF] Statically link certain runtime library functions

This reverts r359250 (git commit 4730604bd3a361c68b92b18bf73a5daa15afe9f4)

The newly added test should use -cc1 and -emit-llvm and there are other
test failures that need fixing.

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

5 years ago[COFF] Statically link certain runtime library functions
Reid Kleckner [Thu, 25 Apr 2019 23:04:20 +0000 (23:04 +0000)]
[COFF] Statically link certain runtime library functions

Statically link certain runtime library functions for MSVC/GNU Windows
environments. This is consistent with MSVC behavior.

Fixes LNK4286 and LNK4217 warnings from link.exe when linking the static
CRT:
  LINK : warning LNK4286: symbol '__std_terminate' defined in 'libvcruntime.lib(ehhelpers.obj)' is imported by 'ASAN_NOINST_TEST_OBJECTS.asan_noinst_test.cc.x86_64-calls.o'
  LINK : warning LNK4286: symbol '__std_terminate' defined in 'libvcruntime.lib(ehhelpers.obj)' is imported by 'ASAN_NOINST_TEST_OBJECTS.asan_test_main.cc.x86_64-calls.o'
  LINK : warning LNK4217: symbol '_CxxThrowException' defined in 'libvcruntime.lib(throw.obj)' is imported by 'ASAN_NOINST_TEST_OBJECTS.gtest-all.cc.x86_64-calls.o' in function '"int `public: static class UnitTest::GetInstance * __cdecl testing::UnitTest::GetInstance(void)'::`1'::dtor$5" (?dtor$5@?0??GetInstance@UnitTest@testing@@SAPEAV12@XZ@4HA)'

Reviewers: mstorsjo, efriedma, TomTan, compnerd, smeenai, mgrang

Subscribers: abdulras, theraven, smeenai, pcc, mehdi_amini, javed.absar, inglorion, kristof.beyls, dexonsmith, cfe-commits

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

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

5 years ago[CUDA] Implemented _[bi]mma* builtins.
Artem Belevich [Thu, 25 Apr 2019 22:28:09 +0000 (22:28 +0000)]
[CUDA] Implemented _[bi]mma* builtins.

These builtins provide access to the new integer and
sub-integer variants of MMA (matrix multiply-accumulate) instructions
provided by CUDA-10.x on sm_75 (AKA Turing) GPUs.

Also added a feature for PTX 6.4. While Clang/LLVM does not generate
any PTX instructions that need it, we still need to pass it through to
ptxas in order to be able to compile code that uses the new 'mma'
instruction as inline assembly (e.g used by NVIDIA's CUTLASS library
https://github.com/NVIDIA/cutlass/blob/master/cutlass/arch/mma.h#L101)

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

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

5 years ago[PGO] Fix buildbot failure in 359215
Rong Xu [Thu, 25 Apr 2019 21:16:41 +0000 (21:16 +0000)]
[PGO] Fix buildbot failure in 359215

Revert the part of changes in r359215 that failing in some platforms.
I will re-enable them later.

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

5 years ago[analyzer] Add FIXMEs for alpha.unix.cstring.OutOfBounds false positives.
Artem Dergachev [Thu, 25 Apr 2019 20:30:14 +0000 (20:30 +0000)]
[analyzer] Add FIXMEs for alpha.unix.cstring.OutOfBounds false positives.

Caused by incorrect strlcat() modeling in r332303,
cf. https://bugs.llvm.org/show_bug.cgi?id=37687#c8

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

5 years agoSkip type units/type uniquing when we know we're only emitting the type once (vtable...
David Blaikie [Thu, 25 Apr 2019 20:05:47 +0000 (20:05 +0000)]
Skip type units/type uniquing when we know we're only emitting the type once (vtable-based emission when triggered by a strong vtable, with -fno-standalone-debug)

(this would regress size without a corresponding LLVM change that avoids
putting other user defined types inside type units when they aren't in
their own type units - instead emitting declarations inside the type
unit and a definition in the primary CU)

Reviewers: aprantl

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

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

5 years ago[Windows] Separate elements in -print-search-dirs with semicolons
Martin Storsjo [Thu, 25 Apr 2019 20:03:20 +0000 (20:03 +0000)]
[Windows] Separate elements in -print-search-dirs with semicolons

Path lists on windows should always be separated by semicolons, not
colons. Reuse llvm::sys::EnvPathSeparator for this purpose (as that's
also a path list that is separated in the same way).

Alternatively, this could just be a local ifdef _WIN32 in this function,
or generalizing the existing EnvPathSeparator to e.g. a
llvm::sys::path::PathListSeparator?

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

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

5 years ago[analyzer][UninitializedObjectChecker] PR41590: Regard _Atomic types as primitive
Kristof Umann [Thu, 25 Apr 2019 20:00:51 +0000 (20:00 +0000)]
[analyzer][UninitializedObjectChecker] PR41590: Regard _Atomic types as primitive

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

For the following code snippet, UninitializedObjectChecker crashed:

struct MyAtomicInt {
  _Atomic(int) x;
  MyAtomicInt() {}
};

void entry() {
  MyAtomicInt b;
}

The problem was that _Atomic types were not regular records, unions,
dereferencable or primitive, making the checker hit the llvm_unreachable at
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp:347.
The solution is to regard these types as primitive as well. The test case shows
that with this addition, not only are we able to get rid of the crash, but we
can identify x as uninitialized.

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

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

5 years agoDebugInfo: Fix bitrotted test case
David Blaikie [Thu, 25 Apr 2019 18:11:48 +0000 (18:11 +0000)]
DebugInfo: Fix bitrotted test case

This test was updated with some CHECK suffix variants, but dropped
checking for the unsuffixed 'CHECK'

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

5 years agocreduce-clang-crash: add -F flag to grep to avoid interpreting string as regex
Amy Huang [Thu, 25 Apr 2019 18:00:25 +0000 (18:00 +0000)]
creduce-clang-crash: add -F flag to grep to avoid interpreting string as regex

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

5 years ago[PGO] Enable InstrProf lowering for Clang PGO instrumentation in the new pass manager
Rong Xu [Thu, 25 Apr 2019 17:52:43 +0000 (17:52 +0000)]
[PGO] Enable InstrProf lowering for Clang PGO instrumentation in the new pass manager
Currently InstrProf lowering is not enabled for Clang PGO instrumentation in
the new pass manager. The following command
"-fprofile-instr-generate -fexperimental-new-pass-manager ..." is broken.

This CL enables InstrProf lowering pass for Clang PGO instrumentation in the
new pass manager.

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

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

5 years agoFix bug 37903:MS ABI: handle inline static data member and inline variable as templat...
Jennifer Yu [Thu, 25 Apr 2019 17:45:45 +0000 (17:45 +0000)]
Fix bug 37903:MS ABI: handle inline static data member and inline variable as template static data member

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

5 years ago[OPENMP] Improved check for the linear dependency in the non-rectangular
Alexey Bataev [Thu, 25 Apr 2019 16:21:13 +0000 (16:21 +0000)]
[OPENMP] Improved check for the linear dependency in the non-rectangular
loop nests.

Added a checks that the initializer/condition expressions depend only
only of the single previous loop iteration variable.

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

5 years ago[OPENMP][AARCH64]Fix the test for declare simd, NFC.
Alexey Bataev [Thu, 25 Apr 2019 14:04:37 +0000 (14:04 +0000)]
[OPENMP][AARCH64]Fix the test for declare simd, NFC.

Renamed function a01 in the test to fix possible problems with the git
hash match during testing.

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

5 years ago[Testing] Move clangd::Annotations to llvm testing support
Ilya Biryukov [Thu, 25 Apr 2019 10:08:31 +0000 (10:08 +0000)]
[Testing] Move clangd::Annotations to llvm testing support

Summary:
Annotations allow writing nice-looking unit test code when one needs
access to locations from the source code, e.g. running code completion
at particular offsets in a file. See comments in Annotations.cpp for
more details on the API.

Also got rid of a duplicate annotations parsing code in clang's code
complete tests.

Reviewers: gribozavr, sammccall

Reviewed By: gribozavr

Subscribers: mgorny, hiraditya, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[NFC] test commit removing excess line
Nikolai Kosjar [Thu, 25 Apr 2019 08:14:39 +0000 (08:14 +0000)]
[NFC] test commit removing excess line

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

5 years ago[PowerPC][NFC]Update licence to Apache 2
Jinsong Ji [Thu, 25 Apr 2019 02:40:06 +0000 (02:40 +0000)]
[PowerPC][NFC]Update licence to Apache 2

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

5 years agoFix typo in comment in r312851.
Richard Smith [Thu, 25 Apr 2019 00:22:11 +0000 (00:22 +0000)]
Fix typo in comment in r312851.

Thanks to Nico Weber for pointing this out!

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

5 years agoPR41427: This has apparently been fixed already, just add a regression
Richard Smith [Wed, 24 Apr 2019 23:45:56 +0000 (23:45 +0000)]
PR41427: This has apparently been fixed already, just add a regression
test.

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

5 years ago[codeview] Fix symbol names for dynamic initializers and atexit stubs
Reid Kleckner [Wed, 24 Apr 2019 22:45:44 +0000 (22:45 +0000)]
[codeview] Fix symbol names for dynamic initializers and atexit stubs

Summary:
Add a new variant to GlobalDecl for these so that we can detect them
more easily during debug info emission and handle them appropriately.

Reviewers: rsmith, rjmccall, jyu2

Subscribers: aprantl, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Initial support for non-rectangular loop nest.
Alexey Bataev [Wed, 24 Apr 2019 19:58:30 +0000 (19:58 +0000)]
[OPENMP]Initial support for non-rectangular loop nest.

Added basic semantic analysis for the non-rectangular loop nests for
OpenMP 5.0 support.

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

5 years agoclang-cl: List valid values for /std: in /? output
Nico Weber [Wed, 24 Apr 2019 15:31:13 +0000 (15:31 +0000)]
clang-cl: List valid values for /std: in /? output

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

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

5 years agoUse llvm::stable_sort
Fangrui Song [Wed, 24 Apr 2019 14:43:05 +0000 (14:43 +0000)]
Use llvm::stable_sort

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

5 years agoAdd 'REQUIRES: shell' to verbose-output-quoting.c
Hans Wennborg [Wed, 24 Apr 2019 10:12:30 +0000 (10:12 +0000)]
Add 'REQUIRES: shell' to verbose-output-quoting.c

The lit shell couldn't handle these run lines.

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

5 years ago[clang][HeaderSuggestion] Handle the case of dotdot with an absolute path
Kadir Cetinkaya [Wed, 24 Apr 2019 09:23:31 +0000 (09:23 +0000)]
[clang][HeaderSuggestion] Handle the case of dotdot with an absolute path

Summary:
Include insertion in clangd was inserting absolute paths when the
include directory was an absolute path with a double dot. This patch makes sure
double dots are handled both with absolute and relative paths.

Reviewers: sammccall

Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years agoFix unquoted spaces in args in clang --verbose output
Hans Wennborg [Wed, 24 Apr 2019 09:06:03 +0000 (09:06 +0000)]
Fix unquoted spaces in args in clang --verbose output

The behaviour of not quoting spaces appears to have been introduced by
mistake in r190620.

Patch by Brad Moody!

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

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

5 years agoRevert r359048: C++ DR2387: a variable template declared wthi
Ilya Biryukov [Wed, 24 Apr 2019 08:50:24 +0000 (08:50 +0000)]
Revert r359048: C++ DR2387: a variable template declared wthi

The change breaks libc++ with the follwing error:

In file included from valarray:4:
.../include/c++/v1/valarray:1062:60: error: explicit instantiation declaration of 'valarray<_Tp>' with internal linkage
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
                                                           ^
.../include/c++/v1/valarray:1063:60: error: explicit instantiation declaration of '~valarray<_Tp>' with internal linkage
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())

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

5 years ago[clang][HeaderSearch] Make sure there are no backslashes in suggestedPath
Kadir Cetinkaya [Wed, 24 Apr 2019 08:45:03 +0000 (08:45 +0000)]
[clang][HeaderSearch] Make sure there are no backslashes in suggestedPath

Reviewers: sammccall

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

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

5 years ago[Builtins] Implement __builtin_is_constant_evaluated for use in C++2a
Eric Fiselier [Wed, 24 Apr 2019 02:23:30 +0000 (02:23 +0000)]
[Builtins] Implement __builtin_is_constant_evaluated for use in C++2a

Summary:
This patch implements `__builtin_is_constant_evaluated` as specifier by [P0595R2](https://wg21.link/p0595r2). It is built on the back of Bill Wendling's work for `__builtin_constant_p()`.

More tests to come, but early feedback is appreciated.

I plan to implement warnings for common mis-usages like those belowe in a following patch:
```
void foo(int x) {
  if constexpr (std::is_constant_evaluated())) { // condition is always `true`. Should use plain `if` instead.
   foo_constexpr(x);
  } else {
    foo_runtime(x);
  }
}
```

Reviewers: rsmith, MaskRay, bruno, void

Reviewed By: rsmith

Subscribers: dexonsmith, zoecarver, fdeazeve, kristina, cfe-commits

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

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

5 years agoRevert r350917 "[Sema] If CheckPlaceholderExpr rewrites the initializer
Richard Smith [Wed, 24 Apr 2019 02:22:38 +0000 (02:22 +0000)]
Revert r350917 "[Sema] If CheckPlaceholderExpr rewrites the initializer
of an auto"

This commit changed the initializer expression passed into
initialization (stripping off an enclosing pair of parentheses or
braces) and subtly changing the meaning of programs, typically by
inserting bogus calls to copy constructors.

See the added testcase in test/SemaCXX/cxx1y-init-captures.cpp for an
example of the breakage.

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

5 years agoFix interactions between __builtin_constant_p and constexpr to match
Richard Smith [Wed, 24 Apr 2019 01:29:28 +0000 (01:29 +0000)]
Fix interactions between __builtin_constant_p and constexpr to match
current trunk GCC.

GCC permits information from outside the operand of
__builtin_constant_p (but in the same constant evaluation context) to be
used within that operand; clang now does so too. A few other minor
deviations from GCC's behavior showed up in my testing and are also
fixed (matching GCC):
 * Clang now supports nullptr_t as the argument type for
   __builtin_constant_p
 * Clang now returns true from __builtin_constant_p if called with a
   null pointer
 * Clang now returns true from __builtin_constant_p if called with an
   integer cast to pointer type

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

5 years agoFix test after r359009 on platforms where %ms_abi_triple is 32-bit
Nico Weber [Wed, 24 Apr 2019 00:48:04 +0000 (00:48 +0000)]
Fix test after r359009 on platforms where %ms_abi_triple is 32-bit

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

5 years agoFixes in creduce-clang-crash.py for clang crash message parsing and reading the comma...
Amy Huang [Wed, 24 Apr 2019 00:28:23 +0000 (00:28 +0000)]
Fixes in creduce-clang-crash.py for clang crash message parsing and reading the command from the repro script.

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

5 years agoAdd missing diagnostic for anonymous struct/union definitions that don't
Richard Smith [Wed, 24 Apr 2019 00:08:02 +0000 (00:08 +0000)]
Add missing diagnostic for anonymous struct/union definitions that don't
introduce any names.

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

5 years agoImprove -Wuninitialized warning under ARC for block variables that are
Akira Hatanaka [Tue, 23 Apr 2019 23:52:02 +0000 (23:52 +0000)]
Improve -Wuninitialized warning under ARC for block variables that are
recursively captured.

Under ARC, a block variable is zero-initialized when it is recursively
captured by the block literal initializer.

rdar://problem/11022762

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

5 years agoC++ DR2387: a variable template declared wtih (or instantiated with) a
Richard Smith [Tue, 23 Apr 2019 23:48:00 +0000 (23:48 +0000)]
C++ DR2387: a variable template declared wtih (or instantiated with) a
const-qualified type is not implicitly given internal linkage. But a
variable template declared 'static' is.

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

5 years agoMove setTargetAttributes after setGVProperties in SetFunctionAttributes
Scott Linder [Tue, 23 Apr 2019 21:50:11 +0000 (21:50 +0000)]
Move setTargetAttributes after setGVProperties in SetFunctionAttributes

AMDGPU currently relies on global properties being set before
setTargetProperties is called. Existing targets like MIPS which rely on
setTargetProperties do not rely on the current behavior, so this patch
moves the call later in SetFunctionAttributes.

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

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

5 years ago[analyzer] Fix macro names in diagnostics within bigger macros.
Artem Dergachev [Tue, 23 Apr 2019 21:30:30 +0000 (21:30 +0000)]
[analyzer] Fix macro names in diagnostics within bigger macros.

If macro "CHECK_X(x)" expands to something like "if (x != NULL) ...",
the "Assuming..." note no longer says "Assuming 'x' is equal to CHECK_X".

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

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

5 years agoRe-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."
Artem Dergachev [Tue, 23 Apr 2019 21:15:26 +0000 (21:15 +0000)]
Re-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."

It now comes with a follow-up fix for the clients of this API
in clangd and clang-tidy.

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

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

5 years agoRevert "[MS] Emit S_HEAPALLOCSITE debug info" because of ToTWin64(db)
Amy Huang [Tue, 23 Apr 2019 21:12:58 +0000 (21:12 +0000)]
Revert "[MS] Emit S_HEAPALLOCSITE debug info" because of ToTWin64(db)
buildbot failure.

This reverts commit d07d6d617713bececf57f3547434dd52f0f13f9e and
c774f687b6880484a126ed3e3d737e74c926f0ae.

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

5 years ago[clang-format] Fix bug in reflow of block comments containing CR/LF
Owen Pan [Tue, 23 Apr 2019 20:29:46 +0000 (20:29 +0000)]
[clang-format] Fix bug in reflow of block comments containing CR/LF

Fix PR36119

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

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

5 years ago[ThinLTO] Pass down opt level to LTO backend and handle -O0 LTO in new PM
Teresa Johnson [Tue, 23 Apr 2019 18:56:19 +0000 (18:56 +0000)]
[ThinLTO] Pass down opt level to LTO backend and handle -O0 LTO in new PM

Summary:
The opt level was not being passed down to the ThinLTO backend when
invoked via clang (for distributed ThinLTO).

This exposed an issue where the new PM was asserting if the Thin or
regular LTO backend pipelines were invoked with -O0 (not a new issue,
could be provoked by invoking in-process *LTO backends via linker using
new PM and -O0). Fix this similar to the old PM where -O0 only does the
necessary lowering of type metadata (WPD and LowerTypeTest passes) and
then quits, rather than asserting.

Reviewers: xur

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits, pcc

Tags: #clang, #llvm

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

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

5 years ago[APSInt][OpenMP] Fix isNegative, etc. for unsigned types
Joel E. Denny [Tue, 23 Apr 2019 17:04:15 +0000 (17:04 +0000)]
[APSInt][OpenMP] Fix isNegative, etc. for unsigned types

Without this patch, APSInt inherits APInt::isNegative, which merely
checks the sign bit without regard to whether the type is actually
signed.  isNonNegative and isStrictlyPositive call isNegative and so
are also affected.

This patch adjusts APSInt to override isNegative, isNonNegative, and
isStrictlyPositive with implementations that consider whether the type
is signed.

A large set of Clang OpenMP tests are affected.  Without this patch,
these tests assume that `true` is not a valid argument for clauses
like `collapse`.  Indeed, `true` fails APInt::isStrictlyPositive but
not APSInt::isStrictlyPositive.  This patch adjusts those tests to
assume `true` should be accepted.

This patch also adds tests revealing various other similar fixes due
to APSInt::isNegative calls in Clang's ExprConstant.cpp and
SemaExpr.cpp: `++` and `--` overflow in `constexpr`, evaluated object
size based on `alloc_size`, `<<` and `>>` shift count validation, and
OpenMP array section validation.

Reviewed By: lebedev.ri, ABataev, hfinkel

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

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

5 years agoMS ABI: Support mangling op<=> now that MSVC 2019 has a mangling
Nico Weber [Tue, 23 Apr 2019 16:37:42 +0000 (16:37 +0000)]
MS ABI: Support mangling op<=> now that MSVC 2019 has a mangling

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

5 years agoFix "-Wimplicit-fallthrough" warning. NFCI.
Simon Pilgrim [Tue, 23 Apr 2019 11:45:28 +0000 (11:45 +0000)]
Fix "-Wimplicit-fallthrough" warning. NFCI.

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

5 years ago[Analyzer] Second fix for last commit for IteratorChecker
Adam Balogh [Tue, 23 Apr 2019 11:18:50 +0000 (11:18 +0000)]
[Analyzer] Second fix for last commit for IteratorChecker

A variable was redeclared instead of assigned in an internal
block, leaving the original uninitialized. This is fixed now.

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

5 years ago[analyzer][CrossTU] Extend CTU to VarDecls with initializer
Rafael Stahl [Tue, 23 Apr 2019 11:04:41 +0000 (11:04 +0000)]
[analyzer][CrossTU] Extend CTU to VarDecls with initializer

Summary:
The existing CTU mechanism imports `FunctionDecl`s where the definition is available in another TU. This patch extends that to VarDecls, to bind more constants.

- Add VarDecl importing functionality to CrossTranslationUnitContext
- Import Decls while traversing them in AnalysisConsumer
- Add VarDecls to CTU external mappings generator
- Name changes from "external function map" to "external definition map"

Reviewers: NoQ, dcoughlin, xazax.hun, george.karpenkov, martong

Reviewed By: xazax.hun

Subscribers: Charusso, baloghadamsoftware, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, george.karpenkov, mgorny, whisperity, szepet, rnkovacs, a.sidorin, cfe-commits

Tags: #clang

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

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

5 years ago[Analyzer] Fix for previous commit
Adam Balogh [Tue, 23 Apr 2019 07:45:10 +0000 (07:45 +0000)]
[Analyzer] Fix for previous commit

A compilation warning was in my previous commit which broke the buildbot
because it is using `-Werror` for compilation. This patch fixes this
issue.

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

5 years ago[PowerPC] Fix test with -fno-discard-value-names after rC358949
Fangrui Song [Tue, 23 Apr 2019 07:39:23 +0000 (07:39 +0000)]
[PowerPC] Fix test with -fno-discard-value-names after rC358949

For the clang driver, -DLLVM_ENABLE_ASSERTIONS=off builds default to discard value names.

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

5 years ago[Analyzer] Instead of recording comparisons in interator checkers do an eager state...
Adam Balogh [Tue, 23 Apr 2019 07:15:55 +0000 (07:15 +0000)]
[Analyzer] Instead of recording comparisons in interator checkers do an eager state split

Currently iterator checkers record comparison of iterator positions
and process them for keeping track the distance between them (e.g.
whether a position is the same as the end position). However this
makes some processing unnecessarily complex and it is not needed at
all: we only need to keep track between the abstract symbols stored
in these iterator positions. This patch changes this and opens the
path to comparisons to the begin() and end() symbols between the
container (e.g. size, emptiness) which are stored as symbols, not
iterator positions. The functionality of the checker is unchanged.

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

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

5 years ago[PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power
Qiu Chaofan [Tue, 23 Apr 2019 05:50:24 +0000 (05:50 +0000)]
[PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power

Port mmintrin.h which include x86 MMX intrinsics implementation to PowerPC platform (using Altivec).

To make the include process correct, PowerPC's toolchain class is overrided to insert new headers directory (named ppc_wrappers) into the path. Basic test cases for several intrinsic functions are added.

The header is mainly developed by Steven Munroe, with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu.

Reviewed By: Jinsong Ji

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

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

5 years ago[analyzer] Unbreak body farms in presence of multiple declarations.
Artem Dergachev [Tue, 23 Apr 2019 02:56:00 +0000 (02:56 +0000)]
[analyzer] Unbreak body farms in presence of multiple declarations.

When growing a body on a body farm, it's essential to use the same redeclaration
of the function that's going to be used during analysis. Otherwise our
ParmVarDecls won't match the ones that are used to identify argument regions.

This boils down to trusting the reasoning in AnalysisDeclContext. We shouldn't
canonicalize the declaration before farming the body because it makes us not
obey the sophisticated decision-making process of AnalysisDeclContext.

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

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

5 years ago[analyzer] PR41335: Fix crash when no-store event is in a body-farmed function.
Artem Dergachev [Tue, 23 Apr 2019 02:50:38 +0000 (02:50 +0000)]
[analyzer] PR41335: Fix crash when no-store event is in a body-farmed function.

Stuffing invalid source locations (such as those in functions produced by
body farms) into path diagnostics causes crashes.

Fix a typo in a nearby function name.

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

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

5 years ago[analyzer] PR41269: Add a bit of C++ smart pointer modeling.
Artem Dergachev [Tue, 23 Apr 2019 02:45:42 +0000 (02:45 +0000)]
[analyzer] PR41269: Add a bit of C++ smart pointer modeling.

Implement cplusplus.SmartPtrModeling, a new checker that doesn't
emit any warnings but models methods of smart pointers more precisely.

For now the only thing it does is make `(bool) P` return false when `P`
is a freshly moved pointer. This addresses a false positive in the
use-after-move-checker.

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

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

5 years ago[CMake] Replace the sanitizer support in runtimes build with multilib
Petr Hosek [Mon, 22 Apr 2019 23:31:39 +0000 (23:31 +0000)]
[CMake] Replace the sanitizer support in runtimes build with multilib

This is a more generic solution; while the sanitizer support can be used
only for sanitizer instrumented builds, the multilib support can be used
to build other variants such as noexcept which is what we would like to use
in Fuchsia.

The name CMake target name uses the target name, same as for the regular
runtimes build and the name of the multilib, concatenated with '+'. The
libraries are installed in a subdirectory named after the multilib.

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

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

5 years ago[c++2a] Implement semantic restrictions for 'export' declarations.
Richard Smith [Mon, 22 Apr 2019 22:50:11 +0000 (22:50 +0000)]
[c++2a] Implement semantic restrictions for 'export' declarations.

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

5 years ago[VerifyDiagnosticConsumer] Document -verify=<prefixes> in doxygen
Joel E. Denny [Mon, 22 Apr 2019 20:25:06 +0000 (20:25 +0000)]
[VerifyDiagnosticConsumer] Document -verify=<prefixes> in doxygen

Previously, it was only documented by `-cc1 -help`, so people weren't
aware of it, as discussed in D60732.

Reviewed By: Charusso, NoQ

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

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

5 years ago[ASTMatchers] Introduce Objective-C matchers `isClassMessage`, `isClassMethod`, and...
Ben Hamilton [Mon, 22 Apr 2019 17:54:11 +0000 (17:54 +0000)]
[ASTMatchers] Introduce Objective-C matchers `isClassMessage`, `isClassMethod`, and `isInstanceMethod`

Summary:
isClassMessage is an equivalent to isInstanceMessage for ObjCMessageExpr, but matches message expressions to classes.

isClassMethod and isInstanceMethod check whether a method declaration (or definition) is for a class method or instance method (respectively).

Contributed by @mywman!

Reviewers: benhamilton, klimek, mwyman

Reviewed By: benhamilton, mwyman

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[sema][objc] Minor refactor to OverrideSearch. NFCI.
Matt Davis [Mon, 22 Apr 2019 16:04:44 +0000 (16:04 +0000)]
[sema][objc] Minor refactor to OverrideSearch. NFCI.

Summary:
* Removed a member that was only used during construction.
* Use range-based for iteration when accessing the result of the search.
* Require an `ObjCMethodDecl` reference upon construction of an
* Constify.

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: llvm-commits

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

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

5 years ago[Sema] ADL: Associated namespaces for class types and enumeration types (CWG 1691)
Bruno Ricci [Mon, 22 Apr 2019 12:19:00 +0000 (12:19 +0000)]
[Sema] ADL: Associated namespaces for class types and enumeration types (CWG 1691)

CWG 1691 changed the definition of the namespaces associated with a class
type or enumeration type.

For a class type, the associated namespaces are the innermost enclosing
namespaces of the associated classes. For an enumeration type, the associated
namespace is the innermost enclosing namespace of its declaration.

This also fixes CWG 1690 and CWG 1692.

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

Reviewed By: rjmccall, rsmith

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

5 years ago[Sema][NFC] Add more tests for the behavior of argument-dependent name lookup
Bruno Ricci [Mon, 22 Apr 2019 11:40:31 +0000 (11:40 +0000)]
[Sema][NFC] Add more tests for the behavior of argument-dependent name lookup

The goal here is to exercise each rule in [basic.lookup.argdep] at least once.
These new tests expose what I believe are 2 issues:

1. CWG 1691 needs to be implemented (p2:  [...] Its associated namespaces are
   the innermost enclosing namespaces of its associated classes [...]) The
   corresponding tests are adl_class_type::X2 and adl_class_type::X5.

2. The end of paragraph 2 ([...] Additionally, if the aforementioned set of
   overloaded functions is named with a template-id, its associated classes
   and namespaces also include those of its type template-arguments and its
   template template-arguments.) is not implemented. Closely related, the
   restriction on non-dependent parameter types in this same paragraph needs
   to be removed. The corresponding tests are in adl_overload_set (both issues
   are from CWG 997).

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

Reviewed By: riccibruno, Quuxplusone

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

5 years ago[analyzer][www] Moving MoveChecker out of alpha is no longer an open project.
Kristof Umann [Mon, 22 Apr 2019 09:20:23 +0000 (09:20 +0000)]
[analyzer][www] Moving MoveChecker out of alpha is no longer an open project.

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

5 years agoAttempt to fix LLVM_ENABLE_THREADS=OFF build after r358665
Nico Weber [Sun, 21 Apr 2019 19:18:41 +0000 (19:18 +0000)]
Attempt to fix LLVM_ENABLE_THREADS=OFF build after r358665

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

5 years ago[Sema][MSVC] Fix bogus microsoft-pure-definition warning on member function of class...
Bruno Ricci [Sun, 21 Apr 2019 13:12:10 +0000 (13:12 +0000)]
[Sema][MSVC] Fix bogus microsoft-pure-definition warning on member function of class template

Clang emits a warning when using a pure specifier =0 in a function definition
at class scope (a MS-specific construct), when using -fms-extensions.
However, to detect this, it was using FD->isCanonicalDecl() on function
declaration, which was also detecting out-of-class definition of member
functions of class templates. Fix this by using !FD->isOutOfLine() instead.

Fixes PR21334.

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

Reviewed By: riccibruno

Reviewers: rnk, riccibruno

Patch By: Rudy Pons

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

5 years ago[analyzer] Move UninitializedObjectChecker out of alpha
Kristof Umann [Fri, 19 Apr 2019 23:33:50 +0000 (23:33 +0000)]
[analyzer] Move UninitializedObjectChecker out of alpha

Moved UninitializedObjectChecker from the 'alpha.cplusplus' to the
'optin.cplusplus' package.

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

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

5 years agoModules: Adopt template parameters for variable templates to set their decl context...
David Blaikie [Fri, 19 Apr 2019 23:04:05 +0000 (23:04 +0000)]
Modules: Adopt template parameters for variable templates to set their decl context correctly

Exposed by a related bug about visibility of default arguments of nested
templates - without the correct decl context, default template
parameters of variable templates nested in classes would have incorrect
visibility computed.

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

5 years agoModules: Search for a visible definition of the decl context when computing visibilit...
David Blaikie [Fri, 19 Apr 2019 23:02:30 +0000 (23:02 +0000)]
Modules: Search for a visible definition of the decl context when computing visibility of a default template parameter

The code is/was already correct for the case where a parameter is a
parameter of its enclosing lexical DeclContext (functions and classes).
But for other templates (alias and variable templates) they don't create
their own scope to be members of - in those cases, they parameter should
be considered visible if any definition of the lexical decl context is
visible.

[this should cleanup the failure on the libstdc++ modules buildbot]
[this doesn't actually fix the variable template case for a
secondary/compounding reason (its lexical decl context is incorrectly
considered to be the translation unit)]

Test covers all 4 kinds of templates with default args, including a
regression test for the still broken variable template case.

Reviewers: rsmith

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

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

5 years ago[MS] Emit S_HEAPALLOCSITE debug info
Amy Huang [Fri, 19 Apr 2019 21:09:11 +0000 (21:09 +0000)]
[MS] Emit S_HEAPALLOCSITE debug info

Summary:
This emits labels around heapallocsite calls and S_HEAPALLOCSITE debug
info in codeview. Currently only changes FastISel, so emitting labels still
needs to be implemented in SelectionDAG.

Reviewers: hans, rnk

Subscribers: aprantl, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoReapply "[analyzer] Introduce a simplified API for adding custom path notes."
Artem Dergachev [Fri, 19 Apr 2019 20:23:29 +0000 (20:23 +0000)]
Reapply "[analyzer] Introduce a simplified API for adding custom path notes."

This reapplies commit r357323, fixing memory leak found by LSan.

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

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

5 years ago[MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next...
Martin Storsjo [Fri, 19 Apr 2019 19:04:22 +0000 (19:04 +0000)]
[MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next to cl.exe

Previously, if the MSVC installation isn't detected properly, clang
will later just fail to execute link.exe.

This improves using clang in msvc mode on linux, where one intentionally
might not want to point clang to the MSVC installation itself (which
isn't executable as such), but where a link.exe named wine wrapper is
available in the path next to a cl.exe named wine wrapper.

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

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

5 years agoEnable frame pointer elimination for OpenBSD on powerpc.
Brad Smith [Fri, 19 Apr 2019 18:41:40 +0000 (18:41 +0000)]
Enable frame pointer elimination for OpenBSD on powerpc.

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

5 years ago[OPENMP][NVPTX] target [teams distribute] simd maybe run without
Alexey Bataev [Fri, 19 Apr 2019 16:48:38 +0000 (16:48 +0000)]
[OPENMP][NVPTX] target [teams distribute] simd maybe run without
runtime.

target [teams distribute] simd costructs do not require full runtime for
the correct execution, we can run them without full runtime.

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

5 years agoUpdate to use PipelineTuningOptions. Corresponds to llvm change: D59723.
Alina Sbirlea [Fri, 19 Apr 2019 16:32:08 +0000 (16:32 +0000)]
Update to use PipelineTuningOptions. Corresponds to llvm change: D59723.

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

5 years agoDebian: Add two missing version code in sid
Sylvestre Ledru [Fri, 19 Apr 2019 13:48:52 +0000 (13:48 +0000)]
Debian: Add two missing version code in sid

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

5 years agoAdd support of the future Debian (Debian 11 - Bullseye)
Sylvestre Ledru [Fri, 19 Apr 2019 13:46:58 +0000 (13:46 +0000)]
Add support of the future Debian (Debian 11 - Bullseye)
https://wiki.debian.org/DebianBullseye

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