]> granicus.if.org Git - clang/log
clang
7 years ago[docs] add Windows examples to ThinLTO.rst
Bob Haarman [Sat, 16 Sep 2017 00:16:13 +0000 (00:16 +0000)]
[docs] add Windows examples to ThinLTO.rst

Reviewers: pcc, ruiu

Reviewed By: ruiu

Subscribers: mehdi_amini, eraman, cfe-commits

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

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

7 years ago[X86] Use native shuffle vector for the perm2f128 intrinsics
Craig Topper [Fri, 15 Sep 2017 23:00:59 +0000 (23:00 +0000)]
[X86] Use native shuffle vector for the perm2f128 intrinsics

This patch replaces the perm2f128 intrinsics with native shuffle vectors.

This uses a pretty simple approach to allocate source 0 to the lower half input and source 1 to the upper half input. Then its just a matter of filling in the indices to use either the lower or upper half of that specific source. This can result in the same source being used by both operands. InstCombine or SelectionDAGBuilder should be able to clean that up.

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

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

7 years agoResubmit "[lit] Force site configs to run before source-tree configs"
Zachary Turner [Fri, 15 Sep 2017 22:10:46 +0000 (22:10 +0000)]
Resubmit "[lit] Force site configs to run before source-tree configs"

This is a resubmission of r313270.  It broke standalone builds of
compiler-rt because we were not correctly generating the llvm-lit
script in the standalone build directory.

The fixes incorporated here attempt to find llvm/utils/llvm-lit
from the source tree returned by llvm-config.  If present, it
will generate llvm-lit into the output directory.  Regardless,
the user can specify -DLLVM_EXTERNAL_LIT to point to a specific
lit.py on their file system.  This supports the use case of
someone installing lit via a package manager.  If it cannot find
a source tree, and -DLLVM_EXTERNAL_LIT is either unspecified or
invalid, then we print a warning that tests will not be able
to run.

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

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

7 years agoRemove __builtin_wasm_rethrow builtin
Heejin Ahn [Fri, 15 Sep 2017 22:01:22 +0000 (22:01 +0000)]
Remove __builtin_wasm_rethrow builtin

Summary:
Remove `__builtin_wasm_rethrow` builtin. I thought it was required to implement
`__cxa_rethrow` function in libcxxabi, but it turned out it will be using
`__builtin_wasm_throw` instead.

Reviewers: dschuff, jgravelle-google

Reviewed By: jgravelle-google

Subscribers: jfb, sbc100, jgravelle-google

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

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

7 years ago[X86] Disable _mm512_maskz_set1_epi64 intrinsic on 32-bit targets to prevent a backen...
Craig Topper [Fri, 15 Sep 2017 20:27:59 +0000 (20:27 +0000)]
[X86] Disable _mm512_maskz_set1_epi64 intrinsic on 32-bit targets to prevent a backend isel failure.

The __builtin_ia32_pbroadcastq512_mem_mask we were previously trying to use in 32-bit mode is not implemented in the x86 backend and causes isel to fail in release builds. In debug builds it fails even earlier during legalization with an llvm_unreachable.

While there add the missing test case for this intrinsic for this for 64-bit mode.

This fixes PR34631. D37668 should be able to recover this for 32-bit mode soon. But I wanted to fix the crash ahead of that.

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

7 years agoThis patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352 LLVM code change is...
Vivek Pandya [Fri, 15 Sep 2017 20:09:55 +0000 (20:09 +0000)]
This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352 LLVM code change is as per https://reviews.llvm.org/D33514

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

7 years ago[Sema] Error out early for tags defined inside an enumeration.
Volodymyr Sapsai [Fri, 15 Sep 2017 19:51:42 +0000 (19:51 +0000)]
[Sema] Error out early for tags defined inside an enumeration.

This fixes PR28903 by avoiding access check for inner enum constant. We
are performing access check because one enum constant references another
and because enum is defined in CXXRecordDecl. But access check doesn't
work because FindDeclaringClass doesn't expect more than one EnumDecl
and because inner enum has access AS_none due to not being an immediate
child of a record.

The change detects an enum is defined in wrong place and allows to skip
parsing its body. Access check is skipped together with body parsing.
There was no crash in C, added test case to cover the new error.

rdar://problem/28530809

Reviewers: rnk, doug.gregor, rsmith

Reviewed By: doug.gregor

Subscribers: cfe-commits

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

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

7 years ago[Analyzer] Check function name size before indexing.
George Karpenkov [Fri, 15 Sep 2017 19:51:26 +0000 (19:51 +0000)]
[Analyzer] Check function name size before indexing.

https://reviews.llvm.org/D37908

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

7 years ago[CUDA] Work around a new quirk in CUDA9 headers.
Artem Belevich [Fri, 15 Sep 2017 17:30:53 +0000 (17:30 +0000)]
[CUDA] Work around a new quirk in CUDA9 headers.

In CUDA-9 some of device-side math functions that we need are conditionally
defined within '#if _GLIBCXX_MATH_H'. We need to temporarily undo the guard
around inclusion of math_functions.hpp.

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

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

7 years agoFix the __interface inheritence rules to work better with IUnknown and IDispatch
Erich Keane [Fri, 15 Sep 2017 16:03:35 +0000 (16:03 +0000)]
Fix the __interface inheritence rules to work better with IUnknown and IDispatch

__interface objects in MSVC are permitted to inherit from __interface types,
and interface-like types.

Additionally, there are two default interface-like types
(IUnknown and IDispatch) that all interface-like
types must inherit from.

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

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

7 years ago[clang-format] New flag - BraceWrapping.AfterExternBlock
Krasimir Georgiev [Fri, 15 Sep 2017 11:23:50 +0000 (11:23 +0000)]
[clang-format] New flag - BraceWrapping.AfterExternBlock

Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=34016 - **"extern C part"**

**Problem:**

Due to the lack of "brace wrapping extern" flag, clang format does parse the block after **extern** keyword moving the opening bracket to the header line always!

**Patch description:**

