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

6 years ago[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings;...
Eugene Zelenko [Wed, 11 Apr 2018 20:57:28 +0000 (20:57 +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@329851 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] wbnoinvd intrinsic
Gabor Buella [Wed, 11 Apr 2018 20:09:09 +0000 (20:09 +0000)]
[x86] wbnoinvd intrinsic

The WBNOINVD instruction writes back all modified
cache lines in the processor’s internal cache to main memory
but does not invalidate (flush) the internal caches.

Reviewers: craig.topper, zvi, ashlykov

Reviewed By: craig.topper

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

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

6 years ago[OPENMP] Code cleanup, NFC.
Alexey Bataev [Wed, 11 Apr 2018 19:21:00 +0000 (19:21 +0000)]
[OPENMP] Code cleanup, NFC.

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

6 years ago[CodeGen] Handle __func__ inside __finally
Shoaib Meenai [Wed, 11 Apr 2018 18:17:35 +0000 (18:17 +0000)]
[CodeGen] Handle __func__ inside __finally

When we enter a __finally block, the CGF's CurCodeDecl will be null
(because CodeGenFunction::StartFunction is given an empty GlobalDecl for
a __finally block), and so the dyn_cast here will result in an assertion
failure. Change it to dyn_cast_or_null to handle this case.

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

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

6 years ago[NVPTX] Removed 'satom' feature which is no longer used.
Artem Belevich [Wed, 11 Apr 2018 17:51:33 +0000 (17:51 +0000)]
[NVPTX] Removed 'satom' feature which is no longer used.

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

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

6 years ago[NVPTX, CUDA] Improved feature constraints on NVPTX target builtins.
Artem Belevich [Wed, 11 Apr 2018 17:51:19 +0000 (17:51 +0000)]
[NVPTX, CUDA] Improved feature constraints on NVPTX target builtins.

When NVPTX TARGET_BUILTIN specifies sm_XX or ptxYY as required feature,
consider those features available if we're compiling for GPU >= sm_XX or have
enabled PTX version >= ptxYY.

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

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

6 years agoDocument -std= values for different languages
Dimitry Andric [Wed, 11 Apr 2018 17:21:52 +0000 (17:21 +0000)]
Document -std= values for different languages

Summary:
After a remark on a FreeBSD mailing list that the clang man page did
not have any list of possible values for the `-std=` flag, I have now
attempted to exhaustively list those, for each available language.

I also documented the default standard for each language, if there was
more than one choice.

Reviewers: rsmith, dexonsmith, sylvestre.ledru, mgorny

Reviewed By: rsmith

Subscribers: fhahn, emaste, cfe-commits, krytarowski

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

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

6 years agobpf: accept all asm register names
Yonghong Song [Wed, 11 Apr 2018 16:08:00 +0000 (16:08 +0000)]
bpf: accept all asm register names

Sometimes when people compile bpf programs with
"clang ... -target bpf ...", the kernel header
files may contain host arch inline assembly codes
as in the patch https://patchwork.kernel.org/patch/10119683/
by Arnaldo Carvaldo de Melo.

The current workaround in the above patch
is to guard the inline assembly with "#ifndef __BPF__"
marco. So when __BPF__ is defined, these macros will
have no use.

Such a method is not extensible. As a matter of fact,
most of these inline assembly codes will be thrown away
at the end of clang compilation.

So for bpf target, this patch accepts all asm register
names in clang AST stage. The name will be checked
again during llc code generation if the inline assembly
code is indeed for bpf programs.

With this patch, the above "#ifndef __BPF__" is not needed
any more in https://patchwork.kernel.org/patch/10119683/.

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329823 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix bugs around handling C++11 attributes.
Manuel Klimek [Wed, 11 Apr 2018 14:51:54 +0000 (14:51 +0000)]
Fix bugs around handling C++11 attributes.

Previously, we would format:
  int a() { ... }
  [[unused]] int b() { ... }
as...
  int a() {} [[unused] int b() {}
Now we correctly format each on its own line.

Similarly, we would detect:
  [[unused]] int b() { return 42; }
As a lambda and leave it on a single line, even if that was disallowed
by the format style.

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

6 years ago[NEON] Support vfma_n and vfms_n intrinsics
Ivan A. Kosarev [Wed, 11 Apr 2018 14:43:11 +0000 (14:43 +0000)]
[NEON] Support vfma_n and vfms_n intrinsics

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

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

6 years ago[Driver] Don't forward -m[no-]unaligned-access options to GCC when assembling/linking
Chad Rosier [Wed, 11 Apr 2018 14:20:37 +0000 (14:20 +0000)]
[Driver] Don't forward -m[no-]unaligned-access options to GCC when assembling/linking

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

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

6 years ago[Sema] Fix built-in decrement operator overload resolution
Jan Korous [Wed, 11 Apr 2018 13:36:29 +0000 (13:36 +0000)]
[Sema] Fix built-in decrement operator overload resolution

C++ [over.built] p4:

"For every pair (T, VQ), where T is an arithmetic type other than bool, and VQ is either volatile or empty, there exist candidate operator functions of the form

  VQ T&      operator--(VQ T&);
  T          operator--(VQ T&, int);
"
The bool type is in position LastPromotedIntegralType in BuiltinOperatorOverloadBuilder::getArithmeticType::ArithmeticTypes, but addPlusPlusMinusMinusArithmeticOverloads() was expecting it at position 0.

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

rdar://problem/34255516

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

6 years ago[PowerPC] Option for secure plt mode
Strahinja Petrovic [Wed, 11 Apr 2018 12:24:44 +0000 (12:24 +0000)]
[PowerPC] Option for secure plt mode

This patch enables option for secure plt mode in
clang (-msecure-plt).

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

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

6 years ago[Tooling] Correct the "-std" compile command option.
Haojian Wu [Wed, 11 Apr 2018 09:18:18 +0000 (09:18 +0000)]
[Tooling] Correct the "-std" compile command option.

Summary:
"-std c++11" is not valid in compiler, we have to use "-std=c++11".

Test in vscode with this patch, code completion for header works as expected.

Reviewers: sammccall

Subscribers: cfe-commits, klimek

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

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

6 years ago[Tooling] Optimize memory usage in InMemoryToolResults.
Haojian Wu [Wed, 11 Apr 2018 08:13:07 +0000 (08:13 +0000)]
[Tooling] Optimize memory usage in InMemoryToolResults.

Avoid storing duplicated "std::string"s.

clangd's global-symbol-builder takes 20+GB memory running across LLVM
repository. With this patch, the used memory is ~10GB (running on 48
threads, most of meory are AST-related).

Subscribers: klimek, cfe-commits

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

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

6 years ago[Analyzer] SValBuilder Comparison Rearrangement (with Restrictions and Analyzer Option)
Adam Balogh [Wed, 11 Apr 2018 06:21:12 +0000 (06:21 +0000)]
[Analyzer] SValBuilder Comparison Rearrangement (with Restrictions and Analyzer Option)

Since the range-based constraint manager (default) is weak in handling comparisons where symbols are on both sides it is wise to rearrange them to have symbols only on the left side. Thus e.g. A + n >= B + m becomes A - B >= m - n which enables the constraint manager to store a range m - n .. MAX_VALUE for the symbolic expression A - B. This can be used later to check whether e.g. A + k == B + l can be true, which is also rearranged to A - B == l - k so the constraint manager can check whether l - k is in the range (thus greater than or equal to m - n).

The restriction in this version is the the rearrangement happens only if both the symbols and the concrete integers are within the range [min/4 .. max/4] where min and max are the minimal and maximal values of their type.

The rearrangement is not enabled by default. It has to be enabled by using -analyzer-config aggressive-relational-comparison-simplification=true.

Co-author of this patch is Artem Dergachev (NoQ).

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

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

6 years agoAdding fuzzer flags support to OpenBSD driver
Dean Michael Berris [Wed, 11 Apr 2018 05:40:47 +0000 (05:40 +0000)]
Adding fuzzer flags support to OpenBSD driver

Summary: - Following-up the sanitizer's part commit https://reviews.llvm.org/rCRT329631, we enable fuzzer flags.

Reviewers: brad, thakis, dberris

Reviewed By: dberris

Subscribers: cfe-commits

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

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

6 years ago[X86] Fix typo in intrinsic header file __mask16->__mmask16 from r329775.
Craig Topper [Wed, 11 Apr 2018 05:17:14 +0000 (05:17 +0000)]
[X86] Fix typo in intrinsic header file __mask16->__mmask16 from r329775.

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

6 years ago[X86] Replace 512-bit masked pmaddubsw and pmaddwd intrinsic with unmasked intrinsic...
Craig Topper [Wed, 11 Apr 2018 04:55:10 +0000 (04:55 +0000)]
[X86] Replace 512-bit masked pmaddubsw and pmaddwd intrinsic with unmasked intrinsic and a select.

This makes it consistent with the 128/256-bit functions.

Someday maybe we'll have all the masking moved to selects.

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

6 years ago[XRay][clang] Only enable test for supported platforms
Dean Michael Berris [Wed, 11 Apr 2018 01:47:40 +0000 (01:47 +0000)]
[XRay][clang] Only enable test for supported platforms

This is a follow-up to D45474.

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

6 years ago[XRay][clang+compiler-rt] Support build-time mode selection
Dean Michael Berris [Wed, 11 Apr 2018 01:28:25 +0000 (01:28 +0000)]
[XRay][clang+compiler-rt] Support build-time mode selection

Summary:
This patch implements the `-fxray-modes=` flag which allows users
building with XRay instrumentation to decide which modes to pre-package
into the binary being linked. The default is the status quo, which will
link all the available modes.

For this to work we're also breaking apart the mode implementations
(xray-fdr and xray-basic) from the main xray runtime. This gives more
granular control of which modes are pre-packaged, and picked from
clang's invocation.

This fixes llvm.org/PR37066.

Note that in the future, we may change the default for clang to only
contain the profiling implementation under development in D44620, when
that implementation is ready.

Reviewers: echristo, eizan, chandlerc

Reviewed By: echristo

Subscribers: mgorny, mgrang, cfe-commits, llvm-commits

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

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

6 years ago[AST] Fix some Clang-tidy modernize-use-auto and Include What You Use warnings; other...
Eugene Zelenko [Tue, 10 Apr 2018 22:54:42 +0000 (22:54 +0000)]
[AST] Fix some Clang-tidy modernize-use-auto and Include What You Use warnings; other minor fixes (NFC).

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