]> granicus.if.org Git - clang/log
clang
7 years agoFilter out invalid 'target' items from being passed to LLVM
Erich Keane [Fri, 27 Oct 2017 18:32:23 +0000 (18:32 +0000)]
Filter out invalid 'target' items from being passed to LLVM

Craig noticed that CodeGen wasn't properly ignoring the
values sent to the target attribute. This patch ignores
them.

This patch also sets the 'default' for this checking to
'supported', since only X86 has implemented the support
for checking valid CPU names and Feature Names.

One test was changed to i686, since it uses a lakemont,
which would otherwise be prohibited in x86_64.

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

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

7 years agoRemove x86,x86_32/64 from isValidFeatureName
Erich Keane [Fri, 27 Oct 2017 18:29:02 +0000 (18:29 +0000)]
Remove x86,x86_32/64 from isValidFeatureName

These are not valid values for this, and are pretty
non-sensical, since LLVM doesn't understand them.

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

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

7 years ago[refactor] Describe refactorings in the operation classes
Alex Lorenz [Fri, 27 Oct 2017 18:19:11 +0000 (18:19 +0000)]
[refactor] Describe refactorings in the operation classes

This commit changes the way that the refactoring operation classes are
structured:
- Users have to call `initiate` instead of constructing an instance of the
  class. The `initiate` is now supposed to have custom initiation logic, and
  you don't need to subclass the builtin requirements.
- A new `describe` function returns a structure with the id, title and the
  description of the refactoring operation.

The refactoring action classes are now placed into one common place in
RefactoringActions.cpp instead of being separate.

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

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

7 years ago[Sema] Fix an assert-on-invalid by avoiding function template specialisation
Alex Lorenz [Fri, 27 Oct 2017 18:13:31 +0000 (18:13 +0000)]
[Sema] Fix an assert-on-invalid by avoiding function template specialisation
deduction for invalid functions

The fabricated template parameters cause an assertion because their depth
is invalid.

rdar://34109988

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

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

7 years ago[WebAssembly] Add crt1.o with calling lld
Sam Clegg [Fri, 27 Oct 2017 18:10:19 +0000 (18:10 +0000)]
[WebAssembly] Add crt1.o with calling lld

Also, for OS unknown targets like wasm, don't include
'unknown' in the library path. This is a fix for rL316719.

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

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

7 years agoNew lldb python module for managing diagnostic breakpoints
Don Hinton [Fri, 27 Oct 2017 17:02:33 +0000 (17:02 +0000)]
New lldb python module for managing diagnostic breakpoints

Summary:
Can be used to set breakpoints for either the diagnostics actually
emitted for the current compilation, a particular DiagID, or all
DiagIDs for a particular warning.

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

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

7 years ago[CrossTU] Fix handling of Cross Translation Unit directory path
Gabor Horvath [Fri, 27 Oct 2017 12:53:37 +0000 (12:53 +0000)]
[CrossTU] Fix handling of Cross Translation Unit directory path

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

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

7 years agoTest commit
Ivan Donchevskii [Fri, 27 Oct 2017 11:05:40 +0000 (11:05 +0000)]
Test commit

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

7 years agoFix test/Driver/wasm-toolchain.c on windows
Sam Clegg [Fri, 27 Oct 2017 01:20:16 +0000 (01:20 +0000)]
Fix test/Driver/wasm-toolchain.c on windows

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