A new style added, new configuration flag - **BraceWrapping.AfterExternBlock** that allows us to decide whether we want a break before brace or not.

Reviewers: djasper, krasimir

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

Contributed by @PriMee!

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

7 years agoRevert "[lit] Force site configs to run before source-tree configs"
Zachary Turner [Fri, 15 Sep 2017 02:56:40 +0000 (02:56 +0000)]
Revert "[lit] Force site configs to run before source-tree configs"

This patch is still breaking several multi-stage compiler-rt bots.
I already know what the fix is, but I want to get the bots green
for now and then try re-applying in the morning.

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

7 years ago[Sema] Correct typos in LHS, RHS before building a binop expression.
Volodymyr Sapsai [Fri, 15 Sep 2017 00:08:37 +0000 (00:08 +0000)]
[Sema] Correct typos in LHS, RHS before building a binop expression.

Specifically, typo correction should be done before dispatching between
different kinds of binary operations like pseudo-object assignment,
overloaded binary operation, etc.

Without this change we hit an assertion

    Assertion failed: (!LHSExpr->hasPlaceholderType(BuiltinType::PseudoObject)), function CheckAssignmentOperands

when in Objective-C we reference a property without `self` and there are
2 equally good typo correction candidates: ivar and a class name. In
this case LHS expression in `BuildBinOp` is

    CXXDependentScopeMemberExpr
    `-TypoExpr

and instead of handling Obj-C property assignment as pseudo-object
assignment, we call `CreateBuiltinBinOp` which corrects typo to

    ObjCPropertyRefExpr '<pseudo-object type>'

but cannot handle pseudo-objects and asserts about it (indirectly,
through `CheckAssignmentOperands`).

rdar://problem/33102722

Reviewers: rsmith, ahatanak, majnemer

Reviewed By: ahatanak

Subscribers: cfe-commits

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

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

7 years agoFix reStructuredText warning.
Douglas Gregor [Thu, 14 Sep 2017 23:58:18 +0000 (23:58 +0000)]
Fix reStructuredText warning.

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

7 years ago[MSan] Specify use-after-dtor default value in header.
Matt Morehouse [Thu, 14 Sep 2017 23:53:56 +0000 (23:53 +0000)]
[MSan] Specify use-after-dtor default value in header.

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

7 years agoMinor cleanups to address feedback from Bruno. NFC
Douglas Gregor [Thu, 14 Sep 2017 23:40:51 +0000 (23:40 +0000)]
Minor cleanups to address feedback from Bruno. NFC

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

7 years agoAdd /System/Library/PrivateFrameworks as a header search path.
Douglas Gregor [Thu, 14 Sep 2017 23:38:44 +0000 (23:38 +0000)]
Add /System/Library/PrivateFrameworks as a header search path.

Addresses rdar://problem/34438708.

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

7 years ago[Module map] Introduce a private module re-export directive.
Douglas Gregor [Thu, 14 Sep 2017 23:38:44 +0000 (23:38 +0000)]
[Module map] Introduce a private module re-export directive.

Introduce a new "export_as" directive for top-level modules, which
indicates that the current module is a "private" module whose symbols
will eventually be exported through the named "public" module. This is
in support of a common pattern in the Darwin ecosystem where a single
public framework is constructed of several private frameworks, with
(currently) header duplication and some support from the linker.

Addresses rdar://problem/34438420.

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

7 years agoDiagnostic specific failed condition in a static_assert.
Douglas Gregor [Thu, 14 Sep 2017 23:38:42 +0000 (23:38 +0000)]
Diagnostic specific failed condition in a static_assert.

When a static_assert fails, dig out a specific condition to diagnose,
using the same logic that we use to find the enable_if condition to
diagnose.

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

7 years ago[MSan] Add flag to disable use-after-dtor.
Matt Morehouse [Thu, 14 Sep 2017 23:14:37 +0000 (23:14 +0000)]
[MSan] Add flag to disable use-after-dtor.

Summary: Flag is -fno-sanitize-use-after-dtor.

Reviewers: vitalybuka, eugenis, kcc

Reviewed By: vitalybuka, eugenis

Subscribers: cfe-commits

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

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

7 years ago[WebAssembly] Fix wasm-toolchain.c tests
Sam Clegg [Thu, 14 Sep 2017 22:36:44 +0000 (22:36 +0000)]
[WebAssembly] Fix wasm-toolchain.c tests

Summary: This test should have been updated in r313299

Subscribers: jfb, dschuff, jgravelle-google, aheejin

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

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

7 years agoFix 2 stage build on some apple bots.
Zachary Turner [Thu, 14 Sep 2017 21:30:27 +0000 (21:30 +0000)]
Fix 2 stage build on some apple bots.

The recent lit refactor changed the location of the lit script
run by check targets from <source>/utils/lit/lit.py to
<bin>/llvm-lit.py.  In some 2-stage build scenarios, the location
of <bin> was not properly passed through to the second stage,
and it was looking for /llvm-lit.py instead, causing failures.

Fix suggested by Mike Edwards and Chris Bieneman @apple

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

7 years ago[WebAssembly] Remove invliad lld arguments
Sam Clegg [Thu, 14 Sep 2017 21:29:25 +0000 (21:29 +0000)]
[WebAssembly] Remove invliad lld arguments

These arguments don't (not yet at least) make sense for
the wasm lld port.

Subscribers: jfb, dschuff, jgravelle-google, aheejin

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

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

7 years agoEnable __declspec(selectany) on any platform
Piotr Padlewski [Thu, 14 Sep 2017 17:33:08 +0000 (17:33 +0000)]
Enable __declspec(selectany) on any platform

Summary:
This feature was disabled probably by mistake in rL300562
This fixes bug https://bugs.llvm.org/show_bug.cgi?id=33285

Reviewers: davide, rnk

Subscribers: cfe-commits

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

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

7 years ago[lit] Force site configs to be run before source-tree configs
Zachary Turner [Thu, 14 Sep 2017 16:47:58 +0000 (16:47 +0000)]
[lit] Force site configs to be run before source-tree configs

This patch simplifies LLVM's lit infrastructure by enforcing an ordering
that a site config is always run before a source-tree config.

A significant amount of the complexity from lit config files arises from
the fact that inside of a source-tree config file, we don't yet know if
the site config has been run.  However it is *always* required to run
a site config first, because it passes various variables down through
CMake that the main config depends on.  As a result, every config
file has to do a bunch of magic to try to reverse-engineer the location
of the site config file if they detect (heuristically) that the site
config file has not yet been run.

This patch solves the problem by emitting a mapping from source tree
config file to binary tree site config file in llvm-lit.py. Then, during
discovery when we find a config file, we check to see if we have a
target mapping for it, and if so we use that instead.

This mechanism is generic enough that it does not affect external users
of lit. They will just not have a config mapping defined, and everything
will work as normal.

On the other hand, for us it allows us to make many simplifications:

* We are guaranteed that a site config will be executed first
* Inside of a main config, we no longer have to assume that attributes
  might not be present and use getattr everywhere.
* We no longer have to pass parameters such as --param llvm_site_config=<path>
  on the command line.
* It is future-proof, meaning you don't have to edit llvm-lit.in to add
  support for new projects.
* All of the duplicated logic of trying various fallback mechanisms of
  finding a site config from the main config are now gone.

One potentially noteworthy thing that was required to implement this
change is that whereas the ninja check targets previously used the first
method to spawn lit, they now use the second. In particular, you can no
longer run lit.py against the source tree while specifying the various
`foo_site_config=<path>` parameters.  Instead, you need to run
llvm-lit.py.

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

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

7 years agoFix Refactor/tool-test-support.c test on Windows by avoiding
Alex Lorenz [Thu, 14 Sep 2017 15:10:39 +0000 (15:10 +0000)]
Fix Refactor/tool-test-support.c test on Windows by avoiding
the STDERR redirect

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

7 years ago[refactor] Use CommonOptionsParser in clang-refactor
Alex Lorenz [Thu, 14 Sep 2017 13:16:14 +0000 (13:16 +0000)]
[refactor] Use CommonOptionsParser in clang-refactor

This commit ensures that CommonOptionsParser works with subcommands. This allows
clang-refactor to use the CommonOptionsParser.

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

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

7 years agoLink clang-refactor with clangFormat
Alex Lorenz [Thu, 14 Sep 2017 10:46:29 +0000 (10:46 +0000)]
Link clang-refactor with clangFormat

This is an attempt to fix
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage after r313244.

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

7 years agoLink clang-refactor with clangAST and clangLex
Alex Lorenz [Thu, 14 Sep 2017 10:38:04 +0000 (10:38 +0000)]
Link clang-refactor with clangAST and clangLex

This is an attempt to fix http://bb.pgr.jp/builders/clang-i686-linux-RA/ after
r313244.

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

7 years ago[refactor] add clang-refactor tool with initial testing support and
Alex Lorenz [Thu, 14 Sep 2017 10:06:52 +0000 (10:06 +0000)]
[refactor] add clang-refactor tool with initial testing support and
local-rename action

This commit introduces the clang-refactor tool alongside the local-rename action
which uses the existing renaming engine used by clang-rename. The tool
doesn't actually perform the source transformations yet, it just provides
testing support. This commit also moves only one test from clang-rename over to
test/Refactor. I will continue to move the other tests throughout
development of clang-refactor.

The following options are supported by clang-refactor:

-v: use verbose output
-selection: The source range that corresponds to the portion of the source
 that's selected (currently only special command test:<file> is supported).

Please note that a follow-up commit will migrate clang-refactor to
libTooling's common option parser, so clang-refactor will be able to use
the common interface with compilation database and options like -p, -extra-arg,
etc.

The testing support provided by clang-refactor is described below:

When -selection=test:<file> is given, clang-refactor will parse the selection
commands from that file. The selection commands are grouped and the specified
refactoring action invoked by the tool. Each command in a group is expected to
produce an identical result. The precise syntax for the selection commands is
described in a comment in TestSupport.h.

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

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

7 years ago[Headers] Fix the return type of _InterlockedCompareExchange_rel
Martin Storsjo [Thu, 14 Sep 2017 07:04:59 +0000 (07:04 +0000)]
[Headers] Fix the return type of _InterlockedCompareExchange_rel

This was a typo in SVN r282447, where it was added.

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

7 years ago[NFC] [Analyzer] Fix RST markup in documentation.
George Karpenkov [Thu, 14 Sep 2017 00:04:56 +0000 (00:04 +0000)]
[NFC] [Analyzer] Fix RST markup in documentation.

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

7 years agoUse -- to prevent the driver from confusing paths with flags, should fix Mac bot.
Peter Collingbourne [Wed, 13 Sep 2017 21:49:17 +0000 (21:49 +0000)]
Use -- to prevent the driver from confusing paths with flags, should fix Mac bot.

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

7 years agoMark static member functions as static in CodeViewDebug
Adrian McCarthy [Wed, 13 Sep 2017 20:53:55 +0000 (20:53 +0000)]
Mark static member functions as static in CodeViewDebug

Summary:
To improve CodeView quality for static member functions, we need to make the
static explicit.  In addition to a small change in LLVM's CodeViewDebug to
return the appropriate MethodKind, this requires a small change in Clang to
note the staticness in the debug info metadata.

Subscribers: aprantl, hiraditya

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

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

7 years ago[OPENMP] Fix types for the target specific parameters in debug mode.
Alexey Bataev [Wed, 13 Sep 2017 20:20:59 +0000 (20:20 +0000)]
[OPENMP] Fix types for the target specific parameters in debug mode.

Used incorrect types for target specific parameters in debug mode,
should use original pointers rather than the pointee types.

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

7 years agoSplitEmptyFunction should be true in the Mozilla coding style
Sylvestre Ledru [Wed, 13 Sep 2017 20:03:29 +0000 (20:03 +0000)]
SplitEmptyFunction should be true in the Mozilla coding style

Summary:
As defined here: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
See for the downstream bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1399359

Reviewers: Typz, djasper

Reviewed By: Typz

Subscribers: klimek, cfe-commits

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

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

7 years ago[docs] Update LeakSanitizer documentation to reflect OS X support
Francis Ricci [Wed, 13 Sep 2017 19:40:10 +0000 (19:40 +0000)]
[docs] Update LeakSanitizer documentation to reflect OS X support

Reviewers: kcc, alekseyshl, kubamracek, glider

Subscribers: llvm-commits

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

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

7 years ago[Fuchsia] Set ENABLE_X86_RELAX_RELOCATIONS for Fuchsia builds
Petr Hosek [Wed, 13 Sep 2017 19:17:41 +0000 (19:17 +0000)]
[Fuchsia] Set ENABLE_X86_RELAX_RELOCATIONS for Fuchsia builds

This is a "Does your linker support it?" option, and all ours do.

Patch by Roland McGrath

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

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

7 years agoAdd more tests for OpenCL atomic builtin functions
Yaxun Liu [Wed, 13 Sep 2017 18:56:25 +0000 (18:56 +0000)]
Add more tests for OpenCL atomic builtin functions

Add tests for different address spaces and insert some blank lines to make them more readable.

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

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

7 years ago[AMDGPU] Change addr space of clk_event_t, queue_t and reserve_id_t to global
Yaxun Liu [Wed, 13 Sep 2017 18:50:42 +0000 (18:50 +0000)]
[AMDGPU] Change addr space of clk_event_t, queue_t and reserve_id_t to global

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

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

7 years agoDriver: Make -fwhole-program-vtables a core option so it can be used from clang-cl.
Peter Collingbourne [Wed, 13 Sep 2017 18:36:07 +0000 (18:36 +0000)]
Driver: Make -fwhole-program-vtables a core option so it can be used from clang-cl.

Also add some missing driver tests for the regular clang driver.

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

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

7 years agoAttempt to fix MSVC build.
Alexander Kornienko [Wed, 13 Sep 2017 17:45:51 +0000 (17:45 +0000)]
Attempt to fix MSVC build.

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

7 years agoUpdate users of llvm::sys::ExecuteAndWait etc.
Alexander Kornienko [Wed, 13 Sep 2017 17:03:58 +0000 (17:03 +0000)]
Update users of llvm::sys::ExecuteAndWait etc.

Summary: Clang part of https://reviews.llvm.org/D37563

Reviewers: bkramer

Subscribers: vsk, cfe-commits

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

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

7 years agoThis adds the _Float16 preprocessor macro definitions.
Sjoerd Meijer [Wed, 13 Sep 2017 15:23:19 +0000 (15:23 +0000)]
This adds the _Float16 preprocessor macro definitions.

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

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

7 years ago[OPENMP] Allow all classes as mappable types.
Alexey Bataev [Wed, 13 Sep 2017 11:12:35 +0000 (11:12 +0000)]
[OPENMP] Allow all classes as mappable types.

According to upcoming OpenMP 5.0 all classes/structs are now considered
as mappable, even polymorphic and with static members.

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

7 years ago[X86] [PATCH] [intrinsics] Lowering X86 ABS intrinsics to IR. (clang)
Uriel Korach [Wed, 13 Sep 2017 09:02:02 +0000 (09:02 +0000)]
[X86] [PATCH] [intrinsics] Lowering X86 ABS intrinsics to IR. (clang)

This patch, together with a matching llvm patch (https://reviews.llvm.org/D37693), implements the lowering of X86 ABS intrinsics to IR.

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

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

7 years agoclang/lib/Driver/ToolChains/Darwin.h: Add proper style to comments. [-Wdocumentation]
NAKAMURA Takumi [Wed, 13 Sep 2017 07:58:46 +0000 (07:58 +0000)]
clang/lib/Driver/ToolChains/Darwin.h: Add proper style to comments. [-Wdocumentation]

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

7 years agolibclang: expose `clang_getCursorTLSKind`
Saleem Abdulrasool [Wed, 13 Sep 2017 02:15:09 +0000 (02:15 +0000)]
libclang: expose `clang_getCursorTLSKind`

Introduce the 'TLS Kind' property of variable declarations through
libclang. Additionally, provide a Python accessor for it, and test that
functionality.

Patch by Masud Rahman!

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

7 years agoRevert "[Driver] MinGW: Remove custom linker detection"
Martell Malone [Wed, 13 Sep 2017 00:57:50 +0000 (00:57 +0000)]
Revert "[Driver] MinGW: Remove custom linker detection"

This reverts rL313102 because it still fails some build bot tests.

On many linux bots it fails with the following error.
error: invalid linker name in argument '-fuse-ld=lld'
and on some windows bots also because there is no ld.lld.exe
lld-link.exe: warning: ignoring unknown argument: -fuse-ld=lld

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

7 years ago[Driver] MinGW: Remove custom linker detection
Martell Malone [Wed, 13 Sep 2017 00:46:54 +0000 (00:46 +0000)]
[Driver] MinGW: Remove custom linker detection

In rL289668 the ability to specify the default linker at compile time
was added but because the MinGW driver used custom detection we could
not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.

This is a re-apply of rL313082 which was reverted in rL313088
due to failing buildbot tests.

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

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

7 years ago[ubsan] Enable -fsanitize=function on Darwin
Vedant Kumar [Wed, 13 Sep 2017 00:04:36 +0000 (00:04 +0000)]
[ubsan] Enable -fsanitize=function on Darwin

https://reviews.llvm.org/D37598

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

7 years agoTighten up a test case. NFC.
Vedant Kumar [Wed, 13 Sep 2017 00:04:36 +0000 (00:04 +0000)]
Tighten up a test case. NFC.

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

7 years ago[ubsan] Function Sanitizer: Don't require writable text segments
Vedant Kumar [Wed, 13 Sep 2017 00:04:35 +0000 (00:04 +0000)]
[ubsan] Function Sanitizer: Don't require writable text segments

This change will make it possible to use -fsanitize=function on Darwin and
possibly on other platforms. It fixes an issue with the way RTTI is stored into
function prologue data.

On Darwin, addresses stored in prologue data can't require run-time fixups and
must be PC-relative. Run-time fixups are undesirable because they necessitate
writable text segments, which can lead to security issues. And absolute
addresses are undesirable because they break PIE mode.

The fix is to create a private global which points to the RTTI, and then to
encode a PC-relative reference to the global into prologue data.

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

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

7 years agoRevert "[Driver] MinGW: Remove custom linker detection"
Martell Malone [Tue, 12 Sep 2017 22:58:12 +0000 (22:58 +0000)]
Revert "[Driver] MinGW: Remove custom linker detection"

This reverts rL313082

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

7 years ago[Driver] Disable uwtable by default in -ffreestanding mode
Vedant Kumar [Tue, 12 Sep 2017 22:51:53 +0000 (22:51 +0000)]
[Driver] Disable uwtable by default in -ffreestanding mode

We make the same decision when compiling the kernel or kexts -- we
should do this in -ffreestanding mode as well to avoid size regressions
in a potentially large set of firmware projects.

It's still possible to get uwtable information in -ffreestanding mode by
compiling with -funwind-tables (I expect this to be a rare case: I
certainly haven't seen any projects like that).

Context: -munwind-tables was enabled by default for some arm targets in
r310006.

Testing: check-clang

rdar://problem/33934446

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

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

7 years ago[Driver] MinGW: Remove custom linker detection
Martell Malone [Tue, 12 Sep 2017 22:14:18 +0000 (22:14 +0000)]
[Driver] MinGW: Remove custom linker detection

In rL289668 the ability to specify the default linker at compile time
was added but because the MinGW driver used custom detection we could
not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.

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

7 years agoIR: Represent -ggnu-pubnames with a flag on the DICompileUnit.
Peter Collingbourne [Tue, 12 Sep 2017 21:50:41 +0000 (21:50 +0000)]
IR: Represent -ggnu-pubnames with a flag on the DICompileUnit.

This allows the flag to be persisted through to LTO.

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

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

7 years ago[Driver] Darwin: Link in the profile runtime archive first
Vedant Kumar [Tue, 12 Sep 2017 19:15:31 +0000 (19:15 +0000)]
[Driver] Darwin: Link in the profile runtime archive first

While building a project with code coverage enabled, we can link in
dependencies which export a weak definition of __llvm_profile_filename.

After r306710, linking in the profiling runtime could pull in a weak
definition of this symbol from a dependency, instead of from within the
runtime's archive.

This inconsistency causes issues during API verification, and is also a
practical problem (the symbol would go missing were the dependent dylib
to be switched out). Introduce a LinkFirst runtime link option to make
sure we always search the profiling runtime for this symbol first.

rdar://problem/33271080

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

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

7 years ago[ubsan] Extend default blacklist support to integer/nullability groups
Vedant Kumar [Tue, 12 Sep 2017 18:58:00 +0000 (18:58 +0000)]
[ubsan] Extend default blacklist support to integer/nullability groups

The default blacklist should also apply when the integer or nullability
checks are enabled.

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

7 years agoclang-format-vs: Update the VSIX ID.
Hans Wennborg [Tue, 12 Sep 2017 18:38:34 +0000 (18:38 +0000)]
clang-format-vs: Update the VSIX ID.

We're moving the extension to a new account on the VS Marketplace, and
apparently it's not possible to re-upload an extension with an existing
ID on a new account.

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

7 years agoUse the VFS from the CompilerInvocation by default
Raphael Isemann [Tue, 12 Sep 2017 16:54:53 +0000 (16:54 +0000)]
Use the VFS from the CompilerInvocation by default

Summary:
The CompilerInstance should create its default VFS from its CompilerInvocation. Right now the
user has to manually create the VFS before creating the FileManager even though
`-ivfsoverlay file.yaml` was passed via the CompilerInvocation (which is exactly how we worked
around this issue in `FrontendAction.cpp` so far).

This patch uses the invocation's VFS by default and also tests this behavior now from the
point of view of a program that uses the clang API.

Reviewers: benlangmuir, v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: mgorny, cfe-commits, v.g.vassilev

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

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

7 years agoFix PR34021 test on non-x86 build targets
Simon Pilgrim [Tue, 12 Sep 2017 15:04:04 +0000 (15:04 +0000)]
Fix PR34021 test on non-x86 build targets

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

7 years agoFix GCC build error and warnings from r313025
Alex Lorenz [Tue, 12 Sep 2017 13:03:42 +0000 (13:03 +0000)]
Fix GCC build error and warnings from r313025

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

7 years ago[refactor] add a refactoring action rule that returns symbol occurrences
Alex Lorenz [Tue, 12 Sep 2017 12:48:37 +0000 (12:48 +0000)]
[refactor] add a refactoring action rule that returns symbol occurrences

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

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

7 years agoLimit test to x86 targets
Simon Pilgrim [Tue, 12 Sep 2017 12:16:35 +0000 (12:16 +0000)]
Limit test to x86 targets

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

7 years ago[MS-InlineAsm] Fix cast assertion with vector spills (PR34021)
Simon Pilgrim [Tue, 12 Sep 2017 11:05:42 +0000 (11:05 +0000)]
[MS-InlineAsm] Fix cast assertion with vector spills (PR34021)

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

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

7 years ago[ARM] Option for reading thread pointer from coprocessor register
Strahinja Petrovic [Tue, 12 Sep 2017 10:40:58 +0000 (10:40 +0000)]
[ARM] Option for reading thread pointer from coprocessor register

This patch enables option for reading thread pointer directly
from coprocessor register (-mtp=soft/cp15).

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

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

7 years agoFix recording preamble's conditional stack in skipped PP branches.
Ilya Biryukov [Tue, 12 Sep 2017 08:35:57 +0000 (08:35 +0000)]
Fix recording preamble's conditional stack in skipped PP branches.

Summary:
This fixes PR34547.
`Lexer::LexEndOfFile` handles recording of ConditionalStack for
preamble and reporting errors about unmatched conditionalal PP
directives.
However, SkipExcludedConditionalBlock contianed duplicated logic for
reporting errors and clearing ConditionalStack, but not for preamble
recording.

This fix removes error reporting logic from
`SkipExcludedConditionalBlock`, unmatched PP conditionals are now
reported inside `Lexer::LexEndOfFile`.

Reviewers: erikjv, klimek, bkramer

Reviewed By: erikjv

Subscribers: nik, cfe-commits

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

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

7 years ago[X86] Lower _mm[256|512]_[mask[z]]_avg_epu[8|16] intrinsics to native llvm IR
Yael Tsafrir [Tue, 12 Sep 2017 07:46:32 +0000 (07:46 +0000)]
[X86] Lower _mm[256|512]_[mask[z]]_avg_epu[8|16] intrinsics to native llvm IR

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

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

7 years ago[Driver] Fuchsia targets default to -fasynchronous-unwind-tables
Petr Hosek [Tue, 12 Sep 2017 01:28:37 +0000 (01:28 +0000)]
[Driver] Fuchsia targets default to -fasynchronous-unwind-tables

This regressed for x86-64 in r307856 because it's no longer inherited
from Generic_GCC. We'd never noticed that it was missing other
targets (i.e. aarch64), but Fuchsia is uniform across all machines.

Patch by Roland McGrath

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

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

7 years agoFix broken links to the Itanium CXX ABI
Vlad Tsyrklevich [Tue, 12 Sep 2017 00:21:17 +0000 (00:21 +0000)]
Fix broken links to the Itanium CXX ABI

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

7 years ago[codeview] omit debug locations for nested exprs unless column info enabled
Bob Haarman [Mon, 11 Sep 2017 22:11:57 +0000 (22:11 +0000)]
[codeview] omit debug locations for nested exprs unless column info enabled

Summary:
Microsoft Visual Studio expects debug locations to correspond to
statements. We used to emit locations for expressions nested inside statements.
This would confuse the debugger, causing it to stop multiple times on the
same line and breaking the "step into specific" feature. This change inhibits
the emission of debug locations for nested expressions when emitting CodeView
debug information, unless column information is enabled.

Fixes PR34312.

Reviewers: rnk, zturner

Reviewed By: rnk

Subscribers: majnemer, echristo, aprantl, cfe-commits

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

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

7 years ago[Driver] Support ubsan-minimal on Darwin
Vedant Kumar [Mon, 11 Sep 2017 21:37:06 +0000 (21:37 +0000)]
[Driver] Support ubsan-minimal on Darwin

Make it possible to use the minimal ubsan runtime on Darwin.

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

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

7 years ago[ubsan-minimal] Document the new runtime
Vedant Kumar [Mon, 11 Sep 2017 21:37:05 +0000 (21:37 +0000)]
[ubsan-minimal] Document the new runtime

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

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

7 years ago[Lexer] Report more precise skipped regions (PR34166)
Vedant Kumar [Mon, 11 Sep 2017 20:47:42 +0000 (20:47 +0000)]
[Lexer] Report more precise skipped regions (PR34166)

This patch teaches the preprocessor to report more precise source ranges for
code that is skipped due to conditional directives.

The new behavior includes the '#' from the opening directive and the full text
of the line containing the closing directive in the skipped area. This matches
up clang's behavior (we don't IRGen the code between the closing "endif" and
the end of a line).

This also affects the code coverage implementation. See llvm.org/PR34166 (this
also happens to be rdar://problem/23224058).

The old behavior (report the end of the skipped range as the end
location of the 'endif' token) is preserved for indexing clients.

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

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

7 years agoclang-rename: let -force handle multiple renames
Miklos Vajna [Mon, 11 Sep 2017 20:18:38 +0000 (20:18 +0000)]
clang-rename: let -force handle multiple renames

Summary:
The use case is that renaming multiple symbols in a large enough codebase is
much faster if all of these can be done with a single invocation, but
there will be multiple translation units where one or more symbols are
not found.

Old behavior was to exit with an error (default) or exit without
reporting an error (-force). New behavior is that -force results in a
best-effort rename: rename symbols which are found and just ignore the
rest.

The existing help for -force sort of already implies this behavior.

Reviewers: cfe-commits, klimek, arphaman

Reviewed By: klimek

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

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

7 years agoDriver: default to `-fno-use-cxatexit` on Windows
Saleem Abdulrasool [Mon, 11 Sep 2017 20:18:09 +0000 (20:18 +0000)]
Driver: default to `-fno-use-cxatexit` on Windows

This primarily impacts the Windows MSVC and Windows itanium
environments.  Windows MSVC does not use `__cxa_atexit` and Itanium
follows suit.  Simplify the logic for the default value calculation and
blanket the Windows environments to default to off for use of
`__cxa_atexit`.

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

7 years agoclang-format: [JS] wrap and indent `goog.setTestOnly` calls.
Martin Probst [Mon, 11 Sep 2017 15:22:52 +0000 (15:22 +0000)]
clang-format: [JS] wrap and indent `goog.setTestOnly` calls.

Summary:
While `goog.setTestOnly` usually appears in the imports section of a file, it is
not actually an import, and also usually doesn't take long parameters (nor
namespaces as a parameter, it's a description/message that should be wrapped).

This fixes a regression where a `goog.setTestOnly` call nested in a function was
not wrapped.

Reviewers: djasper

Subscribers: klimek

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

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

7 years ago[PCH] Allow VFS to be used for tests that generate PCH files
Cameron Desrochers [Mon, 11 Sep 2017 15:03:23 +0000 (15:03 +0000)]
[PCH] Allow VFS to be used for tests that generate PCH files

When using a virtual file-system (VFS) and a preamble file (PCH) is generated,
it is generated on-disk in the real file-system instead of in the VFS (which
makes sense, since the VFS is read-only). However, when subsequently reading
the generated PCH, the frontend passes through the VFS it has been given --
resulting in an error and a failed parse (since the VFS doesn't contain the
PCH; the real filesystem does).

This patch fixes that by detecting when a VFS is being used for a parse that
needs to work with a PCH file, and creating an overlay VFS that includes the
PCH file from the real file-system.

This allows tests to be written which make use of both PCH files and a VFS.

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

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

7 years ago[AST] Make RecursiveASTVisitor visit TemplateDecls in source order
Johannes Altmanninger [Mon, 11 Sep 2017 13:12:30 +0000 (13:12 +0000)]
[AST] Make RecursiveASTVisitor visit TemplateDecls in source order

Summary:
This causes template arguments to be traversed before the templated
declaration, which is useful for clients that expect the nodes in
the same order as they are in the source code. Additionally, there
seems to be no good reason not to do so.

This was moved here from LexicallyOrderedRecursiveASTVisitor. The tests
still reside in LexicallyOrderedRecursiveASTVisitorTest.cpp under
VisitTemplateDecls.

Reviewers: arphaman, rsmith, klimek

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-format] Fixed one-line if statement
Krasimir Georgiev [Mon, 11 Sep 2017 10:12:16 +0000 (10:12 +0000)]
[clang-format] Fixed one-line if statement

Summary:
**Short overview:**

Fixed bug: https://bugs.llvm.org/show_bug.cgi?id=34001
Clang-format bug resulting in a strange behavior of control statements short blocks. Different flags combinations do not guarantee expected result. Turned on option AllowShortBlocksOnASingleLine does not work as intended.

**Description of the problem:**

Cpp source file UnwrappedLineFormatter does not handle AllowShortBlocksOnASingleLine flag as it should. Putting a single-line control statement without any braces, clang-format works as expected (depending on AllowShortIfStatementOnASingleLine or AllowShortLoopsOnASingleLine value). Putting a single-line control statement in braces, we can observe strange and incorrect behavior.
Our short block is intercepted by tryFitMultipleLinesInOne function. The function returns a number of lines to be merged. Unfortunately, our control statement block is not covered properly. There are several if-return statements, but none of them handles our block. A block is identified by the line first token and by left and right braces. A function block works as expected, there is such an if-return statement doing proper job. A control statement block, from the other hand, falls into strange conditional construct, which depends on BraceWrapping.AfterFunction flag (with condition that the line’s last token is left brace, what is possible in our case) or goes even further. That should definitely not happen.

**Description of the patch:**

By adding three different if statements, we guarantee that our short control statement block, however it looks like (different brace wrapping flags may be turned on), is handled properly and does not fall into wrong conditional construct. Depending on appropriate options we return either 0 (when something disturbs our merging attempt) or let another function (tryMergeSimpleBlock) take the responsibility of returned result (number of merged lines). Nevertheless, one more correction is required in mentioned tryMergeSimpleBlock function. The function, previously, returned either 0 or 2. The problem was that this did not handle the case when our block had the left brace in a separate line, not the header one. After change, after adding condition, we return the result compatible with block’s structure. In case of left brace in the header’s line we do everything as before the patch. In case of left brace in a separate line we do the job similar to the one we do in case of a “non-header left brace” function short block. To be precise, we try to merge the block ignoring the header line. Then, if success, we increment our returned result.

**After fix:**

**CONFIG:**
```
AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
BreakBeforeBraces: Custom
BraceWrapping: {
AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true
}
```
**BEFORE:**
```
if (statement) doSomething();
if (statement) { doSomething(); }
if (statement) {
    doSomething();
}
if (statement)
{
    doSomething();
}
if (statement)
    doSomething();
