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

6 years ago[XRay][clang] Add flag to choose instrumentation bundles
Dean Michael Berris [Fri, 13 Apr 2018 02:31:58 +0000 (02:31 +0000)]
[XRay][clang] Add flag to choose instrumentation bundles

Summary:
This change addresses http://llvm.org/PR36926 by allowing users to pick
which instrumentation bundles to use, when instrumenting with XRay. In
particular, the flag `-fxray-instrumentation-bundle=` has four valid
values:

- `all`: the default, emits all instrumentation kinds
- `none`: equivalent to -fnoxray-instrument
- `function`: emits the entry/exit instrumentation
- `custom`: emits the custom event instrumentation

These can be combined either as comma-separated values, or as
repeated flag values.

Reviewers: echristo, kpw, eizan, pelikan

Reviewed By: pelikan

Subscribers: mgorny, cfe-commits

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

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

6 years ago[CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia
Petr Hosek [Fri, 13 Apr 2018 02:02:13 +0000 (02:02 +0000)]
[CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia

This is now set automatically in libc++ config header.

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

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

6 years agoFix test failure caused by r329965.
Eli Friedman [Thu, 12 Apr 2018 22:50:50 +0000 (22:50 +0000)]
Fix test failure caused by r329965.

"-mllvm" options get parsed slightly earlier, and -arm-restrict-it is
only available if the ARM target is compiled in. Invoke "clang -cc1"
directly to avoid the issue.

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

6 years agoRemove -cc1 option "-backend-option".
Eli Friedman [Thu, 12 Apr 2018 22:21:36 +0000 (22:21 +0000)]
Remove -cc1 option "-backend-option".

It means the same thing as -mllvm; there isn't any reason to have two
options which do the same thing.

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

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

6 years ago[NFC] Fix terrible formatting of CGRecordLower constructor.
Erich Keane [Thu, 12 Apr 2018 20:46:31 +0000 (20:46 +0000)]
[NFC] Fix terrible formatting of CGRecordLower constructor.

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

6 years ago[MinGW] Look for libc++ headers in a triplet prefixed path as well
Martin Storsjo [Thu, 12 Apr 2018 20:07:38 +0000 (20:07 +0000)]
[MinGW] Look for libc++ headers in a triplet prefixed path as well

This makes it consistent with libstdc++ and the other default
include directories.

If these headers are found in both locations and one isn't a
symlink to the other, this will cause errors due to libc++ headers
having wrapper headers for some standard C headers, wrappers that
do #include_next the actual one.

If the same libc++ standard C wrapper header exists in more than one
include directory before the real system one, the header include
guard will stop it from doing another #include_next to pick up the
real one, breaking things.

As this is a rather uncommon situation, this should be acceptable
and toolchain maintainers can adapt accordingly if necessary.

Also simplify some of the existing code with a local variable.

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

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

6 years agoFix doc typo
Vlad Tsyrklevich [Thu, 12 Apr 2018 19:35:39 +0000 (19:35 +0000)]
Fix doc typo

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

6 years ago[RISCV] Fix logic to check if frame pointer should be used
Mandeep Singh Grang [Thu, 12 Apr 2018 19:31:37 +0000 (19:31 +0000)]
[RISCV] Fix logic to check if frame pointer should be used

Summary: The logic was broken for Linux triples as it returns true in the switch for Triple.isOSLinux().

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: kito-cheng, shiva0217, cfe-commits

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

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

6 years ago[X86] Introduce wbinvd intrinsic
Gabor Buella [Thu, 12 Apr 2018 18:42:02 +0000 (18:42 +0000)]
[X86] Introduce wbinvd intrinsic

A previously missing intrinsic for an old instruction.

Reviewers: craig.topper, echristo

Reviewed By: craig.topper

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

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

6 years agoNFC - Indentation fixes in predefined-arch-macros.c
Gabor Buella [Thu, 12 Apr 2018 18:15:39 +0000 (18:15 +0000)]
NFC - Indentation fixes in predefined-arch-macros.c

Consistently separating tests with empty lines.
Helps while navigating this file.

Reviewers: craig.topper

Reviewed By: craig.topper

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

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

6 years agoFix the try_acquire_capability attribute to behave like the other try-lock functions...
Aaron Ballman [Thu, 12 Apr 2018 17:53:21 +0000 (17:53 +0000)]
Fix the try_acquire_capability attribute to behave like the other try-lock functions. Fixes PR32954.

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

6 years agoCorrectly diagnose when a conversion function is declared with a type qualifier in...
Aaron Ballman [Thu, 12 Apr 2018 16:41:55 +0000 (16:41 +0000)]
Correctly diagnose when a conversion function is declared with a type qualifier in the declaration specifiers rather than in the conversion type id. Fixes PR30595.

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

6 years ago[Hexagon] Enable auto-vectorization only when -fvectorize was given
Krzysztof Parzyszek [Thu, 12 Apr 2018 16:25:35 +0000 (16:25 +0000)]
[Hexagon] Enable auto-vectorization only when -fvectorize was given

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

6 years ago[Test Fix] Fix broken test Index/comment-objc-parameterized-classes.m
Ben Hamilton [Thu, 12 Apr 2018 16:00:05 +0000 (16:00 +0000)]
[Test Fix] Fix broken test Index/comment-objc-parameterized-classes.m

I broke this test in D45498 when I changed the formatter to remove
spaces before Objective-C lightweight generics.

This fixes the test.

Test Plan:
  % make -j16 check-llvm-tools-llvm-lit && ./bin/llvm-lit -sv ../llvm/tools/clang/test/Index/comment-objc-parameterized-classes.m

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

6 years ago[clang-format] Do not break after ObjC category open paren
Ben Hamilton [Thu, 12 Apr 2018 15:11:55 +0000 (15:11 +0000)]
[clang-format] Do not break after ObjC category open paren

Summary:
Previously, `clang-format` would break Objective-C
category extensions after the opening parenthesis to avoid
breaking the protocol list:

```
% echo "@interface ccccccccccccc (ccccccccccc) <ccccccccccccc> { }" | \
  clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \
  ColumnLimit: 40}"
@interface ccccccccccccc (
    ccccccccccc) <ccccccccccccc> {
}
```

This looks fairly odd, as we could have kept the category extension
on the previous line.

Category extensions are a single item, so they are generally very
short compared to protocol lists. We should prefer breaking after the
opening `<` of the protocol list over breaking after the opening `(`
of the category extension.

With this diff, we now avoid breaking after the category extension's
open paren, which causes us to break after the protocol list's
open angle bracket:

```
% echo "@interface ccccccccccccc (ccccccccccc) <ccccccccccccc> { }" | \
  ./bin/clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \
  ColumnLimit: 40}"
@interface ccccccccccccc (ccccccccccc) <
    ccccccccccccc> {
}
```

Test Plan: New test added. Confirmed test failed before diff and
  passed after diff by running:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[clang-format] Improve ObjC guessing heuristic by supporting all @keywords
Ben Hamilton [Thu, 12 Apr 2018 15:11:53 +0000 (15:11 +0000)]
[clang-format] Improve ObjC guessing heuristic by supporting all @keywords

Summary:
This diff improves the Objective-C guessing heuristic by
replacing the hard-coded list of a subset of Objective-C @keywords
with a general check which supports all @keywords.

I also added a few more Foundation keywords which were missing from
the heuristic.

Test Plan: Unit tests updated. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[clang-format] Don't insert space between ObjC class and lightweight generic
Ben Hamilton [Thu, 12 Apr 2018 15:11:51 +0000 (15:11 +0000)]
[clang-format] Don't insert space between ObjC class and lightweight generic

Summary:
In D45185, I added clang-format parser support for Objective-C
generics. However, I didn't touch the whitespace logic, so they
got the same space logic as Objective-C protocol lists.

In every example in the Apple SDK and in the documentation,
there is no space between the class name and the opening `<`
for the lightweight generic specification, so this diff
removes the space and updates the tests.

Test Plan: Tests updated. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[clang-format] Always indent wrapped Objective-C selector names
Ben Hamilton [Thu, 12 Apr 2018 15:11:48 +0000 (15:11 +0000)]
[clang-format] Always indent wrapped Objective-C selector names

Summary:
Currently, indentation of Objective-C method names which are wrapped
onto the next line due to a long return type is controlled by the
style option `IndentWrappedFunctionNames`.

This diff changes the behavior so we always indent wrapped Objective-C
selector names.

NOTE: I partially reverted https://github.com/llvm-mirror/clang/commit/6159c0fbd1876c7f5f984b4830c664cc78f16e2e / rL242484, as it was causing wrapped selectors to be double-indented. Its tests in FormatTestObjC.cpp still pass.

Test Plan: Tests updated. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak, stephanemoore, thakis

Reviewed By: djasper

Subscribers: stephanemoore, klimek, cfe-commits

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

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

6 years agoDiagnose cases of "return x" that should be "return std::move(x)" for efficiency
Malcolm Parsons [Thu, 12 Apr 2018 14:48:48 +0000 (14:48 +0000)]
Diagnose cases of "return x" that should be "return std::move(x)" for efficiency

Summary:
This patch adds two new diagnostics, which are off by default:

**-Wreturn-std-move**

This diagnostic is enabled by `-Wreturn-std-move`, `-Wmove`, or `-Wall`.
Diagnose cases of `return x` or `throw x`, where `x` is the name of a local variable or parameter, in which a copy operation is performed when a move operation would have been available. The user probably expected a move, but they're not getting a move, perhaps because the type of "x" is different from the return type of the function.
A place where this comes up in the wild is `stdext::inplace_function<Sig, N>` which implements conversion via a conversion operator rather than a converting constructor; see https://github.com/WG21-SG14/SG14/issues/125#issue-297201412
Another place where this has come up in the wild, but where the fix ended up being different, was

    try { ... } catch (ExceptionType ex) {
        throw ex;
    }

where the appropriate fix in that case was to replace `throw ex;` with `throw;`, and incidentally to catch by reference instead of by value. (But one could contrive a scenario where the slicing was intentional, in which case throw-by-move would have been the appropriate fix after all.)
Another example (intentional slicing to a base class) is dissected in https://github.com/accuBayArea/Slides/blob/master/slides/2018-03-07.pdf

**-Wreturn-std-move-in-c++11**

This diagnostic is enabled only by the exact spelling `-Wreturn-std-move-in-c++11`.
Diagnose cases of "return x;" or "throw x;" which in this version of Clang *do* produce moves, but which prior to Clang 3.9 / GCC 5.1 produced copies instead. This is useful in codebases which care about portability to those older compilers.
The name "-in-c++11" is not technically correct; what caused the version-to-version change in behavior here was actually CWG 1579, not C++14. I think it's likely that codebases that need portability to GCC 4.9-and-earlier may understand "C++11" as a colloquialism for "older compilers." The wording of this diagnostic is based on feedback from @rsmith.

**Discussion**

Notice that this patch is kind of a negative-space version of Richard Trieu's `-Wpessimizing-move`. That diagnostic warns about cases of `return std::move(x)` that should be `return x` for speed. These diagnostics warn about cases of `return x` that should be `return std::move(x)` for speed. (The two diagnostics' bailiwicks do not overlap: we don't have to worry about a `return` statement flipping between the two states indefinitely.)

I propose to write a paper for San Diego that would relax the implicit-move rules so that in C++2a the user //would// see the moves they expect, and the diagnostic could be re-worded in a later version of Clang to suggest explicit `std::move` only "in C++17 and earlier." But in the meantime (and/or forever if that proposal is not well received), this diagnostic will be useful to detect accidental copy operations.

Reviewers: rtrieu, rsmith

Reviewed By: rsmith

Subscribers: lebedev.ri, Rakete1111, rsmith, cfe-commits

Tags: #clang

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

Patch by Arthur O'Dwyer.

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

6 years ago[OpenCL] Added -std/-cl-std=c++
Anastasia Stulova [Thu, 12 Apr 2018 14:17:04 +0000 (14:17 +0000)]
[OpenCL] Added -std/-cl-std=c++

This is std option for OpenCL C++ v1.0.

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

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

6 years agoAllow [[maybe_unused]] on static data members; these are considered variables and...
Aaron Ballman [Thu, 12 Apr 2018 12:21:41 +0000 (12:21 +0000)]
Allow [[maybe_unused]] on static data members; these are considered variables and the attribute should appertain to them.

Patch by S. B. Tam.

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

6 years agoObjCGNU: Fix empty v3 protocols being emitted two fields short
David Chisnall [Thu, 12 Apr 2018 06:46:15 +0000 (06:46 +0000)]
ObjCGNU: Fix empty v3 protocols being emitted two fields short

Summary:
Protocols that were being referenced but could not be fully realized were being emitted without `properties`/`optional_properties`. Since all v3 protocols must be 9 processor words wide, the lack of these fields is catastrophic for the runtime.

As an example, the runtime cannot know [here](https://github.com/gnustep/libobjc2/blob/master/protocol.c#L73) that `properties` and `optional_properties` are invalid.

Reviewers: rjmccall, theraven

Reviewed By: rjmccall, theraven

Subscribers: cfe-commits

Tags: #clang

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

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

6 years ago[Sema][ObjC] Ensure that the return type of an ObjC method is a complete
Akira Hatanaka [Thu, 12 Apr 2018 06:01:41 +0000 (06:01 +0000)]
[Sema][ObjC] Ensure that the return type of an ObjC method is a complete
type.

Copy the code in ActOnStartOfFunctionDef that checks a function's return
type to ActOnStartOfObjCMethodDef. This fixes an assertion failure in
IRGen caused by an uninstantiated return type.

rdar://problem/38691818

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

6 years ago[ODRHash] Skip more types hashing TypedefType
Richard Trieu [Thu, 12 Apr 2018 02:26:49 +0000 (02:26 +0000)]
[ODRHash] Skip more types hashing TypedefType

To get the underlying type for TypedefType's, also skip ElaboratedType's.

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

6 years agoLex: make `clang::Preprocessor::macros` work on MSVC
Saleem Abdulrasool [Wed, 11 Apr 2018 23:47:25 +0000 (23:47 +0000)]
Lex: make `clang::Preprocessor::macros` work on MSVC

The order of argument construction is reversed on MS ABI on Windows.
When `macros` was invoked, the `end` call is made prior to `begin`.  In
such a case, the DenseMap (`ModuleMap`) is populated after the `end`
iterator is constructed.  This reversal results in the invalidation of
the end iterator, resulting in a failure at runtime (assertion failure
in `DenseMap<T>::operator!=` that "handles are not in sync!").  Ensure
that the end iterator is constructed after the begin iterator.  This
fixes the use of `macros(bool)`, which symptomized as an assertion
failure in the swift compiler in the clang importer.

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

6 years agoDriver: Add gcc search path for RHEL devtoolset-7
Tom Stellard [Wed, 11 Apr 2018 22:29:35 +0000 (22:29 +0000)]
Driver:  Add gcc search path for RHEL devtoolset-7

Reviewers: bruno

Reviewed By: bruno

Subscribers: bruno, cfe-commits

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

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