7 years ago[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.
Volodymyr Sapsai [Fri, 27 Oct 2017 00:56:23 +0000 (00:56 +0000)]
[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.

Fixes an assertion failure when ivar is a struct containing incomplete
array. Also completes support for direct flexible array members.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

7 years ago[WebAssembly] Include libclang_rt.builtins in the standard way
Sam Clegg [Fri, 27 Oct 2017 00:26:07 +0000 (00:26 +0000)]
[WebAssembly] Include libclang_rt.builtins in the standard way

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

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

7 years ago[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName
Craig Topper [Fri, 27 Oct 2017 00:18:16 +0000 (00:18 +0000)]
[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName

sse4 is valid for target attribute and functions as an alias of sse4.2.

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

7 years agoUse -fuse-init-array if no gcc installation is found.
Nico Weber [Thu, 26 Oct 2017 23:26:29 +0000 (23:26 +0000)]
Use -fuse-init-array if no gcc installation is found.

clang currently uses .init_array instead of .ctors on Linux if it detects gcc
4.7+. Make it so that it also uses .init_array if no gcc installation is found
at all – if there's no old gcc, there's nothing we need to be compatible with.

icecc for example runs clang in a very small chroot, so before this change
clang would use .ctors if run under icecc. And lld currently silently mislinks
inputs with .ctors sections, so before this clang + icecc + lld would produce
broken binaries. (But this seems like a good change independent of that lld
bug.)

https://reviews.llvm.org/D39317

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

7 years ago[X86] Make -march=i686 an alias of -march=pentiumpro
Craig Topper [Thu, 26 Oct 2017 23:06:19 +0000 (23:06 +0000)]
[X86] Make -march=i686 an alias of -march=pentiumpro

I think the only reason they are different is because we don't set tune_i686 for -march=i686 to match GCC. But GCC 4.9.0 seems to have changed this behavior and they do set it now. So I think they can aliases now.

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

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

7 years ago[X86][Driver] Move all of the X86 feature flags to one spot in the Options.td file...
Craig Topper [Thu, 26 Oct 2017 21:28:33 +0000 (21:28 +0000)]
[X86][Driver] Move all of the X86 feature flags to one spot in the Options.td file and pair them up with their negations.

It looks like at one time Options.td was in alphabetical order, but that looks to have long been broken. The result is that it all the no- x86 options got separated from their other friends for no good reason.

This patch puts them all together in one place with the no- paired with its none negated version.

I've kept all the SSE and AVX/AVX512 bits together since they represent a somewhat linear progression of features. The rest I just put in alphabetical order after.

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

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

7 years ago[CGBlocks] Improve line info in backtraces containing *_helper_block
Vedant Kumar [Thu, 26 Oct 2017 21:27:24 +0000 (21:27 +0000)]
[CGBlocks] Improve line info in backtraces containing *_helper_block

Instead of only setting a non-zero debug location on the return
instruction in *_helper_block functions, set a proper location on all
instructions within these functions. Pick the start location of the
block literal expr for maximum clarity.

The debugger does not step into *_helper_block functions during normal
single-stepping because we mark their parameters as artificial. This is
what we want (the functions are implicitly generated and uninteresting
to most users). The stepping behavior is unchanged by this patch.

rdar://32907581

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

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

7 years ago[www] Regenerate diagnostics reference.
Richard Smith [Thu, 26 Oct 2017 21:06:52 +0000 (21:06 +0000)]
[www] Regenerate diagnostics reference.

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

7 years agoFix C++ testcase I forgot to add to r316689.
Adrian Prantl [Thu, 26 Oct 2017 20:16:03 +0000 (20:16 +0000)]
Fix C++ testcase I forgot to add to r316689.

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

7 years agoSimplify codegen and debug info generation for block context parameters.
Adrian Prantl [Thu, 26 Oct 2017 20:08:52 +0000 (20:08 +0000)]
Simplify codegen and debug info generation for block context parameters.

The exisiting code goes out of its way to put block parameters into an
alloca only at -O0, and then describes the funciton argument with a
dbg.declare, which is undocumented in the LLVM-CFE contract and does
not actually behave as intended after LLVM r642022.

This patch just generates the alloca unconditionally, the mem2reg pass
will eliminate it at -O1 and up anyway and points the dbg.declare to
the alloca as intended (which mem2reg will then correctly rewrite into
a dbg.value).

This reapplies r316684 with some dead code removed.

rdar://problem/35043980

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

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

7 years ago[Analyzer] [Tests] Write analyzers crashes to stdout, and not to a separate file
George Karpenkov [Thu, 26 Oct 2017 19:00:22 +0000 (19:00 +0000)]
[Analyzer] [Tests] Write analyzers crashes to stdout, and not to a separate file

With this change it would be sufficient to look at CI console to see the
failure.

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

7 years agoRevert "Simplify codegen and debug info generation for block context parameters."
Adrian Prantl [Thu, 26 Oct 2017 18:32:16 +0000 (18:32 +0000)]
Revert "Simplify codegen and debug info generation for block context parameters."

This reverts commit r316684 while investigating buildbot breakage.

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

7 years agoSimplify codegen and debug info generation for block context parameters.
Adrian Prantl [Thu, 26 Oct 2017 18:16:05 +0000 (18:16 +0000)]
Simplify codegen and debug info generation for block context parameters.

The exisiting code goes out of its way to put block parameters into an
alloca only at -O0, and then describes the funciton argument with a
dbg.declare, which is undocumented in the LLVM-CFE contract and does
not actually behave as intended after LLVM r642022.

This patch just generates the alloca unconditionally, the mem2reg pass
will eliminate it at -O1 and up anyway and points the dbg.declare to
the alloca as intended (which mem2reg will then correctly rewrite into
a dbg.value).

rdar://problem/35043980

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

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

7 years ago[X86] Add a target attribute test for no-sse4.
Craig Topper [Thu, 26 Oct 2017 17:54:22 +0000 (17:54 +0000)]
[X86] Add a target attribute test for no-sse4.

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

7 years agoMove MS inline asm parser methods out of line to reduce indentation, NFC
Reid Kleckner [Thu, 26 Oct 2017 17:07:48 +0000 (17:07 +0000)]
Move MS inline asm parser methods out of line to reduce indentation, NFC

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

7 years agoAdd objcCategoryImplDecl matcher
Dave Lee [Thu, 26 Oct 2017 15:53:37 +0000 (15:53 +0000)]
Add objcCategoryImplDecl matcher

Summary:
Add `objcCategoryImplDecl` which matches ObjC category definitions
(`@implementation`). This matcher complements `objcCategoryDecl` (`@interface`)
which was added in D30854.

Reviewers: aaron.ballman, malcolm.parsons, alexshap

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits

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

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

7 years ago[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.
Roman Lebedev [Thu, 26 Oct 2017 13:18:14 +0000 (13:18 +0000)]
[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.

Summary:
The warning was initially introduced in D32914 by @thakis,
and the concerns were raised there, and later in rL302247
and PR33771.

I do believe that it makes sense to relax the diagnostic
e.g. in this case, when the expression originates from the
system header, which can not be modified. This prevents
adoption for the diagnostic for codebases which use pthreads
(`PTHREAD_MUTEX_INITIALIZER`), gtest, etc.

As @malcolm.parsons suggests, it *may* make sense to also
not warn for the template types, but it is not obvious to
me how to do that in here.

Though, it still makes sense to complain about `NULL` macro.

While there, add more tests.

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

Reviewed By: thakis

Subscribers: Rakete1111, hans, cfe-commits, thakis, malcolm.parsons

Tags: #clang

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

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

7 years agoTry to fix warnings and windows test failures caused by r316653
Eric Liu [Thu, 26 Oct 2017 13:09:50 +0000 (13:09 +0000)]
Try to fix warnings and windows test failures caused by r316653

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

7 years agoAdd a new attribute definition spelling, Clang<"attr">, that expands to two attribute...
Aaron Ballman [Thu, 26 Oct 2017 12:19:02 +0000 (12:19 +0000)]
Add a new attribute definition spelling, Clang<"attr">, that expands to two attribute spellings: GNU<"attr"> and CXX11<"clang", "attr">. This is similar to how the GCC spelling works and is intended to be used for attributes introduced for Clang.

Changes all existing attributes that currently use GNU<"attr"> and CXX11<"clang", "attr> spellings to instead use the Clang<"attr"> spelling.

No additional tests are necessary because the existing tests already use both spellings for the attributes converted to the new spelling. No functional changes are expected.

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

7 years ago[Tooling] A new framework for executing clang frontend actions.
Eric Liu [Thu, 26 Oct 2017 10:38:14 +0000 (10:38 +0000)]
[Tooling] A new framework for executing clang frontend actions.

Summary:
This defines a `clang::tooling::ToolExecutor` interface that can be extended to support different execution plans including standalone execution on a given set of TUs or parallel execution on all TUs in a codebase.

In order to enable multiprocessing execution, tool actions are expected to output result into a `ToolResults` interface provided by executors. The `ToolResults` interface abstracts how results are stored e.g. in-memory for standalone executions or on-disk for large-scale execution.

New executors can be registered as `ToolExecutorPlugin`s via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments.

This patch also implements `StandaloneToolExecutor` which has the same behavior as the current `ClangTool` interface, i.e. execute frontend actions on a given set of TUs. At this point, it's simply a wrapper around `ClangTool` at this point.

This is still experimental but expected to replace the existing `ClangTool` interface so that specific tools would not need to worry about execution.

Reviewers: klimek, arphaman, hokein, sammccall

Reviewed By: klimek

Subscribers: cfe-commits, djasper, mgorny, omtcyfz

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

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

7 years agoFix overloaded static functions in SemaCodeComplete
Benjamin Kramer [Thu, 26 Oct 2017 08:41:28 +0000 (08:41 +0000)]
Fix overloaded static functions in SemaCodeComplete

https://bugs.llvm.org/show_bug.cgi?id=33904
Happens when static function is accessed via the class variable. That leads to incorrect overloads number because the variable is considered as the first argument.

struct Bar {
  static void foo(); static void foo(int);
};

int main() {
  Bar b;
  b.foo(/*complete here*/); // did not work before
  Bar::foo(/*complete here*/); // worked fine
}

Patch by Ivan Donchevskii!

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

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

7 years ago[LSan] Enable -fsanitize=leak for PPC64 Linux.
Alex Shlyapnikov [Thu, 26 Oct 2017 03:09:53 +0000 (03:09 +0000)]
[LSan] Enable -fsanitize=leak for PPC64 Linux.

Summary: .

Reviewers: eugenis

Subscribers: cfe-commits

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

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

7 years ago[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different...
George Karpenkov [Thu, 26 Oct 2017 01:13:22 +0000 (01:13 +0000)]
[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different results

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

7 years agoAllow StmtPrinter to supress implicit 'this' and 'self' base expressions
Alex Lorenz [Thu, 26 Oct 2017 00:56:54 +0000 (00:56 +0000)]
Allow StmtPrinter to supress implicit 'this' and 'self' base expressions

This will be useful for certain refactoring actions.

rdar://34202062

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

7 years agoHandle PragmaDebug in PPChainedCallbacks
Alex Lorenz [Wed, 25 Oct 2017 22:01:23 +0000 (22:01 +0000)]
Handle PragmaDebug in PPChainedCallbacks

The test is in clang-tools-extra/test/pp-trace

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

7 years ago[Analyzer] [Tests] Do not discard output from CmpRuns.py when running integration...
George Karpenkov [Wed, 25 Oct 2017 21:49:46 +0000 (21:49 +0000)]
[Analyzer] [Tests] Do not discard output from CmpRuns.py when running integration tests

Contrary to the deleted comment, in most cases CmpRuns.py produces a
fairly small amount of output, which is useful to see straight away to
see what has changed when executing the integration tests.

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

7 years ago[Analyzer] Give more descriptive name to BdyFrm field.
George Karpenkov [Wed, 25 Oct 2017 21:49:41 +0000 (21:49 +0000)]
[Analyzer] Give more descriptive name to BdyFrm field.

Discussion at: https://reviews.llvm.org/D39220

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

7 years ago[CUDA] Print an error if you try to compile with < sm_30 on CUDA 9.
Justin Lebar [Wed, 25 Oct 2017 21:32:06 +0000 (21:32 +0000)]
[CUDA] Print an error if you try to compile with < sm_30 on CUDA 9.

Summary:
CUDA 9's minimum sm is sm_30.

Ideally we should also make sm_30 the default when compiling with CUDA
9, but that seems harder than it should be.

Subscribers: sanjoy

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

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

7 years agoEnable -pie and --enable-new-dtags by default on Android.
Evgeniy Stepanov [Wed, 25 Oct 2017 20:39:22 +0000 (20:39 +0000)]
Enable -pie and --enable-new-dtags by default on Android.

Summary:
Also enable -no-pie on Gnu toolchain (previously available on Darwin only).

Non-PIE executables won't even start on recent Android, and DT_RPATH is ignored by the loader.

Reviewers: srhines, danalbert

Subscribers: cfe-commits

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

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

7 years agoIgnore implicity casts for zero-as-null-pointer-constant warning
Erich Keane [Wed, 25 Oct 2017 20:23:13 +0000 (20:23 +0000)]
Ignore implicity casts for zero-as-null-pointer-constant warning

The repro in https://bugs.llvm.org/show_bug.cgi?id=34362
caused the left nullptr to be cast to a int* implicitly, which
resulted diagnosing this falsely.

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

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

7 years agoCodeGen: fix PPC Darwin variadics
Saleem Abdulrasool [Wed, 25 Oct 2017 17:56:50 +0000 (17:56 +0000)]
CodeGen: fix PPC Darwin variadics

Darwin uses char * for the variadic list type (va_list).  We use the PPC
SVR4 ABI for PPC, which uses a structure type for the va_list.  When
constructing the GEP, we would fail due to the incorrect handling for
the va_list.  Correct this to use the right type.

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

7 years ago[X86] Add avx512vpopcntdq to Knights Mill
Craig Topper [Wed, 25 Oct 2017 17:10:58 +0000 (17:10 +0000)]
[X86] Add avx512vpopcntdq to Knights Mill

As indicated by Table 1-1 in Intel Architecture Instruction Set Extensions and Future Features Programming Reference from October 2017.

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

7 years ago[OPENMP] Improve debug info for taskgroup implicitly generated
Alexey Bataev [Wed, 25 Oct 2017 15:54:04 +0000 (15:54 +0000)]
[OPENMP] Improve debug info for taskgroup implicitly generated
expressions.

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

7 years ago[OPENMP] Constify function parameters, NFC.
Alexey Bataev [Wed, 25 Oct 2017 15:44:52 +0000 (15:44 +0000)]
[OPENMP] Constify function parameters, NFC.

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

7 years agoAdd support of the next Debian (Debian buster - version 10)
Sylvestre Ledru [Wed, 25 Oct 2017 14:25:28 +0000 (14:25 +0000)]
Add support of the next Debian (Debian buster - version 10)

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

7 years agoAlso update IsUbuntu() with Ubuntu Bionic
Sylvestre Ledru [Wed, 25 Oct 2017 14:23:27 +0000 (14:23 +0000)]
Also update IsUbuntu() with Ubuntu Bionic
Follow up of r316577

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

7 years agoAdd support of the next Ubuntu (Ubuntu 18.04 - Bionic Beaver)
Sylvestre Ledru [Wed, 25 Oct 2017 14:21:33 +0000 (14:21 +0000)]
Add support of the next Ubuntu (Ubuntu 18.04 - Bionic Beaver)

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

7 years ago[rename] support renaming class member.
Haojian Wu [Wed, 25 Oct 2017 11:54:45 +0000 (11:54 +0000)]
[rename] support renaming class member.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, mgorny

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

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

7 years ago[clang-rename] Fix and enable the failing TemplatedClassFunction test.
Haojian Wu [Wed, 25 Oct 2017 08:25:25 +0000 (08:25 +0000)]
[clang-rename] Fix and enable the failing TemplatedClassFunction test.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits

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

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

7 years agoCodeGen: fix a case of incorrect checks for ivars
Saleem Abdulrasool [Wed, 25 Oct 2017 03:58:15 +0000 (03:58 +0000)]
CodeGen: fix a case of incorrect checks for ivars

Ensure that we check the ivar containing decl for the DLL storage
attribute rather than the ivar itself as the dll storage is associated
to the interface decl not the ivar decl.

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

7 years ago[CMake] Build host builtins in Fuchsia toolchain even on Darwin
Petr Hosek [Wed, 25 Oct 2017 02:35:22 +0000 (02:35 +0000)]
[CMake] Build host builtins in Fuchsia toolchain even on Darwin

This is nedeeded for the toolchain to be actually usable as a host
toolchain on Darwin.

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

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

7 years ago[CMake] Include clang-refactor in Fuchsia toolchain
Petr Hosek [Wed, 25 Oct 2017 02:31:38 +0000 (02:31 +0000)]
[CMake] Include clang-refactor in Fuchsia toolchain

This includes the clang-refactor in the toolchain distribution.

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

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

7 years ago[clang-refactor] Use add_clang_tool CMake template
Petr Hosek [Wed, 25 Oct 2017 01:11:27 +0000 (01:11 +0000)]
[clang-refactor] Use add_clang_tool CMake template

This allows including clang-refactor in LLVM_DISTRIBUTION_COMPONENTS
to build clang-refactor as part of the toolchain distribution.

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

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

7 years ago[Analyzer] Remove spaces inside comments mentioning the parameter name,
George Karpenkov [Wed, 25 Oct 2017 00:03:45 +0000 (00:03 +0000)]
[Analyzer] Remove spaces inside comments mentioning the parameter name,

to aid clang-tidy comprehension.
Requested by @alexfh in https://reviews.llvm.org/D39015

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

7 years ago[Analyzer] Remove unnecessary semicolon in analyzer tests.
George Karpenkov [Wed, 25 Oct 2017 00:03:45 +0000 (00:03 +0000)]
[Analyzer] Remove unnecessary semicolon in analyzer tests.

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

7 years ago[Analyzer] Store BodyFarm in std::unique_ptr
George Karpenkov [Tue, 24 Oct 2017 23:53:19 +0000 (23:53 +0000)]
[Analyzer] Store BodyFarm in std::unique_ptr

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

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

7 years ago[Analyzer] [Tests] Minor refactor of testing infrastructure:
George Karpenkov [Tue, 24 Oct 2017 23:52:48 +0000 (23:52 +0000)]
[Analyzer] [Tests] Minor refactor of testing infrastructure:

Move utilities functions into a separate file to make comprehension
easier.

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

7 years ago[Analyzer] [Tests] Remove temporary fields from generated reference results.
George Karpenkov [Tue, 24 Oct 2017 23:52:46 +0000 (23:52 +0000)]
[Analyzer] [Tests] Remove temporary fields from generated reference results.

Pointer to HTML diagnostics is removed (as it is not stored) as well as
the version (as it would be available from the commit message).

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

7 years ago[Sema][ObjC] Look for either objc_bridge or objc_bridge_mutable when
Akira Hatanaka [Tue, 24 Oct 2017 23:38:14 +0000 (23:38 +0000)]
[Sema][ObjC] Look for either objc_bridge or objc_bridge_mutable when
determining whether a RecordDecl is CFError.

CFErrorRef used to be declared with "objc_bridge(NSError)" but is now
declared with "objc_bridge_mutable(NSError)". Look for either when
checking whether a RecordDecl is CFError.

rdar://problem/35034779

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

7 years agoCorrect behavior of fastcall when default CC is set.
Erich Keane [Tue, 24 Oct 2017 23:12:01 +0000 (23:12 +0000)]
Correct behavior of fastcall when default CC is set.

Fastcall doesn't support variadic function calls, so
setting the default calling convention to Fastcall would
result in incorrect code being emitted for these conditions.

This patch adds a 'variadic' test to the default calling conv
test, as well as fixes the behavior of fastcall.

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

7 years ago[Analyzer] Fix bug in testing scripts, which always marked result as failure.
George Karpenkov [Tue, 24 Oct 2017 22:24:13 +0000 (22:24 +0000)]
[Analyzer] Fix bug in testing scripts, which always marked result as failure.

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

7 years agoReplaced unicode characters with ASCII, as introduced in r316518.
Erich Keane [Tue, 24 Oct 2017 22:00:25 +0000 (22:00 +0000)]
Replaced unicode characters with ASCII, as introduced in r316518.

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

7 years agomplement __has_unique_object_representations
Erich Keane [Tue, 24 Oct 2017 21:31:50 +0000 (21:31 +0000)]
mplement __has_unique_object_representations

A helper builtin to facilitate implementing the
std::has_unique_object_representations type trait.

Requested here: https://bugs.llvm.org/show_bug.cgi?id=34942
Also already exists in GCC and MSVC.

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

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

7 years ago[Sema] Document+test the -Wsign-compare change for enums in C code [NFC]
Roman Lebedev [Tue, 24 Oct 2017 21:05:43 +0000 (21:05 +0000)]
[Sema] Document+test the -Wsign-compare change for enums in C code [NFC]

rL316268 / D39122 has fixed PR35009, and now when in C,
these three(?) diagnostics properly use the enum's underlying
datatype.

While it was fixed, the test coverage was clearly insufficient,
because the -Wsign-compare change didn't show up in any of the
tests, until it was reported in the post-commit mail for rL316268.

So add the test for the -Wsign-compare diagnostic for enum
for C code, and while there, document this in the release notes.

The fix itself was obviously correct, so unless we want to silence
this new diagnosed case, i deem this commit to be NFC.

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

7 years ago[OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.
Alexey Bataev [Tue, 24 Oct 2017 19:52:31 +0000 (19:52 +0000)]
[OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.

Fixed passing of VLAs and variably-modified types to outlined functions.
Synchronized passing with the types codegen.

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

7 years agoCodeGen: Fix missing debug loc due to alloca
Yaxun Liu [Tue, 24 Oct 2017 19:14:43 +0000 (19:14 +0000)]
CodeGen: Fix missing debug loc due to alloca

Builder save/restores insertion pointer when emitting addr space cast
for alloca, but does not save/restore debug loc, which causes verifier
failure for certain call instructions.

This patch fixes that.

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

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

7 years agoAdd missing clangRewrite lib dependency for clangToolingRefactor
Alex Lorenz [Tue, 24 Oct 2017 17:23:53 +0000 (17:23 +0000)]
Add missing clangRewrite lib dependency for clangToolingRefactor

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

7 years ago[refactor] Initial outline of implementation of "extract function" refactoring
Alex Lorenz [Tue, 24 Oct 2017 17:18:45 +0000 (17:18 +0000)]
[refactor] Initial outline of implementation of "extract function" refactoring

This commit adds an initial, skeleton outline of the "extract function"
refactoring. The extracted function doesn't capture variables / rewrite code
yet, it just basically does a simple copy-paste.
The following initiation rules are specified:

- extraction can only be done for executable code in a function/method/block.
  This means that you can't extract a global variable initialize into a function
  right now.
- simple literals and references are not extractable.

This commit also adds support for full source ranges to clang-refactor's test
mode.

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

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

7 years ago[code completion] Complete ObjC methods in @implementation without leading
Alex Lorenz [Tue, 24 Oct 2017 16:39:37 +0000 (16:39 +0000)]
[code completion] Complete ObjC methods in @implementation without leading
'-'/'+' prefix

rdar://12040840

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

7 years agoRemove repeated function name in doxygen comment.
Erich Keane [Tue, 24 Oct 2017 16:16:34 +0000 (16:16 +0000)]
Remove repeated function name in doxygen comment.

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

7 years agoFix spelling in comment, field is isMsStruct, not Strust
Erich Keane [Tue, 24 Oct 2017 15:34:59 +0000 (15:34 +0000)]
Fix spelling in comment, field is isMsStruct, not Strust

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

7 years ago[modules] Add a regression test for merging anon decls in extern C contexts.
Vassil Vassilev [Tue, 24 Oct 2017 14:52:35 +0000 (14:52 +0000)]
[modules] Add a regression test for merging anon decls in extern C contexts.

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

7 years agoAdd Forgotten test for: Fix template parameter default args missed if redecled
Erich Keane [Tue, 24 Oct 2017 13:51:07 +0000 (13:51 +0000)]
Add Forgotten test for: Fix template parameter default args missed if redecled

Addendum to differential revision: https://reviews.llvm.org/D39127

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

7 years agoDo not add a colon chunk to the code completion of class inheritance access modifiers
Erik Verbruggen [Tue, 24 Oct 2017 13:46:58 +0000 (13:46 +0000)]
Do not add a colon chunk to the code completion of class inheritance access modifiers

With enabled CINDEXTEST_CODE_COMPLETE_PATTERNS env option (which enables
IncludeCodePatterns in completion options) code completion after colon
currently suggests access modifiers with 2 completion chunks which is
incorrect.

Example:
class A : <Cursor>B
{
}

Currently we get 'NotImplemented:{TypedText public}{Colon :} (40)'
but the correct line is just 'NotImplemented:{TypedText public} (40)'

The fix introduces more specific scope that occurs between ':' and '{'
It allows us to determine when we don't need to add ':' as a second
chunk to the public/protected/private access modifiers.

Patch by Ivan Donchevskii!

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

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

7 years ago[Tooling] Add a factory method for CommonOptionsParser
Eric Liu [Tue, 24 Oct 2017 13:10:58 +0000 (13:10 +0000)]
[Tooling] Add a factory method for CommonOptionsParser

Summary: This returns error instead of exiting the program in case of error.

Reviewers: klimek, hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

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

7 years ago[AArch64] Fix PR34625 -mtune without -mcpu should not set -target-cpu
Peter Smith [Tue, 24 Oct 2017 09:51:55 +0000 (09:51 +0000)]
[AArch64] Fix PR34625 -mtune without -mcpu should not set -target-cpu

When -mtune is used on AArch64 the -target-cpu is passed the value of the
cpu given to -mtune. As well as setting micro-architectural features of the
-mtune cpu, this will also add the architectural features such as support
for instructions. This can result in the backend using instructions that
are supported in the -mtune cpu but not supported in the target
architecture. For example use of the v8.1-a LSE extensions with -march=v8.

This change removes the setting of -target-cpu for -mtune, the -mcpu must
be used to set -target-cpu. This has the effect of removing all non-hard
coded benefits of mtune but it does produce correct output when -mtune cpu
with a later architecture than v8 is used.

Fixes PR34625

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

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

7 years ago[test] Fix clang-test for FreeBSD and NetBSD
Tim Shen [Tue, 24 Oct 2017 03:11:02 +0000 (03:11 +0000)]
[test] Fix clang-test for FreeBSD and NetBSD

Lit tries to inject the shared library paths, but no action is taken
when platform.system() is not recognized, results in an environment
variable with an empty name, which is illegal.

The patch fixes this mechanism for FreeBSD and NetBSD, and gives an
warning on other platforms, so that the latecomers don't have to spend
time on debugging lit.

Thanks Zhihao Yuan for the patch!

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

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

7 years agoUnnamed bitfields don't block constant evaluation of constexpr ctors
Jordan Rose [Tue, 24 Oct 2017 02:17:07 +0000 (02:17 +0000)]
Unnamed bitfields don't block constant evaluation of constexpr ctors

C++14 [dcl.constexpr]p4 states that in the body of a constexpr
constructor,

> every non-variant non-static data member and base class sub-object
  shall be initialized

However, [class.bit]p2 notes that

> Unnamed bit-fields are not members and cannot be initialized.

Therefore, we should make sure to filter them out of the check that
all fields are initialized.

Fixing this makes the constant evaluator a bit smarter, and
specifically allows constexpr constructors to avoid tripping
-Wglobal-constructors when the type contains unnamed bitfields.

Reviewed at https://reviews.llvm.org/D39035.

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

7 years agoFix template parameter default args missed if redecled
Erich Keane [Tue, 24 Oct 2017 01:39:56 +0000 (01:39 +0000)]
Fix template parameter default args missed if redecled

This bug was found via self-build on lld, and worked around
here: https://reviews.llvm.org/rL316180

The issue is that the 'using' causes the lookup to pick up the
first decl. However, when setting inherited default parameters,
we only update 'forward', not 'backward'. SO, only the newest param
list has all the information about the default arguments.

This patch ensures that the list of parameters we look through checks
the newest decl's template parameter list so it doesn't miss a default.

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

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

7 years ago[Analyzer] Fix for the memory leak: fix typo in if-statement.
George Karpenkov [Tue, 24 Oct 2017 01:09:43 +0000 (01:09 +0000)]
[Analyzer] Fix for the memory leak: fix typo in if-statement.

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

7 years ago[Analyzer] Handle implicit function reference in bodyfarming std::call_once
George Karpenkov [Tue, 24 Oct 2017 00:13:18 +0000 (00:13 +0000)]
[Analyzer] Handle implicit function reference in bodyfarming std::call_once

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

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

7 years ago[Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp
George Karpenkov [Mon, 23 Oct 2017 23:59:52 +0000 (23:59 +0000)]
[Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp

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

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

7 years ago[analyzer] Fix handling of labels in getLValueElement
Alexander Shaposhnikov [Mon, 23 Oct 2017 23:46:06 +0000 (23:46 +0000)]
[analyzer] Fix handling of labels in getLValueElement

In getLValueElement Base may represent the address of a label
(as in the newly-added test case), in this case it's not a loc::MemRegionVal
and Base.castAs<loc::MemRegionVal>() triggers an assert, this diff makes
getLValueElement return UnknownVal instead.

Differential revision: https://reviews.llvm.org/D39174

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

7 years ago[Sema] Add support for flexible array members in Obj-C.
Volodymyr Sapsai [Mon, 23 Oct 2017 22:01:41 +0000 (22:01 +0000)]
[Sema] Add support for flexible array members in Obj-C.

Allow Obj-C ivars with incomplete array type but only as the last ivar.
Also add a requirement for ivars that contain a flexible array member to
be at the end of class too. It is possible to add in a subclass another
ivar at the end but we'll emit a warning in this case. Also we'll emit a
warning if a variable sized ivar is declared in class extension or in
implementation because subclasses won't know they should avoid adding
new ivars.

In ARC incomplete array objects are treated as __unsafe_unretained so
require them to be marked as such.

Prohibit synthesizing ivars with flexible array members because order of
synthesized ivars is not obvious and tricky to control. Spelling out
ivar explicitly gives control to developers and helps to avoid surprises
with unexpected ivar ordering.

For C and C++ changed diagnostic to tell explicitly a field is not the
last one and point to the next field. It is not as useful as in Obj-C
but it is an improvement and it is consistent with Obj-C. For C for
unions emit more specific err_flexible_array_union instead of generic
err_field_incomplete.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

7 years ago[Driver] Use ld.lld directly for Fuchsia rather than passing flavor
Petr Hosek [Mon, 23 Oct 2017 21:31:05 +0000 (21:31 +0000)]
[Driver] Use ld.lld directly for Fuchsia rather than passing flavor

Passing a flavor to LLD requires command line argument, but if these
are being passed through a response file, this will fail because LLD
needs to know which driver to use before processing the response file.
Use ld.lld directly instead to avoid this issue.

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

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

7 years ago[OpenMP] Avoid VLAs for some reductions on array sections
Jonas Hahnfeld [Mon, 23 Oct 2017 19:01:35 +0000 (19:01 +0000)]
[OpenMP] Avoid VLAs for some reductions on array sections

In some cases the compiler can deduce the length of an array section
as constants. With this information, VLAs can be avoided in place of
a constant sized array or even a scalar value if the length is 1.
Example:
int a[4], b[2];
pragma omp parallel reduction(+: a[1:2], b[1:1])
{ }

For chained array sections, this optimization is restricted to cases
where all array sections except the last have a constant length 1.
This trivially guarantees that there are no holes in the memory region
that needs to be privatized.
Example:
int c[3][4];
pragma omp parallel reduction(+: c[1:1][1:2])
{ }

This relands commit r316229 that I reverted in r316235 because it
failed on some bots. During investigation I found that this was because
Clang and GCC evaluate the two arguments to emplace_back() in
ReductionCodeGen::emitSharedLValue() in a different order, hence
leading to a different order of generated instructions in the final
LLVM IR. Fix this by passing in the arguments from temporary variables
that are evaluated in a defined order.

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

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

7 years agoCodeGen: Fix invalid bitcast in partial initialization of automatic arrary variable
Yaxun Liu [Mon, 23 Oct 2017 17:49:26 +0000 (17:49 +0000)]
CodeGen: Fix invalid bitcast in partial initialization of automatic arrary variable

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

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

7 years ago[ASTMatchers] Expose forEachOverriden in dynamic AST matchers.
Benjamin Kramer [Mon, 23 Oct 2017 16:48:46 +0000 (16:48 +0000)]
[ASTMatchers] Expose forEachOverriden in dynamic AST matchers.

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

7 years agoPull X86 "CPUKind" checking into .cpp file. [NFC]
Erich Keane [Mon, 23 Oct 2017 16:20:15 +0000 (16:20 +0000)]
Pull X86 "CPUKind" checking into .cpp file. [NFC]

Preparing to do a refactor of CPU/feature checking, this
patch pulls the one CPU implementation from the .h file
to the .cpp file.

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

7 years agoclang-cl: Expose --version.
Nico Weber [Mon, 23 Oct 2017 15:54:44 +0000 (15:54 +0000)]
clang-cl: Expose --version.

This is for consistency with lld-link, see https://reviews.llvm.org/D38972
Also give --version a help text so it shows up in --help / /? output (for
both clang-cl and regular clang).

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

7 years ago[rename] Don't overwrite the template argument when renaming a template function.
Haojian Wu [Mon, 23 Oct 2017 08:58:50 +0000 (08:58 +0000)]
[rename] Don't overwrite the template argument when renaming a template function.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cierpuchaw, cfe-commits, klimek

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

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

7 years agoFor better compatibility with C++11 and C++14, emit a nondiscardable definition
Richard Smith [Mon, 23 Oct 2017 03:58:34 +0000 (03:58 +0000)]
For better compatibility with C++11 and C++14, emit a nondiscardable definition
of a static constexpr data member if it's defined 'constexpr' out of line, not
only if it's defined 'constexpr' in the class.

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

7 years ago[c++2a] Update cxx_status w __VA_OPT__ marked as completed in SVN.
Faisal Vali [Sun, 22 Oct 2017 22:29:52 +0000 (22:29 +0000)]
[c++2a] Update cxx_status w __VA_OPT__ marked as completed in SVN.

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

7 years agoCreate fewer copies of StringMaps. No functionality change intended.
Benjamin Kramer [Sun, 22 Oct 2017 20:16:28 +0000 (20:16 +0000)]
Create fewer copies of StringMaps. No functionality change intended.

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

7 years ago[C++17] Fix PR34970 - tweak overload resolution for class template deduction-guides...
Faisal Vali [Sun, 22 Oct 2017 14:45:08 +0000 (14:45 +0000)]
[C++17] Fix PR34970 - tweak overload resolution for class template deduction-guides in line with WG21's p0620r0.

In order to identify the copy deduction candidate, I considered two approaches:
  - attempt to determine whether an implicit guide is a copy deduction candidate by checking certain properties of its subsituted parameter during overload-resolution.
  - using one of the many bits (WillHaveBody) from FunctionDecl (that CXXDeductionGuideDecl inherits from) that are otherwise irrelevant for deduction guides

After some brittle gymnastics w the first strategy, I settled on the second, although to avoid confusion and to give that bit a better name, i turned it into a member of an anonymous union.

Given this identification 'bit', the tweak to overload resolution was a simple reordering of the deduction guide checks (in SemaOverload.cpp::isBetterOverloadCandidate), in-line with Jason Merrill's p0620r0 drafting which made it into the working paper.  Concordant with that, I made sure the copy deduction candidate is always added.

References:
See https://bugs.llvm.org/show_bug.cgi?id=34970
See http://wg21.link/p0620r0

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

7 years agoReverting r316278 due to failing build bots.
Aaron Ballman [Sat, 21 Oct 2017 21:52:48 +0000 (21:52 +0000)]
Reverting r316278 due to failing build bots.

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/11896
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/12380

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

7 years ago[libclang, bindings]: add spelling location
Masud Rahman [Sat, 21 Oct 2017 20:53:49 +0000 (20:53 +0000)]
[libclang, bindings]: add spelling location

 o) Add a 'Location' class that represents the four properties of a
    physical location

 o) Enhance 'SourceLocation' to provide 'expansion' and 'spelling'
    locations, maintaining backwards compatibility with existing code by
    forwarding the four properties to 'expansion'.

 o) Update the implementation to use 'clang_getExpansionLocation'
    instead of the deprecated 'clang_getInstantiationLocation', which
    has been present since 2011.

 o) Update the implementation of 'clang_getSpellingLocation' to actually
    obtain spelling location instead of file location.

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

7 years agoFix a typo with -fno-double-square-bracket-attributes and add a test to demonstrate...
Aaron Ballman [Sat, 21 Oct 2017 20:28:58 +0000 (20:28 +0000)]
Fix a typo with -fno-double-square-bracket-attributes and add a test to demonstrate that it works as expected in C++11 mode. Additionally corrected the handling of -fdouble-square-bracket-attributes to be properly passed down to the cc1 option.

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

7 years agoAdd release notes for the recent -fdouble-square-bracket-attributes and -fno-double...
Aaron Ballman [Sat, 21 Oct 2017 16:45:08 +0000 (16:45 +0000)]
Add release notes for the recent -fdouble-square-bracket-attributes and -fno-double-square-bracket-attributes compiler flags.

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

7 years ago[Sema] Fixes for enum handling for tautological comparison diagnostics
Roman Lebedev [Sat, 21 Oct 2017 16:44:03 +0000 (16:44 +0000)]
[Sema] Fixes for enum handling for tautological comparison diagnostics

Summary:
As Mattias Eriksson has reported in PR35009, in C, for enums, the underlying type should
be used when checking for the tautological comparison, unlike C++, where the enumerator
values define the value range. So if not in CPlusPlus mode, use the enum underlying type.

Also, i have discovered a problem (a crash) when evaluating tautological-ness of the following comparison:
```
enum A { A_a = 0 };
if (a < 0) // expected-warning {{comparison of unsigned enum expression < 0 is always false}}
return 0;
```
This affects both the C and C++, but after the first fix, only C++ code was affected.
That was also fixed, while preserving (i think?) the proper diagnostic output.

And while there, attempt to enhance the test coverage.
Yes, some tests got moved around, sorry about that :)

Fixes PR35009

Reviewers: aaron.ballman, rsmith, rjmccall

Reviewed By: aaron.ballman

Subscribers: Rakete1111, efriedma, materi, cfe-commits

Tags: #clang

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

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

7 years agoFixing broken attribute documentation for __attribute__((noescape)); a code block...
Aaron Ballman [Sat, 21 Oct 2017 16:43:01 +0000 (16:43 +0000)]
Fixing broken attribute documentation for __attribute__((noescape)); a code block was missing and the existing code block was missing a mandatory newline.

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