]> granicus.if.org Git - clang/log
clang
6 years ago[libclang] Only mark CXCursors for explicit attributes with a type
Erik Verbruggen [Tue, 24 Apr 2018 08:39:46 +0000 (08:39 +0000)]
[libclang] Only mark CXCursors for explicit attributes with a type

All attributes have a source range associated with it. However, implicit
attributes are added by the compiler, and not added because the user
wrote something in the input. So no token type should be set to
CXCursor_*Attr.

The problem was visible when a class gets marked by e.g.
MSInheritanceAttr, which has the full CXXRecordDecl's range as its
own range. The effect of marking that range as CXCursor_UnexposedAttr
was that all cursors for the record decl, including all child decls,
would become CXCursor_UnexposedAttr.

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

6 years ago[AST] Another attempt at fixing the ARM bots.
Benjamin Kramer [Tue, 24 Apr 2018 08:18:32 +0000 (08:18 +0000)]
[AST] Another attempt at fixing the ARM bots.

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

6 years ago[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.
Benjamin Kramer [Tue, 24 Apr 2018 07:53:10 +0000 (07:53 +0000)]
[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.

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

6 years ago[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.
Craig Topper [Tue, 24 Apr 2018 03:36:08 +0000 (03:36 +0000)]
[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.

The unmasked versions already didn't have this restrction. I don't think gcc or icc limit these to 64-bit mode so we shouldn't either.

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

6 years agoMake add_clang_tool() formatting a bit more consistent.
Nico Weber [Tue, 24 Apr 2018 01:30:44 +0000 (01:30 +0000)]
Make add_clang_tool() formatting a bit more consistent.

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

6 years agoFix build break due to content moving from Scalar.h to InstCombine.h in LLVM
David Blaikie [Tue, 24 Apr 2018 00:59:22 +0000 (00:59 +0000)]
Fix build break due to content moving from Scalar.h to InstCombine.h in LLVM

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

6 years ago[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_...
Craig Topper [Mon, 23 Apr 2018 22:18:36 +0000 (22:18 +0000)]
[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_64.def.

The 32-bit refers to their input/output type, but the instructions are only available in 64-bit mode.

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

6 years ago[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_6...
Craig Topper [Mon, 23 Apr 2018 22:18:34 +0000 (22:18 +0000)]
[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_64.def to make them unavailable in 32-bit mode.

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

6 years ago[AST] strcmp/memcmp always compares unsigned chars.
Benjamin Kramer [Mon, 23 Apr 2018 22:04:34 +0000 (22:04 +0000)]
[AST] strcmp/memcmp always compares unsigned chars.

This makes it return the right result in a couple of edge cases. The
wide versions always do the comparison on the underlying wchar_t type.

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

6 years ago[Docs] Regenerate command line documentation.
Craig Topper [Mon, 23 Apr 2018 21:41:06 +0000 (21:41 +0000)]
[Docs] Regenerate command line documentation.

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

6 years ago[Sema] Add -Wno-self-assign-overloaded
Roman Lebedev [Mon, 23 Apr 2018 21:35:21 +0000 (21:35 +0000)]
[Sema] Add -Wno-self-assign-overloaded

Summary:
It seems there isn't much enthusiasm for `-wtest` D45685.

This is more conservative version, which i had in the very first
revision of D44883, but that 'erroneously' got removed because of the review.

**Based on some [irc] discussions, it must really be documented that
we want all the new diagnostics to have their own flags, to ease
rollouts, transitions, etc.**

Please do note that i'm only adding `-Wno-self-assign-overloaded`,
but not `-Wno-self-assign-field-overloaded`, because i'm honestly
not aware of any false-positives from the `-field` variant,
but i can just as easily add it if wanted.
https://reviews.llvm.org/D44883#1068561

Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith

Reviewed By: dblaikie

Subscribers: Quuxplusone, chandlerc, cfe-commits

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

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

6 years ago[OPENMP] Formatting and code improvement, NFC.
Alexey Bataev [Mon, 23 Apr 2018 19:53:05 +0000 (19:53 +0000)]
[OPENMP] Formatting and code improvement, NFC.

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

6 years agoFix typo in comment.
Nico Weber [Mon, 23 Apr 2018 19:22:52 +0000 (19:22 +0000)]
Fix typo in comment.

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

6 years agoDR727: remove wrong assertion for use of class-scope explicit
Richard Smith [Mon, 23 Apr 2018 18:38:30 +0000 (18:38 +0000)]
DR727: remove wrong assertion for use of class-scope explicit
specialization without -fms-extensions.

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

6 years agoImprove checks in test/Frontend/ftime-report-template-decl.cpp
Bjorn Pettersson [Mon, 23 Apr 2018 18:05:35 +0000 (18:05 +0000)]
Improve checks in test/Frontend/ftime-report-template-decl.cpp

Some buildbots seems to have problems with the CHECKs in
test/Frontend/ftime-report-template-decl.cpp.

I this the problem is that the order in which timers are printed
is based on consumed wall time. So there is no guarantee in which
order the timers are printed.

This patch uses CHECK-DAG instead of CHECK to make the test
case less sensitive to the actual time used by the different
passes.

The (sometimes) failing test cases where introduced in trunk@330571.

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

6 years ago[OPENMP] Do not cast captured by value variables with pointer types in
Alexey Bataev [Mon, 23 Apr 2018 17:33:41 +0000 (17:33 +0000)]
[OPENMP] Do not cast captured by value variables with pointer types in
NVPTX target.

When generating the wrapper function for the offloading region, we need
to call the outlined function and cast the arguments correctly to follow
the ABI. Usually, variables captured by value are casted to `uintptr_t`
type. But this should not performed for the variables with pointer type.

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

6 years agoQuick fix for rC330605: specify a target arch for test
Aleksei Sidorin [Mon, 23 Apr 2018 16:38:29 +0000 (16:38 +0000)]
Quick fix for rC330605: specify a target arch for test

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

6 years ago[analyzer] Don't crash on printing ConcreteInt of size >64 bits
Aleksei Sidorin [Mon, 23 Apr 2018 15:41:44 +0000 (15:41 +0000)]
[analyzer] Don't crash on printing ConcreteInt of size >64 bits

Printing of ConcreteInts with size >64 bits resulted in assertion failure
in get[Z|S]ExtValue() because these methods are only allowed to be used
with integers of 64 max bit width. This patch fixes the issue.

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

6 years agoFix case of LLVM library names.
Nico Weber [Mon, 23 Apr 2018 15:41:08 +0000 (15:41 +0000)]
Fix case of LLVM library names.

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

6 years agoRemove unused code (made unused by r161073, and later more so by r248043).
Nico Weber [Mon, 23 Apr 2018 15:26:15 +0000 (15:26 +0000)]
Remove unused code (made unused by r161073, and later more so by r248043).

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

6 years ago[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisit...
Henry Wong [Mon, 23 Apr 2018 14:41:17 +0000 (14:41 +0000)]
[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisitors.h`.

Summary: `TaintBugVisitor` is a universal visitor, and many checkers rely on it, such as `ArrayBoundCheckerV2.cpp`, `DivZeroChecker.cpp` and `VLASizeChecker.cpp`. Moving `TaintBugVisitor` to `BugReporterVisitors.h` enables other checker can also track where `tainted` value came from.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC

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

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

6 years ago[index] Fix methods that take a shared_ptr to just take a reference.
Benjamin Kramer [Mon, 23 Apr 2018 14:30:21 +0000 (14:30 +0000)]
[index] Fix methods that take a shared_ptr to just take a reference.

There is no ownership here, passing a shared_ptr just adds confusion. No
functionality change intended.

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

6 years ago[analyzer] CStringChecker.cpp - Code refactoring on bug report.
Henry Wong [Mon, 23 Apr 2018 13:36:51 +0000 (13:36 +0000)]
[analyzer] CStringChecker.cpp - Code refactoring on bug report.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

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

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

6 years ago[OpenCL] Reject virtual functions for OpenCL C++
Sven van Haastregt [Mon, 23 Apr 2018 11:23:47 +0000 (11:23 +0000)]
[OpenCL] Reject virtual functions for OpenCL C++

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

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

6 years ago[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident
Mikhail Maltsev [Mon, 23 Apr 2018 10:08:46 +0000 (10:08 +0000)]
[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident

The test case in the original patch was overly contrained and
failed on PPC targets.

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

6 years ago[clang-format] Fix clang-tidy readability problems, NFCI
Krasimir Georgiev [Mon, 23 Apr 2018 10:02:59 +0000 (10:02 +0000)]
[clang-format] Fix clang-tidy readability problems, NFCI

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

6 years agoFormat closing braces when reformatting the line containing the opening brace.
Manuel Klimek [Mon, 23 Apr 2018 09:34:26 +0000 (09:34 +0000)]
Format closing braces when reformatting the line containing the opening brace.

This required a couple of yaks to be shaved:
1. MatchingOpeningBlockLineIndex was misused to also store the
   closing index; instead, use a second variable, as this doesn't
   work correctly for "} else {".
2. We needed to change the API of AffectedRangeManager to not
   use iterators; we always passed in begin / end for the whole
   container before, so there was no mismatch in generality.
3. We need an extra check to discontinue formatting at the top
   level, as we now sometimes change the indent of the closing
   brace, but want to bail out immediately afterwards, for
   example:
     void f() {
       if (a) {
     }
     void g();
   Previously:
     void f() {
       if (a) {
     }
     void g();
   Now:
     void f() {
       if (a) {
       }
     void g();

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

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

6 years ago[Solaris] __float128 is supported on Solaris/x86
Rainer Orth [Mon, 23 Apr 2018 09:28:08 +0000 (09:28 +0000)]
[Solaris] __float128 is supported on Solaris/x86

When rebasing https://reviews.llvm.org/D40898 with GCC 5.4 on Solaris 11.4, I ran
into a few instances of

In file included from /vol/llvm/src/compiler-rt/local/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc:19:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/string:40:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/char_traits.h:39:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:64:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_pair.h:59:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/move.h:57:
/usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/type_traits:311:39: error: __float128 is not supported on this target

  struct __is_floating_point_helper<__float128>
                                    ^

during make check-all.  The line above is inside

#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)

  template<>
    struct __is_floating_point_helper<__float128>
    : public true_type { };

#endif

While the libstdc++ header indicates support for __float128, clang does not, but
should.  The following patch implements this and fixed those errors.

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

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

6 years agoUse special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEna...
Andrew V. Tischenko [Mon, 23 Apr 2018 09:22:30 +0000 (09:22 +0000)]
Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature.
Differential Revision: https://reviews.llvm.org/D45619

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

6 years agoRevert "[clang-format] Improve Incomplete detection for (text) protos"
Krasimir Georgiev [Mon, 23 Apr 2018 08:50:36 +0000 (08:50 +0000)]
Revert "[clang-format] Improve Incomplete detection for (text) protos"

This reverts commit r330016.
The incomplete detection has too many false positives, picking up typos
for hard failures and refusing to format anything in that case.

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

6 years ago[Atomics] warn about atomic accesses using libcalls
Tim Northover [Mon, 23 Apr 2018 08:16:24 +0000 (08:16 +0000)]
[Atomics] warn about atomic accesses using libcalls

If an atomic variable is misaligned (and that suspicion is why Clang emits
libcalls at all) the runtime support library will have to use a lock to safely
access it, with potentially very bad performance consequences. There's a very
good chance this is unintentional so it makes sense to issue a warning.

Also give it a named group so people can promote it to an error, or disable it
if they really don't care.

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

6 years ago[XRay] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Mon, 23 Apr 2018 00:49:25 +0000 (00:49 +0000)]
[XRay] Change std::sort to llvm::sort in response to r327219

r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

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

6 years ago[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677
Jonathan Coe [Sun, 22 Apr 2018 20:51:05 +0000 (20:51 +0000)]
[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677

Summary:
In cindex.py, Cursor.result_type called into the wrong libclang
function, causing cursors for ObjC method declarations to return invalid
result types. Fixes Bug 36677.

Reviewers: jbcoe, rsmith

Reviewed By: jbcoe

Subscribers: cfe-commits, llvm-commits

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

Patch by kjteske (Kyle Teske).

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

6 years agoAdd tests for llvm-bcanalyzer stream types
Brian Gesiak [Sun, 22 Apr 2018 00:04:35 +0000 (00:04 +0000)]
Add tests for llvm-bcanalyzer stream types

Summary:
Add tests for the improved stream type detection added to
`llvm-bcanalyzer` in https://reviews.llvm.org/D41979.

Test Plan: `check-clang`

Reviewers: pcc, aprantl, mehdi_amini, george.karpenkov

Reviewed By: aprantl

Subscribers: cfe-commits, a.sidorin

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

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

6 years ago[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink
Petr Pavlu [Sat, 21 Apr 2018 14:35:18 +0000 (14:35 +0000)]
[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink

Fix testing of clang_File_tryGetRealPathName() in
LibclangReparseTest.FileName when executing in an environment which has
TMPDIR set to a symbolic link that points to an actual directory. The
test would fail because the name returned by
clang_File_tryGetRealPathName() has the symlink resolved but the test
compared it to the original filename of a temporary file.

The patch addresses the problem by checking only that the value returned
by clang_File_tryGetRealPathName() ends with "main.cpp".

Additionally, the patch makes the previous assertion in the test that
checks result of clang_getFileName() stricter. It newly verifies that
the name returned by the function is exactly same as what was given to
clang_parseTranslationUnit()/clang_getFile().

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

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

6 years ago[X86] WaitPKG intrinsics
Gabor Buella [Fri, 20 Apr 2018 18:44:33 +0000 (18:44 +0000)]
[X86] WaitPKG intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years agoRecord whether a module came from a private module map
Jordan Rose [Fri, 20 Apr 2018 17:16:04 +0000 (17:16 +0000)]
Record whether a module came from a private module map

Right now we only use this information in one place, immediately after
we calculate it, but it's still nice information to have. The Swift
project is going to use this to tidy up its "API notes" feature (see
past discussion on cfe-dev that never quite converged).

Reviewed by Bruno Cardoso Lopes.

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

6 years agoRevert r330442, CodeGen/no-ident-version.c is failing on PPC
Mikhail Maltsev [Fri, 20 Apr 2018 17:14:39 +0000 (17:14 +0000)]
Revert r330442, CodeGen/no-ident-version.c is failing on PPC

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

6 years ago[CUDA] Set LLVM calling convention for CUDA kernel
Yaxun Liu [Fri, 20 Apr 2018 17:01:03 +0000 (17:01 +0000)]
[CUDA] Set LLVM calling convention for CUDA kernel

Some targets need special LLVM calling convention for CUDA kernel.
This patch does that through a TargetCodeGenInfo hook.

It only affects amdgcn target.

Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.

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

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

6 years ago[CodeGen] Add an option to suppress output of llvm.ident
Mikhail Maltsev [Fri, 20 Apr 2018 16:29:03 +0000 (16:29 +0000)]
[CodeGen] Add an option to suppress output of llvm.ident

Summary:
By default Clang outputs its version (including git commit hash, in
case of trunk builds) into object and assembly files. It might be
useful to have an option to disable this, especially for debugging
purposes.
This patch implements new command line flags -Qn and -Qy (the names
are chosen for compatibility with GCC). -Qn disables output of
the 'llvm.ident' metadata string and the 'producer' debug info. -Qy
(enabled by default) does the opposite.

Reviewers: faisalv, echristo, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits, JDevlieghere, rogfer01

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

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

6 years agoFix some tests that were failing on Windows
Hans Wennborg [Fri, 20 Apr 2018 15:33:44 +0000 (15:33 +0000)]
Fix some tests that were failing on Windows

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

6 years ago[docs] Regenerate command line reference
Jonas Hahnfeld [Fri, 20 Apr 2018 13:26:03 +0000 (13:26 +0000)]
[docs] Regenerate command line reference

This will correctly sort some manually added entries which should
generally be avoided!

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

6 years ago[OpenMP] Hide -fopenmp-cuda-mode
Jonas Hahnfeld [Fri, 20 Apr 2018 13:25:59 +0000 (13:25 +0000)]
[OpenMP] Hide -fopenmp-cuda-mode

This is an advanced flag that should show up neither in clang --help
nor in the ClangCommandLineReference.

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

6 years agoclang-cl: Accept (and ignore) /Zc:__cplusplus.
Nico Weber [Fri, 20 Apr 2018 13:10:44 +0000 (13:10 +0000)]
clang-cl: Accept (and ignore) /Zc:__cplusplus.

See https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
clang-cl already sets __cplusplus to the correct value, so we can just ignore this flag.

Also add test coverage for a few more accepted-but-ignored flags.

https://reviews.llvm.org/D45877

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

6 years ago[CUDA] Document recent changes
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:54 +0000 (13:04 +0000)]
[CUDA] Document recent changes

 * Finding installations via ptxas binary
 * Relocatable device code

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

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

6 years ago[CUDA] Register relocatable GPU binaries
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:45 +0000 (13:04 +0000)]
[CUDA] Register relocatable GPU binaries

nvcc generates a unique registration function for each object file
that contains relocatable device code. Unique names are achieved
with a module id that is also reflected in the function's name.

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

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

6 years ago[Driver] Support for -save-stats in AddGoldPlugin.
Florian Hahn [Fri, 20 Apr 2018 12:50:10 +0000 (12:50 +0000)]
[Driver] Support for -save-stats in AddGoldPlugin.

This patch updates AddGoldPlugin to pass stats-file to the Gold plugin,
if -save-stats is passed. It also moves the save-stats option handling
to a helper function tools::getStatsFileName.

Reviewers: tejohnson, mehdi_amini, compnerd

Reviewed By: tejohnson, compnerd

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

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

6 years ago[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16...
Ivan A. Kosarev [Fri, 20 Apr 2018 12:09:25 +0000 (12:09 +0000)]
[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16() intrinsics

Related differential revision: https://reviews.llvm.org/D45668

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

6 years agoFix -Wunused-variable warnings after r330377.
Andrea Di Biagio [Fri, 20 Apr 2018 09:47:03 +0000 (09:47 +0000)]
Fix -Wunused-variable warnings after r330377.

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

6 years ago[OpenCL] Add 'denorms-are-zero' function attribute
Alexey Sotkin [Fri, 20 Apr 2018 08:08:04 +0000 (08:08 +0000)]
[OpenCL] Add 'denorms-are-zero' function attribute

Summary:
Generate attribute 'denorms-are-zero'='true' if '-cl-denorms-are-zero'
compile option was specified and 'denorms-are-zero'='false' otherwise.

Patch by krisb

Reviewers: Anastasia, yaxunl

Reviewed By:  yaxunl

Subscribers: cfe-commits

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

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

6 years ago[CFG] [analyzer] Add construction contexts for loop condition variables.
Artem Dergachev [Thu, 19 Apr 2018 23:30:15 +0000 (23:30 +0000)]
[CFG] [analyzer] Add construction contexts for loop condition variables.

Loop condition variables, eg.

  while (shared_ptr<int> P = getIntPtr()) { ... })

weren't handled in r324794 because they don't go through the common
CFGBuilder::VisitDeclStmt method. Which means that they regressed
after r324800.

Fix the regression by duplicating the necessary construction context scan in
the loop visiting code.

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

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

6 years ago[analyzer] When we fail to evaluate a pointer cast, escape the pointer.
Artem Dergachev [Thu, 19 Apr 2018 23:24:32 +0000 (23:24 +0000)]
[analyzer] When we fail to evaluate a pointer cast, escape the pointer.

If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the
analyzer) and such cast is in fact the last use of the pointer, the pointer
symbol is no longer referenced by the program state and a leak is
(mis-)diagnosed.

"Escape" the pointer upon a failed cast, i.e. inform the checker that we can no
longer reliably track it.

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

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

6 years agoImplement proper support for `-falign-functions`
Saleem Abdulrasool [Thu, 19 Apr 2018 23:14:57 +0000 (23:14 +0000)]
Implement proper support for `-falign-functions`

This implements support for the previously ignored flag
`-falign-functions`.  This allows the frontend to request alignment on
function definitions in the translation unit where they are not
explicitly requested in code.  This is compatible with the GCC behaviour
and the ICC behaviour.

The scalar value passed to `-falign-functions` aligns functions to a
power-of-two boundary.  If flag is used, the functions are aligned to
16-byte boundaries.  If the scalar is specified, it must be an integer
less than or equal to 4096.  If the value is not a power-of-two, the
driver will round it up to the nearest power of two.

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

6 years ago[CFG] [analyzer] Don't treat argument constructors as temporary constructors.
Artem Dergachev [Thu, 19 Apr 2018 23:09:22 +0000 (23:09 +0000)]
[CFG] [analyzer] Don't treat argument constructors as temporary constructors.

Function argument constructors (that are used for passing objects into functions
by value) are completely unlike temporary object constructors, but we were
treating them as such because they are also wrapped into a CXXBindTemporaryExpr.

This patch adds a partial construction context layer for call argument values,
but doesn't proceed to transform it into an actual construction context yet.
This is tells the clients that we aren't supporting these constructors yet.

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

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

6 years ago[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.
Artem Dergachev [Thu, 19 Apr 2018 23:00:22 +0000 (23:00 +0000)]
[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.

r315736 added support for the misplaced CF_RETURNS_RETAINED annotation on
CFRetain() wrappers. It works by trusting the function's name (seeing if it
confirms to the CoreFoundation naming convention) rather than the annotation.

There are more false positives caused by users using a different naming
convention, namely starting the function name with "retain" or "release"
rather than suffixing it with "retain" or "release" respectively.

Because this isn't according to the naming convention, these functions
are usually inlined and the annotation is therefore ignored, which is correct.
But sometimes we run out of inlining stack depth and the function is
evaluated conservatively and then the annotation is trusted.

Add support for the "alternative" naming convention and test the situation when
we're running out of inlining stack depth.

rdar://problem/18270122

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

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

6 years ago[UnitTests] NFC/build-perf: Break up nontrivial compile jobs
David Zarzycki [Thu, 19 Apr 2018 18:19:02 +0000 (18:19 +0000)]
[UnitTests] NFC/build-perf: Break up nontrivial compile jobs

RecursiveASTVisitorTest.cpp is one of the longest compile jobs and a
build bottleneck on many-core machines. This patch breaks that file and
some peer files up into smaller files to increase build concurrency and
overall rebuild performance.

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

6 years ago[CXX] Templates specialization visibility can be wrong
Steven Wu [Thu, 19 Apr 2018 15:46:43 +0000 (15:46 +0000)]
[CXX] Templates specialization visibility can be wrong

Summary:
Under some conditions, LinkageComputer can get the visibility for
ClassTemplateSpecializationDecl wrong because it failed to find the Decl
that has the explicit visibility.

This fixes:
llvm.org/bugs/pr36810
rdar://problem/38080953

Reviewers: rsmith, arphaman, doug.gregor

Reviewed By: doug.gregor

Subscribers: doug.gregor, cfe-commits

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

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

6 years ago[NEON] Define vfma_n_f32() and vfmaq_n_f32() intrinsics in AArch32 mode
Ivan A. Kosarev [Thu, 19 Apr 2018 15:27:28 +0000 (15:27 +0000)]
[NEON] Define vfma_n_f32() and vfmaq_n_f32() intrinsics in AArch32 mode

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

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

6 years agoFix __attribute__((force_align_arg_pointer)) misalignment bug
Erich Keane [Thu, 19 Apr 2018 14:27:05 +0000 (14:27 +0000)]
Fix __attribute__((force_align_arg_pointer)) misalignment bug

The force_align_arg_pointer attribute was using a hardcoded 16-byte
alignment value which in combination with -mstack-alignment=32 (or
larger) would produce a misaligned stack which could result in crashes
when accessing stack buffers using aligned AVX load/store instructions.

Fix the issue by using the "stackrealign" function attribute instead
of using a hardcoded 16-byte alignment.

Patch By: Gramner

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

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

6 years ago[clang-format] Don't remove empty lines before namespace endings
Krasimir Georgiev [Thu, 19 Apr 2018 13:02:15 +0000 (13:02 +0000)]
[clang-format] Don't remove empty lines before namespace endings

Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years agoLowering x86 adds/addus/subs/subus intrinsics (clang)
Alexander Ivchenko [Thu, 19 Apr 2018 12:15:11 +0000 (12:15 +0000)]
Lowering x86 adds/addus/subs/subus intrinsics (clang)

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations.

Patch by tkrupa

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

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

6 years agoOpenBSD add C++ runtime in a driver's standpoint
Dean Michael Berris [Thu, 19 Apr 2018 06:55:30 +0000 (06:55 +0000)]
OpenBSD add C++ runtime in a driver's standpoint

Summary: - Since 6.2 release, on supporters platforms clang is shipped with both libcxx and libcxxabi.

Reviewers: dberris, alekseyshl, EricWF

Reviewed By: dberris

Subscribers: cfe-commits

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

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

6 years ago[CodeGen] Do not push a destructor cleanup for a struct that doesn't
Akira Hatanaka [Wed, 18 Apr 2018 23:33:15 +0000 (23:33 +0000)]
[CodeGen] Do not push a destructor cleanup for a struct that doesn't
have a non-trivial destructor.

This fixes a bug introduced in r328731 where CodeGen emits calls to
synthesized destructors for non-trivial C structs in C++ mode when the
struct passed to EmitCallArg doesn't have a non-trivial destructor.
Under Microsoft's ABI, ASTContext::isParamDestroyedInCallee currently
always returns true, so it's necessary to check whether the struct has a
non-trivial destructor before pushing a cleanup in EmitCallArg.

This fixes PR37146.

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

6 years ago[MS] Fix unprototyped thunk emission for incomplete return types
Reid Kleckner [Wed, 18 Apr 2018 23:21:32 +0000 (23:21 +0000)]
[MS] Fix unprototyped thunk emission for incomplete return types

Fixes PR37161

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

6 years ago[NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma instructions.
Artem Belevich [Wed, 18 Apr 2018 21:51:48 +0000 (21:51 +0000)]
[NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma instructions.

The new instructions were added added for sm_70+ GPUs in CUDA-9.1.

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

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

6 years ago[OPENMP] Fix -Wunused-lambda-capture. NFC
Fangrui Song [Wed, 18 Apr 2018 19:32:01 +0000 (19:32 +0000)]
[OPENMP] Fix -Wunused-lambda-capture. NFC

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

6 years ago[CUDA] added missing __ldg(const signed char *)
Artem Belevich [Wed, 18 Apr 2018 18:33:43 +0000 (18:33 +0000)]
[CUDA] added missing __ldg(const signed char *)

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

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

6 years ago[HIP] Add driver input type for HIP
Yaxun Liu [Wed, 18 Apr 2018 18:25:03 +0000 (18:25 +0000)]
[HIP] Add driver input type for HIP

Patch by Greg Rodgers.
Revised by Yaxun Liu.

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

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

6 years ago[MinGW] Try to fix asan testing after r330244
Martin Storsjo [Wed, 18 Apr 2018 17:34:29 +0000 (17:34 +0000)]
[MinGW] Try to fix asan testing after r330244

Twines shouldn't be stored as they can refer to temporaries.

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

6 years ago[NVPTX] Emit debug info in DWARF-2 by default for Cuda devices.
Alexey Bataev [Wed, 18 Apr 2018 16:31:09 +0000 (16:31 +0000)]
[NVPTX] Emit debug info in DWARF-2 by default for Cuda devices.

Summary:
NVPTX target supports debug info in DWARF-2 format. Patch adds emission
of debug info in DWARF-2 by default.

Reviewers: tra, jlebar

Subscribers: aprantl, JDevlieghere, cfe-commits

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

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

6 years ago[OPENMP] Code cleanup and code improvements.
Alexey Bataev [Wed, 18 Apr 2018 15:57:46 +0000 (15:57 +0000)]
[OPENMP] Code cleanup and code improvements.

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

6 years ago[Sema] Disable built-in increment operator for bool in overload resolution in C++17
Jan Korous [Wed, 18 Apr 2018 13:38:39 +0000 (13:38 +0000)]
[Sema] Disable built-in increment operator for bool in overload resolution in C++17

Following: https://llvm.org/svn/llvm-project/cfe/trunk@329804

For C++17 the wording of [over.built] p4 excluded bool:

For every pair (T , vq), where T is an arithmetic type other than bool, there exist
candidate operator functions of the form
  vq T & operator++(vq T &);
  T operator++(vq T &, int);

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

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

6 years agoRevert r330195 "[NEON] Define vget_high_f16() and vget_low_f16() intrinsics in AArch6...
Ivan A. Kosarev [Wed, 18 Apr 2018 12:02:49 +0000 (12:02 +0000)]
Revert r330195 "[NEON] Define vget_high_f16() and vget_low_f16() intrinsics in AArch64 mode only".

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

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

6 years ago[MinGW] Look for a cross sysroot relative to the clang binary
Martin Storsjo [Wed, 18 Apr 2018 08:47:26 +0000 (08:47 +0000)]
[MinGW] Look for a cross sysroot relative to the clang binary

If found, prefer this over looking for a similar gcc later in the
system path.

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

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

6 years ago[Modules] Turn on system header validation for implicit modules
Bruno Cardoso Lopes [Wed, 18 Apr 2018 06:07:49 +0000 (06:07 +0000)]
[Modules] Turn on system header validation for implicit modules

After r300027 implicit builds might fail when updating the SDK on
darwin. Make validation of system headers default when implicit modules
is on and allow modules to be rebuild when system headers change.

rdar://problem/19767523

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

6 years ago[AAch64] Add the __ARM_FEATURE_DOTPROD macro definition
Junmo Park [Tue, 17 Apr 2018 22:38:40 +0000 (22:38 +0000)]
[AAch64] Add the __ARM_FEATURE_DOTPROD macro definition

This matches what GCC does.
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/aarch64/aarch64-c.c

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

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

6 years agoAdd Microsoft mangling for _Float16
Erich Keane [Tue, 17 Apr 2018 22:00:54 +0000 (22:00 +0000)]
Add Microsoft mangling for _Float16

Enables _Float16 on Windows by creating a mangling
mechanism in MicrosoftMangle.  It accomplishes this by
mangling as a structure type of __clang::_Float16, similar
to how Complex works.

Patch By: mibintc
Differential Revision: https://reviews.llvm.org/D45738

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

6 years ago[XRay] Add clang builtin for xray typed events.
Keith Wyss [Tue, 17 Apr 2018 21:32:43 +0000 (21:32 +0000)]
[XRay] Add clang builtin for xray typed events.

Summary:
A clang builtin for xray typed events. Differs from
__xray_customevent(...) by the presence of a type tag that is vended by
compiler-rt in typical usage. This allows xray handlers to expand logged
events with their type description and plugins to process traced events
based on type.

This change depends on D45633 for the intrinsic definition.

Reviewers: dberris, pelikan, rnk, eizan

Subscribers: cfe-commits, llvm-commits

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

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

6 years ago[Driver] Use the per-API level Android library directories.
Dan Albert [Tue, 17 Apr 2018 20:42:07 +0000 (20:42 +0000)]
[Driver] Use the per-API level Android library directories.

Summary:
Android sysroots contain libraries for each OS version, as well as a
handful of unversioned libraries in the typical multiarch directory.

Reviewers: srhines, eugenis, george.burgess.iv

Reviewed By: eugenis

Subscribers: javed.absar, cfe-commits

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

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

6 years agoRequire shell for test
Teresa Johnson [Tue, 17 Apr 2018 20:36:51 +0000 (20:36 +0000)]
Require shell for test

Attempt to fix windows bot which doesn't like the "(cd .." invocation
added in r330194:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-windows/builds/8704/steps/stage%202%20check/logs/stdio

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

6 years agoRemove unused variable
Teresa Johnson [Tue, 17 Apr 2018 20:21:53 +0000 (20:21 +0000)]
Remove unused variable

Fixes unused variable error introduced in r330194.

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

6 years ago[Sema] Warn about memcpy'ing non-trivial C structs.
Akira Hatanaka [Tue, 17 Apr 2018 19:13:41 +0000 (19:13 +0000)]
[Sema] Warn about memcpy'ing non-trivial C structs.

Issue a warning when non-trivial C structs are copied or initialized by
calls to memset, bzero, memcpy, or memmove.

rdar://problem/36124208

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

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

6 years agoMove the visitor classes that are used to traverse non-trivial C structs
Akira Hatanaka [Tue, 17 Apr 2018 19:05:17 +0000 (19:05 +0000)]
Move the visitor classes that are used to traverse non-trivial C structs
to a header file.

This is in preparation for using the visitor classes to warn about
memcpy'ing non-trivial C structs.

See the discussion here:
https://reviews.llvm.org/D45310

rdar://problem/36124208

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

6 years agoAdd a command line option 'fregister_global_dtors_with_atexit' to
Akira Hatanaka [Tue, 17 Apr 2018 18:41:52 +0000 (18:41 +0000)]
Add a command line option 'fregister_global_dtors_with_atexit' to
register destructor functions annotated with __attribute__((destructor))
using __cxa_atexit or atexit.

Register destructor functions annotated with __attribute__((destructor))
calling __cxa_atexit in a synthesized constructor function instead of
emitting references to the functions in a special section.

The primary reason for adding this option is that we are planning to
deprecate the __mod_term_funcs section on Darwin in the future. This
feature is enabled by default only on Darwin. Users who do not want this
can use command line option 'fno_register_global_dtors_with_atexit' to
disable it.

rdar://problem/33887655

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

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

6 years ago[NEON] Define vget_high_f16() and vget_low_f16() intrinsics in AArch64 mode only
Ivan A. Kosarev [Tue, 17 Apr 2018 16:43:07 +0000 (16:43 +0000)]
[NEON] Define vget_high_f16() and vget_low_f16() intrinsics in AArch64 mode only

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

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

6 years ago[ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds
Teresa Johnson [Tue, 17 Apr 2018 16:39:25 +0000 (16:39 +0000)]
[ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds

Summary:
The clang driver option -save-temps was not passed to the LTO config,
so when invoking the ThinLTO backends via clang during distributed
builds there was no way to get LTO to save temp files.

Getting this to work with ThinLTO distributed builds also required
changing the driver to avoid a separate compile step to emit unoptimized
bitcode when the input was already bitcode under -save-temps. Not only is
this unnecessary in general, it is problematic for ThinLTO backends since
the temporary bitcode file to the backend would not match the module path
in the combined index, leading to incorrect ThinLTO backend index-based
optimizations.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

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

6 years agoAdd modifiers for unsigned char and signed char field printing for __builtin_dump_struct.
Aaron Ballman [Tue, 17 Apr 2018 14:00:06 +0000 (14:00 +0000)]
Add modifiers for unsigned char and signed char field printing for __builtin_dump_struct.

Patch by Paul Semel.

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

6 years ago[NEON] Fix the architecture condition for the crypto intrinsics
Ivan A. Kosarev [Tue, 17 Apr 2018 13:37:30 +0000 (13:37 +0000)]
[NEON] Fix the architecture condition for the crypto intrinsics

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

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

6 years agoAdd checks for format specifiers used by __builtin_dump_struct and added a new specif...
Aaron Ballman [Tue, 17 Apr 2018 11:57:47 +0000 (11:57 +0000)]
Add checks for format specifiers used by __builtin_dump_struct and added a new specifier for null-terminated constant strings.

Patch by Paul Semel.

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

6 years agoAdd some infuriatingly necessary comments to this test case.
Chandler Carruth [Tue, 17 Apr 2018 11:08:05 +0000 (11:08 +0000)]
Add some infuriatingly necessary comments to this test case.

Without these comments, by "luck" the contents of SomeKit's SKWidget.h
are precisely the same as SomeKitCore's SomeKitCore.h. This can create
havoc if anything canonicalizes on the inode and your filesystem assigns
a common inode to files with identical file content. Alternatively, if
your build system uses symlinks into a content-addressed-storage (as
Google's does), you end up with these files being symlinks to the same
file.

The end result is that Clang deduplicates them internally, and then
believes that the SomeKit framework includes the SomeKitCore.h header,
and does not include the SKWidget.h in SomeKit. This in turn results in
warnings in this test and eventually errors as Clang becomes confused
because the umbrella header for SomeKitCore has already been included
into another framework's module (SomeKit). Yay.

If anyone has a better idea about how to avoid this, I'm all ears.
Nothing other than causing the file content to change worked for me.

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

6 years agoFix malformed table introduced by r330174
Duncan P. N. Exon Smith [Tue, 17 Apr 2018 05:48:36 +0000 (05:48 +0000)]
Fix malformed table introduced by r330174

http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/23573

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

6 years agoRemove GC-related warning terminology
Duncan P. N. Exon Smith [Tue, 17 Apr 2018 04:25:18 +0000 (04:25 +0000)]
Remove GC-related warning terminology

ObjC-GC isn't used any more; clean up this warning text.

rdar://problem/39049693

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

6 years ago[ARM] Compute a target feature which corresponds to the ARM version.
Eli Friedman [Mon, 16 Apr 2018 23:52:58 +0000 (23:52 +0000)]
[ARM] Compute a target feature which corresponds to the ARM version.

Currently, the interaction between the triple, the CPU, and the
supported features is a mess: the driver edits the triple to indicate
the supported architecture version, and the LLVM backend uses this to
figure out what instructions are legal.  This makes it difficult to
understand what's happening, and makes it impossible to LTO together two
modules with different computed architectures.

Instead of relying on triple rewriting to get the correct target
features, we should add the right target features explicitly.

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

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

6 years ago[Availability] Improve availability to consider functions run at load time
Steven Wu [Mon, 16 Apr 2018 23:34:18 +0000 (23:34 +0000)]
[Availability] Improve availability to consider functions run at load time

Summary:
There are some functions/methods that run when the application launches
or the library loads. Those functions will run reguardless the OS
version as long as it satifies the minimum deployment target. Annotate
them with availability attributes doesn't really make sense because they
are essentially available on all targets since minimum deployment
target.

rdar://problem/36093384

Reviewers: arphaman, erik.pilkington

Reviewed By: erik.pilkington

Subscribers: erik.pilkington, cfe-commits

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

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

6 years agoLimit types of builtins that can be redeclared.
Erich Keane [Mon, 16 Apr 2018 21:30:08 +0000 (21:30 +0000)]
Limit types of builtins that can be redeclared.

As reported here: https://bugs.llvm.org/show_bug.cgi?id=37033
Any usage of a builtin function that uses a va_list by reference
will cause an assertion when redeclaring it.

After discussion in the review, it was concluded that the correct
way of accomplishing this fix is to make attempts to redeclare certain
builtins an error. Unfortunately, doing this limitation for all builtins
is likely a breaking change, so this commit simply limits it to
types with custom type checking and those that take a reference.

Two tests needed to be updated to make this work.

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

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

6 years agoDefer adding keywords to the identifier table until after the language options have...
Aaron Ballman [Mon, 16 Apr 2018 21:07:08 +0000 (21:07 +0000)]
Defer adding keywords to the identifier table until after the language options have been loaded from the AST file.

This fixes issues with "class" being reported as an identifier in "enum class" because the construct is not present when using default language options.

Patch by Johann Klähn.

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

6 years ago[OPENMP] Allow to use declare target variables in map clauses
Alexey Bataev [Mon, 16 Apr 2018 20:34:41 +0000 (20:34 +0000)]
[OPENMP] Allow to use declare target variables in map clauses

Global variables marked as declare target are allowed to be used in map
clauses. Patch fixes the crash of the compiler on the declare target
variables in map clauses.

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

6 years ago[CodeGen] Fix a crash that occurs when a non-trivial C struct with a
Akira Hatanaka [Mon, 16 Apr 2018 20:23:52 +0000 (20:23 +0000)]
[CodeGen] Fix a crash that occurs when a non-trivial C struct with a
volatile array field is copied.

The crash occurs because method 'visitArray' passes a null FieldDecl to
method 'visit' and some of the methods called downstream expect a
non-null FieldDecl to be passed.

This reapplies r330151 with a fix to the test case.

rdar://problem/33599681

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

6 years ago[OPENMP] General code improvements.
Alexey Bataev [Mon, 16 Apr 2018 20:16:21 +0000 (20:16 +0000)]
[OPENMP] General code improvements.

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

6 years agoRevert "[CodeGen] Fix a crash that occurs when a non-trivial C struct with a"
Akira Hatanaka [Mon, 16 Apr 2018 19:53:59 +0000 (19:53 +0000)]
Revert "[CodeGen] Fix a crash that occurs when a non-trivial C struct with a"

This reverts commit r330151, which caused bots to fail.

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