if (statement) {
    doSomething1();
    doSomething2();
}
```
**AFTER:**
```
if (statement) doSomething();
if (statement) { doSomething(); }
if (statement) { doSomething(); }
if (statement) { doSomething(); }
if (statement) doSomething();
if (statement)
{
  doSomething1();
  doSomething2();
}
```

Contributed by @PriMee!

Reviewers: krasimir, djasper

Reviewed By: krasimir

Subscribers: cfe-commits, klimek

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

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

7 years agoRevert r312830: "Reinstall the patch "Use EmitPointerWithAlignment to get alignment...
Daniel Jasper [Mon, 11 Sep 2017 07:35:01 +0000 (07:35 +0000)]
Revert r312830: "Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr"."

This triggers llvm.org/PR31620 in several of our internal builds. I'll
forward reproduction instructions to the original author.

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

7 years agoAdd objcImplementationDecl matcher
Dave Lee [Sun, 10 Sep 2017 21:00:15 +0000 (21:00 +0000)]
Add objcImplementationDecl matcher

Summary:
Add the `objcImplementationDecl` matcher. See related: D30854

Tested with:

```
./tools/clang/unittests/ASTMatchers/ASTMatchersTests
```

Reviewers: aaron.ballman, compnerd, alexshap

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits

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

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

7 years ago[clang][SemaStmtAsm] small refactoring, NFC.
Coby Tayree [Sun, 10 Sep 2017 12:39:21 +0000 (12:39 +0000)]
[clang][SemaStmtAsm] small refactoring, NFC.

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

7 years agoset the svn:executable property, seems that it is necessary for apache (discussed...
Sylvestre Ledru [Sun, 10 Sep 2017 08:00:03 +0000 (08:00 +0000)]
set the svn:executable property, seems that it is necessary for apache (discussed with Tanya by email)

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

7 years agoclang fix for LLVM API change: isKnownNonNull -> isKnownNonZero
Nuno Lopes [Sat, 9 Sep 2017 18:25:36 +0000 (18:25 +0000)]
clang fix for LLVM API change: isKnownNonNull -> isKnownNonZero

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

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

7 years ago[Basic] Update CMakeLists.txt to handle repo
MinSeong Kim [Sat, 9 Sep 2017 14:18:53 +0000 (14:18 +0000)]
[Basic] Update CMakeLists.txt to handle repo

Summary:
The find_first_existing_file and find_first_existing_vc_file macros in
lib/Basic/CMakeLists.txt are removed. The macros are also defined in
{LLVM}/cmake/modules/AddLLVM.cmake for the same purpose. This change
serves the following 2 objectives:

    1. To remove the redundant code in clang to use the same
       macros in llvm,
    2. The macros in AddLLVM.cmake can also handle repo for
       displaying correct version information.

Reviewers: jordan_rose, cfe-commits, modocache, hintonda

Reviewed By: hintonda

Subscribers: mgorny

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

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

7 years agoFix ownership of the MemoryBuffer in a FrontendInputFile.
Richard Smith [Sat, 9 Sep 2017 01:14:04 +0000 (01:14 +0000)]
Fix ownership of the MemoryBuffer in a FrontendInputFile.

This fixes a possible crash on certain kinds of corrupted AST file, but
checking in an AST file corrupted in just the right way will be a maintenance
nightmare because the format changes frequently.

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

7 years ago[cxx_status] Change "Clang 5" items from yellow to green now that Clang 5 has been...
Richard Smith [Sat, 9 Sep 2017 01:11:04 +0000 (01:11 +0000)]
[cxx_status] Change "Clang 5" items from yellow to green now that Clang 5 has been released.

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

7 years agoCatch more cases with -Wenum-compare
Richard Trieu [Sat, 9 Sep 2017 00:25:05 +0000 (00:25 +0000)]
Catch more cases with -Wenum-compare

Treat typedef enum as named enums instead of anonymous enums.  Anonymous enums
are ignored by the warning, so previously, typedef enums were ignored as well.

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

7 years agoCodeGen: correct arguments for NSFastEnumeration
Saleem Abdulrasool [Fri, 8 Sep 2017 23:41:17 +0000 (23:41 +0000)]
CodeGen: correct arguments for NSFastEnumeration

When performing a NSFastEnumeration, the compiler synthesizes a call to
`countByEnumeratingWithState:objects:count:` where the `count` parameter
is of type `NSUInteger` and the return type is a `NSUInteger`.  We would
previously always use a `UnsignedLongTy` for the `NSUInteger` type.  On
32-bit targets, `long` is 32-bits which is the same as `unsigned int`.
Most 64-bit targets are LP64, where `long` is 64-bits.  However, on
LLP64 targets, such as Windows, `long` is 32-bits.  Introduce new
`getNSUIntegerType` and `getNSIntegerType` helpers to allow us to
determine the correct type for the `NSUInteger` type.  Wire those
through into the generation of the message dispatch to the selector.

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

7 years agoReinstall the patch "Use EmitPointerWithAlignment to get alignment information of...
Wei Mi [Fri, 8 Sep 2017 21:58:18 +0000 (21:58 +0000)]
Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr".

This is to fix PR34347. EmitAtomicExpr now only uses alignment information from
Type, instead of Decl, so when the declaration of an atomic variable is marked
to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and
will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment
to get the precise alignment information.

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

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

7 years ago[Coverage] Precise region termination with deferred regions (reapply)
Vedant Kumar [Fri, 8 Sep 2017 18:44:56 +0000 (18:44 +0000)]
[Coverage] Precise region termination with deferred regions (reapply)

The current coverage implementation doesn't handle region termination
very precisely. Take for example an `if' statement with a `return':

  void f() {
    if (true) {
      return; // The `if' body's region is terminated here.
    }
    // This line gets the same coverage as the `if' condition.
  }

