]> granicus.if.org Git - clang/log
clang
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

6 years agoUse export_as for autolinking frameworks
Bruno Cardoso Lopes [Mon, 16 Apr 2018 19:42:32 +0000 (19:42 +0000)]
Use export_as for autolinking frameworks

framework module SomeKitCore {
  ...
  export_as SomeKit
}

Given the module above, while generting autolink information during
codegen, clang should to emit '-framework SomeKitCore' only if SomeKit
was not imported in the relevant TU, otherwise it should use '-framework
SomeKit' instead.

rdar://problem/38269782

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330152 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 19:38:00 +0000 (19:38 +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.

rdar://problem/33599681

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

6 years ago[Hexagon] Emit a warning when -fvectorize is given without -mhvx
Krzysztof Parzyszek [Mon, 16 Apr 2018 19:11:17 +0000 (19:11 +0000)]
[Hexagon] Emit a warning when -fvectorize is given without -mhvx

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

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

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

6 years ago[CodeView] Initial support for emitting S_THUNK32 symbols for compiler...
Brock Wyma [Mon, 16 Apr 2018 16:53:57 +0000 (16:53 +0000)]
[CodeView] Initial support for emitting S_THUNK32 symbols for compiler...

When emitting CodeView debug information, compiler-generated thunk routines
should be emitted using S_THUNK32 symbols instead of S_GPROC32_ID symbols so
Visual Studio can properly step into the user code.  This initial support only
handles standard thunk ordinals.

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

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

6 years ago[mips] Prevent PIC to be set to level 2
Aleksandar Beserminji [Mon, 16 Apr 2018 10:21:24 +0000 (10:21 +0000)]
[mips] Prevent PIC to be set to level 2

MIPS does not use PIC level 2 for historical reasons,
even with -fPIC/-mxgot/multigot options. This patch
prevents PIC to be set to level 2 for MIPS.

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

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

6 years agoClean carriage returns from lib/ and include/. NFC.
Malcolm Parsons [Mon, 16 Apr 2018 08:31:08 +0000 (08:31 +0000)]
Clean carriage returns from lib/ and include/. NFC.

Summary:
Clean carriage returns from lib/ and include/. NFC.
(I have to make this change locally in order for `git diff` to show sane output after I edit a file, so I might as well ask for it to be committed. I don't have commit privs myself.)
(Without this patch, `git rebase`ing any change involving SemaDeclCXX.cpp is a real nightmare. :( So while I have no right to ask for this to be committed, geez would it make my workflow easier if it were.)

Here's the command I used to reformat things. (Requires bash and OSX/FreeBSD sed.)

    git grep -l $'\r' lib include | xargs sed -i -e $'s/\r//'
    find lib include -name '*-e' -delete

Reviewers: malcolm.parsons

Reviewed By: malcolm.parsons

Subscribers: emaste, krytarowski, cfe-commits

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

Patch by Arthur O'Dwyer.

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

6 years ago[X86] Introduce archs: goldmont-plus & tremont
Gabor Buella [Mon, 16 Apr 2018 08:10:10 +0000 (08:10 +0000)]
[X86] Introduce archs: goldmont-plus & tremont

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Do not invalidate the `this` pointer.
Henry Wong [Sun, 15 Apr 2018 10:34:06 +0000 (10:34 +0000)]
[analyzer] Do not invalidate the `this` pointer.

Summary:
`this` pointer is not an l-value, although we have modeled `CXXThisRegion` for `this` pointer, we can only bind it once, which is when we start to inline method. And this patch fixes https://bugs.llvm.org/show_bug.cgi?id=35506.

In addition, I didn't find any other cases other than loop-widen that could invalidate `this` pointer.

Reviewers: NoQ, george.karpenkov, a.sidorin, seaneveson, szepet

Reviewed By: NoQ

Subscribers: xazax.hun, rnkovacs, cfe-commits, MTC

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

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

6 years agoRevert "[Serialization] Fix some Clang-tidy modernize and Include What You Use warnin...
Vedant Kumar [Sat, 14 Apr 2018 01:40:48 +0000 (01:40 +0000)]
Revert "[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC)."

This reverts commit r330068. It breaks the lldb bots due to assertion
failures (more details on cfe-commits).

http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/6341/

stderr: Assertion failed: (M && "imported decl from no module file"), function loadPendingDeclChain, file /Users/vsk/src/llvm.org-lldbsan/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp, line 3861.

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

6 years ago[Driver] Export profiling symbols for -exported_symbols_list
Vedant Kumar [Fri, 13 Apr 2018 23:43:59 +0000 (23:43 +0000)]
[Driver] Export profiling symbols for -exported_symbols_list

When profiling is enabled and -exported_symbols_list is specified for
the Darwin linker, export the requisite set of profiling symbols.

rdar://39427167

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

6 years ago[ODRHash] Support pointer and reference types.
Richard Trieu [Fri, 13 Apr 2018 22:34:43 +0000 (22:34 +0000)]
[ODRHash] Support pointer and reference types.

Recommit r328404 which was reverted in rL328404.  r329869 fixed the issue that
caused the revert.

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

6 years ago[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings;...
Eugene Zelenko [Fri, 13 Apr 2018 21:12:33 +0000 (21:12 +0000)]
[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoUse InitLLVM in clang as well.
Rui Ueyama [Fri, 13 Apr 2018 20:57:57 +0000 (20:57 +0000)]
Use InitLLVM in clang as well.

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

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

6 years ago[Analyzer] Fix for SValBuilder expressions rearrangement
Adam Balogh [Fri, 13 Apr 2018 20:23:02 +0000 (20:23 +0000)]
[Analyzer] Fix for SValBuilder expressions rearrangement

Expression rearrangement in SValBuilder (see rL329780) crashes with an assert if the type of the integer is different from the type of the symbol. This fix adds a check that prevents rearrangement in such cases.

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

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

6 years agohwasan: add -fsanitize=kernel-hwaddress flag
Andrey Konovalov [Fri, 13 Apr 2018 18:05:21 +0000 (18:05 +0000)]
hwasan: add -fsanitize=kernel-hwaddress flag

This patch adds -fsanitize=kernel-hwaddress flag, that essentially enables
-hwasan-kernel=1 -hwasan-recover=1 -hwasan-match-all-tag=0xff.

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

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

6 years ago[OPENMP] Replace push_back by emplace_back, NFC.
Alexey Bataev [Fri, 13 Apr 2018 17:48:43 +0000 (17:48 +0000)]
[OPENMP] Replace push_back by emplace_back, NFC.

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

6 years agoFix evaluation of `__has_include_next` during -frewrite-includes.
Volodymyr Sapsai [Fri, 13 Apr 2018 17:43:15 +0000 (17:43 +0000)]
Fix evaluation of `__has_include_next` during -frewrite-includes.

`__has_include_next` requires correct DirectoryLookup for being
evaluated correctly. We were using Preprocessor::GetCurDirLookup() but
we were calling it after the preprocessor finished its work. And in this
case CurDirLookup is always nullptr which makes `__has_include_next`
behave as `__has_include`.

Fix by storing and using CurDirLookup when preprocessor enters a file,
not when we rewrite the includes.

rdar://problem/36305026

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: jkorous-apple, cfe-commits

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

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

6 years ago[OPENMP] Code cleanup + formatting, NFC.
Alexey Bataev [Fri, 13 Apr 2018 17:31:06 +0000 (17:31 +0000)]
[OPENMP] Code cleanup + formatting, NFC.

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

6 years ago[clang-format] Improve Incomplete detection for (text) protos
Krasimir Georgiev [Fri, 13 Apr 2018 13:37:09 +0000 (13:37 +0000)]
[clang-format] Improve Incomplete detection for (text) protos

Summary:
This patch improves detection of incomplete code for protos and text protos.
This is especially important for text protos in raw string literals, since they
might be partial strings concatenated, and we'd like to disable formatting in
these cases.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

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

6 years ago[NEON] Support vrndns_f32 intrinsic
Ivan A. Kosarev [Fri, 13 Apr 2018 12:46:02 +0000 (12:46 +0000)]
[NEON] Support vrndns_f32 intrinsic

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

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

6 years ago[analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinition
Gabor Horvath [Fri, 13 Apr 2018 12:36:08 +0000 (12:36 +0000)]
[analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinition

Patch by: Rafael Stahl!

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

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

6 years ago[X86] Fix cldemote builtin signature
Gabor Buella [Fri, 13 Apr 2018 08:14:21 +0000 (08:14 +0000)]
[X86] Fix cldemote builtin signature

Fix for r329993

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

6 years ago[X86] Introduce cldemote intrinsic
Gabor Buella [Fri, 13 Apr 2018 07:37:24 +0000 (07:37 +0000)]
[X86] Introduce cldemote intrinsic

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years ago[XRay][clang] Make -fxray-modes= additive
Dean Michael Berris [Fri, 13 Apr 2018 05:59:57 +0000 (05:59 +0000)]
[XRay][clang] Make -fxray-modes= additive

Summary:
This allows us to do the following:

  clang -fxray-modes=none ... -fxray-modes=xray-basic

It's important to be able to do this in cases where we'd like to
specialise the configuration for the invocation of the compiler, in
various scripting environments.

This is related to llvm.org/PR37066, a follow-up to D45474.

Reviewers: eizan, kpw, pelikan

Subscribers: cfe-commits

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

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