If the function `f' is called, the line containing the comment will be
marked as having executed once, which is not correct.

The solution here is to create a deferred region after terminating a
region. The deferred region is completed once the start location of the
next statement is known, and is then pushed onto the region stack.
In the cases where it's not possible to complete a deferred region, it
can safely be dropped.

Testing: lit test updates, a stage2 coverage-enabled build of clang

This is a reapplication but there are no changes from the original commit.
With D36813, the segment builder in llvm will be able to handle deferred
regions correctly.

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

7 years agoAdd some documentation on how to generate the documentation.
Aaron Ballman [Fri, 8 Sep 2017 18:40:39 +0000 (18:40 +0000)]
Add some documentation on how to generate the documentation.

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

7 years agoDelete empty file test/CodeGenCXX/atomic-align.cpp after the revert at rL312805.
Wei Mi [Fri, 8 Sep 2017 18:31:21 +0000 (18:31 +0000)]
Delete empty file test/CodeGenCXX/atomic-align.cpp after the revert at rL312805.

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

7 years agoRevert rL312801 since it generated some calls from libatomic and broke some tests.
Wei Mi [Fri, 8 Sep 2017 18:10:13 +0000 (18:10 +0000)]
Revert rL312801 since it generated some calls from libatomic and broke some tests.

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

7 years agoUse EmitPointerWithAlignment to get alignment information of the pointer used in...
Wei Mi [Fri, 8 Sep 2017 17:07:32 +0000 (17:07 +0000)]
Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr.

This is to fix PR34347. EmitAtomicExpr now only uses alignment information from
Type, instead of Decl, so when the declaration of an atomic variable is marked
to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and
will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment
to get the precise alignment information.

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

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

7 years agoAdd _Float16 as a C/C++ source language type
Sjoerd Meijer [Fri, 8 Sep 2017 16:43:10 +0000 (16:43 +0000)]
Add _Float16 as a C/C++ source language type

Pacify the windows builder; fixed the new test as on Windows some additional
attributes are printed.

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

7 years agoAdd '\n' in ClangDataCollectorsEmitter
Konstantin Zhuravlyov [Fri, 8 Sep 2017 16:17:16 +0000 (16:17 +0000)]
Add '\n' in ClangDataCollectorsEmitter

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

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

7 years agoRecommit "Add _Float16 as a C/C++ source language type"
Sjoerd Meijer [Fri, 8 Sep 2017 15:15:00 +0000 (15:15 +0000)]
Recommit "Add _Float16 as a C/C++ source language type"

This is a recommit of r312781; in some build configurations
variable names are omitted, so changed the new regression
test accordingly.

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