]> granicus.if.org Git - clang/log
clang
6 years ago[CMake] Use #cmakedefine01 for CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER)
NAKAMURA Takumi [Wed, 18 Oct 2017 05:21:17 +0000 (05:21 +0000)]
[CMake] Use #cmakedefine01 for CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER)

It'd be better that they are #cmakedefine01 rather than #cmakedefine.
(#if FOO rather than #if defined(FOO))
Then we can find missing #include "clang/Config/config.h" in the future.

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

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

6 years agoProvide a flag group to turn on/off all "binary literals" extension warnings.
Richard Smith [Wed, 18 Oct 2017 02:19:24 +0000 (02:19 +0000)]
Provide a flag group to turn on/off all "binary literals" extension warnings.

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

6 years ago[modules] When finding the owning module of an instantiated context in template
Richard Smith [Wed, 18 Oct 2017 01:41:38 +0000 (01:41 +0000)]
[modules] When finding the owning module of an instantiated context in template
instantiation, follow lexical parents not semantic ones: we want to find the
module where the pattern was written.

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

6 years ago[CMake] Build Fuchsia toolchain as -O3
Petr Hosek [Wed, 18 Oct 2017 01:27:54 +0000 (01:27 +0000)]
[CMake] Build Fuchsia toolchain as -O3

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

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

6 years agoBasic: fix __{,U}INTPTR_TYPE__ on ARM
Saleem Abdulrasool [Wed, 18 Oct 2017 00:00:50 +0000 (00:00 +0000)]
Basic: fix __{,U}INTPTR_TYPE__ on ARM

Darwin and OpenBSD are the only platforms which use `long int` for
`__INTPTR_TYPE__`.  The other platforms use `int` in 32-bit, and `long
int` on 64-bit (except for VMS and Windows which are LLP64).  Adjust the
type definitions to match the platform definitions.  We now generate the
same definition as GCC on all the targets.

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

6 years agoResubmit "[lit] Raise the logic for enabling clang & lld substitutions to llvm."
Zachary Turner [Tue, 17 Oct 2017 23:43:36 +0000 (23:43 +0000)]
Resubmit "[lit] Raise the logic for enabling clang & lld substitutions to llvm."

The substitution for %debuginfo_tests had been inadvertently removed.
This adds it back.

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

6 years agoBasic: fix `__INTPTR_TYPE__` for Windows ARM
Saleem Abdulrasool [Tue, 17 Oct 2017 22:49:53 +0000 (22:49 +0000)]
Basic: fix `__INTPTR_TYPE__` for Windows ARM

The `IntPtrType` for Windows ARM should be `int` as per MSVC.  Adjust
the type accordingly.

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

6 years ago[Analyzer] Always use non-reference types when creating expressions in BodyFarm.
George Karpenkov [Tue, 17 Oct 2017 22:28:18 +0000 (22:28 +0000)]
[Analyzer] Always use non-reference types when creating expressions in BodyFarm.

Remove an option to use a reference type (on by default!) since a
non-reference type is always needed for creating expressions, functions
with multiple boolean parameters are very hard to use, and in general it
was just a booby trap for further crashes.
Furthermore, generalize call_once test case to fix some of the crashes mentioned
https://bugs.llvm.org/show_bug.cgi?id=34869
Also removes std::call_once crash.

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

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

6 years agoFix PR34981, a crash-on-invalid merging dllimport to an invalid redecl.
Nico Weber [Tue, 17 Oct 2017 21:14:02 +0000 (21:14 +0000)]
Fix PR34981, a crash-on-invalid merging dllimport to an invalid redecl.

This is basically like r288207, just the other way round.

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

6 years ago[CFG] Relax Wexceptions warning on rethrow
Erich Keane [Tue, 17 Oct 2017 20:57:24 +0000 (20:57 +0000)]
[CFG] Relax Wexceptions warning on rethrow

As reported here: https://bugs.llvm.org/show_bug.cgi?id=34973

"catch(...)" should catch EVERYTHING, even a rethrow. This
patch changes the order in which things are checked to ensure
that a '...' catch will get a rethrow.

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

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

6 years agoThis test case was missing -fsyntax-only, so I've added it. NFC to the actual test...
Aaron Ballman [Tue, 17 Oct 2017 20:49:30 +0000 (20:49 +0000)]
This test case was missing -fsyntax-only, so I've added it. NFC to the actual test contents, just how the test is executed.

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

6 years agoEnable support for the [[nodiscard]] attribute from WG14 N2050 when enabling double...
Aaron Ballman [Tue, 17 Oct 2017 20:33:35 +0000 (20:33 +0000)]
Enable support for the [[nodiscard]] attribute from WG14 N2050 when enabling double square bracket attributes in C code.

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

6 years agoExpose ConsumeAnyToken interface to external clients.
Vassil Vassilev [Tue, 17 Oct 2017 19:38:57 +0000 (19:38 +0000)]
Expose ConsumeAnyToken interface to external clients.

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

6 years ago[OpenCL] Restrict swizzle length check to OpenCL mode
Bruno Cardoso Lopes [Tue, 17 Oct 2017 17:54:57 +0000 (17:54 +0000)]
[OpenCL] Restrict swizzle length check to OpenCL mode

Changes behavior introduced in r298369 to only error out on
vector component invalid length access on OpenCL mode.

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

rdar://problem/33568748

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

6 years agoReplace use of SmallVector::back + pop_back with pop_back_val
Erich Keane [Tue, 17 Oct 2017 17:45:21 +0000 (17:45 +0000)]
Replace use of SmallVector::back + pop_back with pop_back_val

I ran across an instance where the value was being loaded
out via back, then immediately popped.  Since pop_back_val
is more efficient at this (it moves out), replace this
instance.

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

6 years agoSema: use new `getNS{,U}IntegerType` for NS{,U}Integer
Saleem Abdulrasool [Tue, 17 Oct 2017 17:39:32 +0000 (17:39 +0000)]
Sema: use new `getNS{,U}IntegerType` for NS{,U}Integer

Use the new helper methods to get the underlying type for NSUInteger,
NSInteger types.  This avoids spreading the knowledge of the underlying
types in various sites.  For non-LLP64 targets, this has no change.

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

6 years ago[OPENMP] Fix capturing of boolean variables in debug mode.
Alexey Bataev [Tue, 17 Oct 2017 16:47:34 +0000 (16:47 +0000)]
[OPENMP] Fix capturing of boolean variables in debug mode.

If the variables is boolean and we generating inner function with real
types, the codegen may crash because of not loading boolean value from
memory.

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

6 years ago[OpenMP] Implement omp_is_initial_device() as builtin
Jonas Hahnfeld [Tue, 17 Oct 2017 14:28:14 +0000 (14:28 +0000)]
[OpenMP] Implement omp_is_initial_device() as builtin

This allows to return the static value that we know at compile time.

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

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

6 years agoCodeGen: Fix invalid bitcasts for atomic builtins
Yaxun Liu [Tue, 17 Oct 2017 14:19:29 +0000 (14:19 +0000)]
CodeGen: Fix invalid bitcasts for atomic builtins

Currently clang assumes the temporary variables emitted during
codegen of atomic builtins have address space 0, which
is not true for target triple amdgcn---amdgiz and causes invalid
bitcasts.

This patch fixes that.

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

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

6 years ago[clang-rename] Rename enum.
Haojian Wu [Tue, 17 Oct 2017 14:14:41 +0000 (14:14 +0000)]
[clang-rename] Rename enum.

Summary:
* Add unit tests for renaming enum.
* Support unscoped enum constants in expressions.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, mgorny, cfe-commits

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

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

6 years ago[CMake][OpenMP] Customize default offloading arch
Jonas Hahnfeld [Tue, 17 Oct 2017 13:37:36 +0000 (13:37 +0000)]
[CMake][OpenMP] Customize default offloading arch

For the shuffle instructions in reductions we need at least sm_30
but the user may want to customize the default architecture.

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

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

6 years ago[CodeGen] Refine generation of TBAA info for bit-field lvalues
Ivan A. Kosarev [Tue, 17 Oct 2017 11:20:19 +0000 (11:20 +0000)]
[CodeGen] Refine generation of TBAA info for bit-field lvalues

The main change is that now we generate TBAA info before
constructing the resulting lvalue instead of constructing lvalue
with some default TBAA info and fixing it as necessary
afterwards. We also keep the TBAA info close to lvalue base info,
which is supposed to simplify their future merging.

This patch should not bring in any functional changes.

This is part of D38126 reworked to be a separate patch to
simplify review.

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

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

6 years ago[CodeGen] Pass TBAA info along with lvalue base info everywhere
Ivan A. Kosarev [Tue, 17 Oct 2017 10:17:43 +0000 (10:17 +0000)]
[CodeGen] Pass TBAA info along with lvalue base info everywhere

This patch addresses the rest of the cases where we pass lvalue
base info, but do not provide corresponding TBAA info.

This patch should not bring in any functional changes.

This is part of D38126 reworked to be a separate patch to make
reviewing easier.

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

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

6 years ago[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Tue, 17 Oct 2017 09:12:13 +0000 (09:12 +0000)]
[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

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

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

6 years ago[Coverage] Discard deferred region in closing if-else
Vedant Kumar [Tue, 17 Oct 2017 07:47:39 +0000 (07:47 +0000)]
[Coverage] Discard deferred region in closing if-else

A trailing deferred region isn't necessary in a function that ends with
this pattern:

  ...
  else {
    ...
    return;
  }

Special-case this pattern so that the closing curly brace of the
function isn't marked as uncovered. This issue came up in PR34962.

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

6 years ago[Coverage] Explicitly mark the l.h.s of && and || (fixes PR33465)
Vedant Kumar [Tue, 17 Oct 2017 06:51:54 +0000 (06:51 +0000)]
[Coverage] Explicitly mark the l.h.s of && and || (fixes PR33465)

This makes it possible to view sub-line region counts for the l.h.s of
&& and || expressions in coverage reports.

It also fixes PR33465, which shows an example of incorrect coverage
output for an assignment statement containing '||'.

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

6 years agoBasic: make the nan family pure
Saleem Abdulrasool [Tue, 17 Oct 2017 03:30:25 +0000 (03:30 +0000)]
Basic: make the nan family pure

The nan family of math routines do not rely on global state.  They do
however depend on their parameter.  This fits the description of pure:
  Functions which have no effects except the return value and their
  return value depends only on the parameters and/or global variables.
Mark the family as `readonly`.

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

6 years ago[libclang] Add support for querying cursor availability
Jonathan Coe [Mon, 16 Oct 2017 23:46:02 +0000 (23:46 +0000)]
[libclang] Add support for querying cursor availability

Summary:
This patch allows checking the availability of cursors through libclang and clang.cindex (Python).
This e.g. allows to check whether a C++ member function has been marked as deleted.

Reviewers: arphaman, jbcoe

Reviewed By: jbcoe

Subscribers: cfe-commits

Tags: #clang

Patch by jklaehn (Johann Klähn)

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

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

6 years ago[libclang] Visit attributes for function and class templates
Jonathan Coe [Mon, 16 Oct 2017 23:43:02 +0000 (23:43 +0000)]
[libclang] Visit attributes for function and class templates

Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang.

Reviewers: bkramer, arphaman, rsmith, jbcoe

Reviewed By: jbcoe

Subscribers: cfe-commits

Tags: #clang

Patch by jklaehn (Johann Klähn)

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

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

6 years agoFix usage in TableGen of getValueAsString
Erich Keane [Mon, 16 Oct 2017 23:25:24 +0000 (23:25 +0000)]
Fix usage in TableGen of getValueAsString

Record::getValueAsString returns a stringref to an interned
string (apparently had been changed since most of tablegen was
written). In this patch, I audited the usage of getValueAsString
to find places where we can trivially stop storing 'std::string' and instead
keep the stringref.

There was one instance where an unnecessary 'stringstream' was being used,
so that has been removed as well to unblock the stringref replacing string fix.

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

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

6 years agoDon't print end-of-directive tokens in -E output
Reid Kleckner [Mon, 16 Oct 2017 23:07:15 +0000 (23:07 +0000)]
Don't print end-of-directive tokens in -E output

This comes up when pre-processing standalone .s files containing
hash-prefixed comments. The pre-processor should skip the unknown
directive and not emit an extra newline as we were doing.

Fixes PR34950

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

6 years agoMake __builtin_types_compatible_p more like GCC's
George Burgess IV [Mon, 16 Oct 2017 22:58:37 +0000 (22:58 +0000)]
Make __builtin_types_compatible_p more like GCC's

GCC ignore qualifiers on array types. Since we seem to have this
function primarily for GCC compatibility, we should try to match that
behavior.

This also adds a few more test-cases __builtin_types_compatible_p,
which were inspired by GCC's documentation on the builtin.

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

6 years agoReplace usage of std::stringstream with raw_string_ostream
Erich Keane [Mon, 16 Oct 2017 22:47:26 +0000 (22:47 +0000)]
Replace usage of std::stringstream with raw_string_ostream

Typically we don't use the stringstream, so instead use
raw_string_stream.  Additionally, the dependent function
changed to use raw_ostream.

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

6 years agoRemove AnyX86Interrupt documentation
Erich Keane [Mon, 16 Oct 2017 20:44:14 +0000 (20:44 +0000)]
Remove AnyX86Interrupt documentation

This documentation was copied directly from the GCC
documentaiton in r257867.  Reverting and alterting
the original author so that it can be rewritten in
copyright-safe language.

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

6 years agoSort Attributes by "HeaderName"
Erich Keane [Mon, 16 Oct 2017 20:31:05 +0000 (20:31 +0000)]
Sort Attributes by "HeaderName"

Attributes in the docs were previously sorted (apparently)
by the attribute name, so AnyX86Interrupt ended up being the
first one, rather than in a meaningful place. This resulted in the
4 'interrupt' titled sections being all in different places.

This replaces it with a naive alphabetical sort (case sensitive, underscore
and special characters first, etc).

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

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

6 years agoClarify the 'interrupt' names in Attribute Docs
Erich Keane [Mon, 16 Oct 2017 20:13:36 +0000 (20:13 +0000)]
Clarify the 'interrupt' names in Attribute Docs

All 4 of the 'interrupt' headers were automatically named
'interrupt'. This patch gives them unique names.

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

6 years ago[refactor] allow the use of refactoring diagnostics
Alex Lorenz [Mon, 16 Oct 2017 18:28:26 +0000 (18:28 +0000)]
[refactor] allow the use of refactoring diagnostics

This commit allows the refactoring library to use its own set of
refactoring-specific diagnostics to reports things like initiation errors.

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

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

6 years agoclang-refactor: Use llvm_unreachable in an unused override
Alex Lorenz [Mon, 16 Oct 2017 18:07:16 +0000 (18:07 +0000)]
clang-refactor: Use llvm_unreachable in an unused override

As suggested by David Blaikie!

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

6 years agoDo not link clang_rt.cfi on Android.
Evgeniy Stepanov [Mon, 16 Oct 2017 18:02:57 +0000 (18:02 +0000)]
Do not link clang_rt.cfi on Android.

Summary:
The OS provides cross-dso CFI support starting with Android O.
Trapping mode does not require any runtime at all, and diagnostic mode
requires just ubsan-standalone.

Reviewers: pcc

Subscribers: srhines, cfe-commits

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

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

6 years agoRecommit r315738 "[clang-refactor] Apply source replacements"
Alex Lorenz [Mon, 16 Oct 2017 17:31:16 +0000 (17:31 +0000)]
Recommit r315738 "[clang-refactor] Apply source replacements"

The fixed commit ensures that ParsedSourceRange works correctly
with Windows paths.

Original message:

This commit actually brings clang-refactor to a usable state as it can now
apply the refactoring changes to source files.
The -selection option is now also fully supported.

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

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

6 years ago[Bitfield] Add an option to access bitfield in a fine-grained manner.
Wei Mi [Mon, 16 Oct 2017 16:50:27 +0000 (16:50 +0000)]
[Bitfield] Add an option to access bitfield in a fine-grained manner.

Currently all the consecutive bitfields are wrapped as a large integer unless there is unamed zero sized bitfield in between. The patch provides an alternative manner which makes the bitfield to be accessed as separate memory location if it has legal integer width and is naturally aligned. Such separate bitfield may split the original consecutive bitfields into subgroups of consecutive bitfields, and each subgroup will be wrapped as an integer. Now This is all controlled by an option -ffine-grained-bitfield-accesses. The alternative of bitfield access manner can improve the access efficiency of those bitfields with legal width and being aligned, but may reduce the chance of load/store combining of other bitfields, so it depends on how the bitfields are defined and actually accessed to choose when to use the option. For now the option is off by default.

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

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

6 years ago[CUDA] Require libdevice only if needed
Jonas Hahnfeld [Mon, 16 Oct 2017 13:31:30 +0000 (13:31 +0000)]
[CUDA] Require libdevice only if needed

If the user passes -nocudalib, we can live without it being present.
Simplify the code by just checking whether LibDeviceMap is empty.

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

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

6 years ago[clang-rename] Add function unit tests.
Haojian Wu [Mon, 16 Oct 2017 10:37:42 +0000 (10:37 +0000)]
[clang-rename] Add function unit tests.

Summary:
Also contain a fix:

* Fix a false positive of renaming a using shadow function declaration.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, mgorny, cfe-commits

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

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

6 years ago[clang-format] Break non-trailing comments, try 2
Krasimir Georgiev [Mon, 16 Oct 2017 09:08:53 +0000 (09:08 +0000)]
[clang-format] Break non-trailing comments, try 2

Summary:
This patch enables `BreakableToken` to manage the formatting of non-trailing
block comments. It is a refinement of https://reviews.llvm.org/D37007.
We discovered that the optimizer outsmarts us on cases where breaking the comment
costs considerably less than breaking after the comment. This patch addresses
this by ensuring that a newline is inserted between a block comment and the next
token.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

6 years ago[Sema] Re-land: Diagnose tautological comparison with type's min/max values
Roman Lebedev [Sun, 15 Oct 2017 20:13:17 +0000 (20:13 +0000)]
[Sema] Re-land: Diagnose tautological comparison with type's min/max values

The first attempt, rL315614 was reverted because one libcxx
test broke, and i did not know at the time how to deal with it.

Summary:
Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`),
and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the
`std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak

Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565

Reviewers: rjmccall, rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: rtrieu, jroelofs, cfe-commits

Tags: #clang

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

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

6 years agoConvert clang::LangAS to a strongly typed enum
Alexander Richardson [Sun, 15 Oct 2017 18:48:14 +0000 (18:48 +0000)]
Convert clang::LangAS to a strongly typed enum

Summary:
Convert clang::LangAS to a strongly typed enum

Currently both clang AST address spaces and target specific address spaces
are represented as unsigned which can lead to subtle errors if the wrong
type is passed. It is especially confusing in the CodeGen files as it is
not possible to see what kind of address space should be passed to a
function without looking at the implementation.
I originally made this change for our LLVM fork for the CHERI architecture
where we make extensive use of address spaces to differentiate between
capabilities and pointers. When merging the upstream changes I usually
run into some test failures or runtime crashes because the wrong kind of
address space is passed to a function. By converting the LangAS enum to a
C++11 we can catch these errors at compile time. Additionally, it is now
obvious from the function signature which kind of address space it expects.

I found the following errors while writing this patch:

- ItaniumRecordLayoutBuilder::LayoutField was passing a clang AST address
  space to  TargetInfo::getPointer{Width,Align}()
- TypePrinter::printAttributedAfter() prints the numeric value of the
  clang AST address space instead of the target address space.
  However, this code is not used so I kept the current behaviour
- initializeForBlockHeader() in CGBlocks.cpp was passing
  LangAS::opencl_generic to TargetInfo::getPointer{Width,Align}()
- CodeGenFunction::EmitBlockLiteral() was passing a AST address space to
  TargetInfo::getPointerWidth()
- CGOpenMPRuntimeNVPTX::translateParameter() passed a target address space
  to Qualifiers::addAddressSpace()
- CGOpenMPRuntimeNVPTX::getParameterAddress() was using
  llvm::Type::getPointerTo() with a AST address space
- clang_getAddressSpace() returns either a LangAS or a target address
  space. As this is exposed to C I have kept the current behaviour and
  added a comment stating that it is probably not correct.

Other than this the patch should not cause any functional changes.

Reviewers: yaxunl, pcc, bader

Reviewed By: yaxunl, bader

Subscribers: jlebar, jholewinski, nhaehnle, Anastasia, cfe-commits

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

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

6 years agoFix test case regresstion from rL315864
Martell Malone [Sun, 15 Oct 2017 18:01:28 +0000 (18:01 +0000)]
Fix test case regresstion from rL315864

The patch should have been checking against STDCXX17 not STDCXX14.

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

6 years agoDriver: use ld64.lld when -fuse-ld=lld for darwin
Martell Malone [Sun, 15 Oct 2017 17:53:45 +0000 (17:53 +0000)]
Driver: use ld64.lld when -fuse-ld=lld for darwin

When using lld on macOS the current level of detection between ld and
ld64 forces us to rename lld to ld.

For ELF targets we have the ld.lld alias so for MACHO we should have
ld64.lld so we can use lld without replacing the system compiler.

This also solves the additional issue of cross compiling for MACHO
where renaming lld to ld with only target ELF.

This is the clang driver component change to use this new alias.

Reviewers: ruiu, rnk

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

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

6 years ago[driver] [cl] Add/fix c++17/c++latest
Martell Malone [Sun, 15 Oct 2017 17:27:58 +0000 (17:27 +0000)]
[driver] [cl] Add/fix c++17/c++latest

Patch by: daxpedda

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

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

6 years agoAdd -f[no-]double-square-bracket-attributes as new driver options to control use...
Aaron Ballman [Sun, 15 Oct 2017 15:01:42 +0000 (15:01 +0000)]
Add -f[no-]double-square-bracket-attributes as new driver options to control use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later.

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

6 years ago[Lex] Remove unused variables. No functionality change.
Benjamin Kramer [Sun, 15 Oct 2017 04:27:37 +0000 (04:27 +0000)]
[Lex] Remove unused variables. No functionality change.

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

6 years ago[c++2a] Fix failing regression test related to not adding the extension warning to...
Faisal Vali [Sun, 15 Oct 2017 02:13:17 +0000 (02:13 +0000)]
[c++2a] Fix failing regression test related to not adding the extension warning to a diagnostic group (in r315840)

In passing also complete a comment that I left uncompleted.

For ease of reference, here's the parent commit: https://reviews.llvm.org/rL315840

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

6 years ago[c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion)
Faisal Vali [Sun, 15 Oct 2017 01:26:26 +0000 (01:26 +0000)]
[c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion)

This patch implements an extension to the preprocessor:

__VA_OPT__(contents) --> which expands into its contents if variadic arguments are supplied to the parent macro, or behaves as an empty token if none.

  - Currently this feature is only enabled for C++2a (this could be enabled, with some careful tweaks, for other dialects with the appropriate extension or compatibility warnings)

  - The patch was reviewed here: https://reviews.llvm.org/D35782 and asides from the above (and moving some of the definition and expansion recognition logic into the corresponding state machines), I believe I incorporated all of Richard's suggestions.

A few technicalities (most of which were clarified through private correspondence between rsmith, hubert and thomas) are worth mentioning.  Given:

    #define F(a,...) a #__VA_OPT__(a ## a)  a ## __VA_OPT__(__VA_ARGS__)

    - The call F(,) Does not supply any tokens for the variadic arguments and hence VA_OPT behaves as a placeholder.
    - When expanding VA_OPT (for e.g. F(,1) token pasting occurs eagerly within its contents if the contents need to be stringified.
    - A hash or a hashhash prior to VA_OPT does not inhibit expansion of arguments if they are the first token within VA_OPT.
    - When a variadic argument is supplied, argument substitution occurs within the contents as does stringification - and these resulting tokens are inserted back into the macro expansions token stream just prior to the entire stream being rescanned and concatenated.

See wg21.link/P0306 for further details on the feature.

Acknowledgment: This patch would have been poorer if not for Richard Smith's usual thoughtful analysis and feedback.

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

6 years agoRevert "Mark test as unsupported until r315808 is fixed"
Konstantin Zhuravlyov [Sat, 14 Oct 2017 22:24:31 +0000 (22:24 +0000)]
Revert "Mark test as unsupported until r315808 is fixed"

Test is fixed in r315830

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

6 years agoMark test as unsupported until r315808 is fixed
Bruno Cardoso Lopes [Sat, 14 Oct 2017 22:14:23 +0000 (22:14 +0000)]
Mark test as unsupported until r315808 is fixed

This is causing:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/43381

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

6 years agoRe-land r315787, "[Sema] Warn about unused variables if we can constant evaluate...
Benjamin Kramer [Sat, 14 Oct 2017 15:59:34 +0000 (15:59 +0000)]
Re-land r315787, "[Sema] Warn about unused variables if we can constant evaluate the initializer."

The warnings in libc++ tests were fixed in the meantime.

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

6 years agoRevert rL315787, "[Sema] Warn about unused variables if we can constant evaluate...
NAKAMURA Takumi [Sat, 14 Oct 2017 14:46:04 +0000 (14:46 +0000)]
Revert rL315787, "[Sema] Warn about unused variables if we can constant evaluate the initializer."

check-libcxx dislikes it.

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

6 years agoFix build failure on android due to missing std::to_string()
Yaxun Liu [Sat, 14 Oct 2017 12:51:52 +0000 (12:51 +0000)]
Fix build failure on android due to missing std::to_string()

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

6 years ago[OpenCL] Emit enqueued block as kernel
Yaxun Liu [Sat, 14 Oct 2017 12:23:50 +0000 (12:23 +0000)]
[OpenCL] Emit enqueued block as kernel

In OpenCL the kernel function and non-kernel function has different calling conventions.
For certain targets they have different argument ABIs. Also kernels have special function
attributes and metadata for runtime to launch them.

The blocks passed to enqueue_kernel is supposed to be executed as kernels. As such,
the block invoke function should be emitted as kernel with proper calling convention and
argument ABI.

This patch emits enqueued block as kernel. If a block is both called directly and passed
to enqueue_kernel, separate functions will be generated.

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

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

6 years ago[Sema] Warn about unused variables if we can constant evaluate the initializer.
Benjamin Kramer [Sat, 14 Oct 2017 01:30:49 +0000 (01:30 +0000)]
[Sema] Warn about unused variables if we can constant evaluate the initializer.

If the variable construction can be constant evaluated it doesn't have
side effects, so removing it is always safe. We only try to evaluate
variables that are unused, there should be no impact on compile time.

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

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

6 years ago[ubsan] Don't emit function signatures for non-static member functions
Vedant Kumar [Sat, 14 Oct 2017 01:23:30 +0000 (01:23 +0000)]
[ubsan] Don't emit function signatures for non-static member functions

The function sanitizer only checks indirect calls through function
pointers. This excludes all non-static member functions (constructor
calls, calls through thunks, etc. all use a separate code path). Don't
emit function signatures for functions that won't be checked.

Apart from cutting down on code size, this should fix a regression on
Linux caused by r313096. For context, see the mailing list discussion:

r313096 - [ubsan] Function Sanitizer: Don't require writable text segments

Testing: check-clang, check-ubsan

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

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

6 years ago[Lex] Avoid out-of-bounds dereference in SkipLineComment
Alex Lorenz [Sat, 14 Oct 2017 01:18:30 +0000 (01:18 +0000)]
[Lex] Avoid out-of-bounds dereference in SkipLineComment

Credit to OSS-Fuzz for discovery:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3145

rdar://34526482

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

6 years agoFix backwards warning for use of C++17 attributes-on-namespaces-and-enumerators feature.
Richard Smith [Sat, 14 Oct 2017 00:56:24 +0000 (00:56 +0000)]
Fix backwards warning for use of C++17 attributes-on-namespaces-and-enumerators feature.

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

6 years agoAllow building libFuzzer tests in two-stage compiler-rt build.
George Karpenkov [Fri, 13 Oct 2017 23:50:53 +0000 (23:50 +0000)]
Allow building libFuzzer tests in two-stage compiler-rt build.

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

6 years agoRevert r315738
Alex Lorenz [Fri, 13 Oct 2017 22:47:44 +0000 (22:47 +0000)]
Revert r315738

The ParsedSourceRange class does not work correctly on Windows with the ':'
drive separators

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

6 years ago[Sema] Avoid iterator invalidation when code completing.
Benjamin Kramer [Fri, 13 Oct 2017 22:14:34 +0000 (22:14 +0000)]
[Sema] Avoid iterator invalidation when code completing.

It's possible for the code completion consumer to add new decls to the
current scope while lookup happens on it. Avoid this by making a copy
first.

Sadly I wasn't able to get a self-contained test case for this as it
requires code completion + precompiled preamble + the stars aligning to
deserialize at exactly the right time.

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

6 years agoAllow building libFuzzer in two-stage compiler-rt build
George Karpenkov [Fri, 13 Oct 2017 22:03:09 +0000 (22:03 +0000)]
Allow building libFuzzer in two-stage compiler-rt build

When LLVM_BUILD_EXTERNAL_COMPILER_RT option is set to true,
all of projects in compiler-rt are built with a freshly-built compiler using
a recursive CMake invocation.
(e.g. that's how compiler-rt is used in Swift)

Just now I have noticed that libFuzzer binaries were missing in such a case,
and ninja fuzzer returned "no such target", while ninja asan worked just fine.

To my surprise, the list of allowed targets was actually hardcoded in Clang!
While the current setup is clearly suboptimal, for the lack of a better fix
I'm just adding `fuzzer` to a list of `compiler-rt` targets.

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

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

6 years agoFix -Woverloaded-virtual warning in clang-refactor
Alex Lorenz [Fri, 13 Oct 2017 21:15:25 +0000 (21:15 +0000)]
Fix -Woverloaded-virtual warning in clang-refactor

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

6 years ago[analyzer] pr28449: Fix support for various array initializers.
Artem Dergachev [Fri, 13 Oct 2017 20:54:56 +0000 (20:54 +0000)]
[analyzer] pr28449: Fix support for various array initializers.

In some cases the analyzer didn't expect an array-type variable to be
initialized with anything other than a string literal. The patch essentially
removes the assertion, and ensures relatively sane behavior.

There is a bigger problem with these initializers. Currently our memory model
(RegionStore) is being ordered to initialize the array with a region that
is assumed to be storing the initializer rvalue, and it guesses to copy
the contents of that region to the array variable. However, it would make
more sense for RegionStore to receive the correct initializer in the first
place. This problem isn't addressed with this patch.

rdar://problem/27248428
Differential Revision: https://reviews.llvm.org/D23963

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

6 years ago[analyzer] CStringChecker: pr34460: Avoid a crash when a cast is not modeled.
Artem Dergachev [Fri, 13 Oct 2017 20:11:00 +0000 (20:11 +0000)]
[analyzer] CStringChecker: pr34460: Avoid a crash when a cast is not modeled.

The checker used to crash when a mempcpy's length argument is symbolic. In this
case the cast from 'void *' to 'char *' failed because the respective
ElementRegion that represents cast is hard to add on top of the existing
ElementRegion that represents the offset to the last copied byte, while
preseving a sane memory region structure.

Additionally, a few test cases are added (to casts.c) which demonstrate problems
caused by existing sloppy work we do with multi-layer ElementRegions. If said
cast would be modeled properly in the future, these tests would need to be
taken into account.

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

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

6 years agoBasic: adjust attributes on `nan` LIBBUILTINs
Saleem Abdulrasool [Fri, 13 Oct 2017 20:07:30 +0000 (20:07 +0000)]
Basic: adjust attributes on `nan` LIBBUILTINs

The `nan` family of functions will inspect the contents of the parameter
that they are passed. As a result, the function cannot be annotated as
`const`.  The documentation of the `const` attribute explicitly states
this:
  Note that a function that has pointer arguments and examines the data
  pointed to must not be declared const.
Adjust the annotations on this family of functions.

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

6 years agoRevert "[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue...
Ivan A. Kosarev [Fri, 13 Oct 2017 19:55:01 +0000 (19:55 +0000)]
Revert "[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info", r315731.

With this change we fail on the clang-x86_64-linux-selfhost-modules builder.

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

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

6 years ago[clang-refactor] Apply source replacements
Alex Lorenz [Fri, 13 Oct 2017 19:42:05 +0000 (19:42 +0000)]
[clang-refactor] Apply source replacements

This commit actually brings clang-refactor to a usable state as it can now
apply the refactoring changes to source files.
The -selection option is now also fully supported.

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

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

6 years ago[analyzer] RetainCount: Ignore annotations on user-made CFRetain wrappers.
Artem Dergachev [Fri, 13 Oct 2017 19:10:42 +0000 (19:10 +0000)]
[analyzer] RetainCount: Ignore annotations on user-made CFRetain wrappers.

It is not uncommon for the users to make their own wrappers around
CoreFoundation's CFRetain and CFRelease functions that are defensive
against null references. In such cases CFRetain is often incorrectly
marked as CF_RETURNS_RETAINED. Ignore said annotation and treat such
wrappers similarly to the regular CFRetain.

rdar://problem/31699502
Differential Revision: https://reviews.llvm.org/D38877

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

6 years ago[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Fri, 13 Oct 2017 18:40:18 +0000 (18:40 +0000)]
[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

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

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

6 years ago[X86] Remove 'knm' defines from predefined-arch-macros.c test.
Craig Topper [Fri, 13 Oct 2017 18:38:10 +0000 (18:38 +0000)]
[X86] Remove 'knm' defines from predefined-arch-macros.c test.

Direction seems to be that we dont' want to keep adding these, but I forgot to remove it from the test before I committed r315723.

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

6 years ago[X86] Add skeleton support for knm cpu
Craig Topper [Fri, 13 Oct 2017 18:14:24 +0000 (18:14 +0000)]
[X86] Add skeleton support for knm cpu

This adds support Knights Mill CPU. Preprocessor defines match gcc's implementation.

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

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

6 years ago[CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Fri, 13 Oct 2017 17:34:18 +0000 (17:34 +0000)]
[CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base info

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

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

6 years agoRevert "[lit] Raise the logic for enabling clang & lld substitutions to llvm."
Bruno Cardoso Lopes [Fri, 13 Oct 2017 17:11:13 +0000 (17:11 +0000)]
Revert "[lit] Raise the logic for enabling clang & lld substitutions to llvm."

This reverts commit r315627, fixing bot failures:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA

LIT is failing to properly apply substitution to debuginfo-tests
after this change.

rdar://problem/34979568

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

6 years ago[CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Fri, 13 Oct 2017 16:58:30 +0000 (16:58 +0000)]
[CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

6 years ago[SEH] Use the SEH personality on frontend-outlined funclets
Reid Kleckner [Fri, 13 Oct 2017 16:55:14 +0000 (16:55 +0000)]
[SEH] Use the SEH personality on frontend-outlined funclets

This allows __try inside __finally to work.

Fixes PR34939

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

6 years ago[CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info
Ivan A. Kosarev [Fri, 13 Oct 2017 16:50:50 +0000 (16:50 +0000)]
[CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

6 years ago[CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info
Ivan A. Kosarev [Fri, 13 Oct 2017 16:47:22 +0000 (16:47 +0000)]
[CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

6 years ago[CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue...
Ivan A. Kosarev [Fri, 13 Oct 2017 16:38:32 +0000 (16:38 +0000)]
[CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

6 years agoHide "#pragma optimize("", off)" from clang when it pretends to be MSVC 2017
Reid Kleckner [Fri, 13 Oct 2017 16:18:32 +0000 (16:18 +0000)]
Hide "#pragma optimize("", off)" from clang when it pretends to be MSVC 2017

These pragmas work around a bug in VC 1911 that isn't present in clang,
and clang warns about them.

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

6 years agoFix an unused-variable warning.
Haojian Wu [Fri, 13 Oct 2017 15:37:53 +0000 (15:37 +0000)]
Fix an unused-variable warning.

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

6 years agoRemove an unused variable.
Haojian Wu [Fri, 13 Oct 2017 15:34:03 +0000 (15:34 +0000)]
Remove an unused variable.

Fix -Wunused-but-set-variable warning.

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

6 years agoFix regression of test/CodeGenOpenCL/address-spaces.cl on ppc
Yaxun Liu [Fri, 13 Oct 2017 13:53:06 +0000 (13:53 +0000)]
Fix regression of test/CodeGenOpenCL/address-spaces.cl on ppc

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

6 years ago[OpenCL] Add LangAS::opencl_private to represent private address space in AST
Yaxun Liu [Fri, 13 Oct 2017 03:37:48 +0000 (03:37 +0000)]
[OpenCL] Add LangAS::opencl_private to represent private address space in AST

Currently Clang uses default address space (0) to represent private address space for OpenCL
in AST. There are two issues with this:

Multiple address spaces including private address space cannot be diagnosed.
There is no mangling for default address space. For example, if private int* is emitted as
i32 addrspace(5)* in IR. It is supposed to be mangled as PUAS5i but it is mangled as
Pi instead.

This patch attempts to represent OpenCL private address space explicitly in AST. It adds
a new enum LangAS::opencl_private and adds it to the variable types which are implicitly
private:

automatic variables without address space qualifier

function parameter

pointee type without address space qualifier (OpenCL 1.2 and below)

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

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

6 years ago[clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA
Alexander Shaposhnikov [Fri, 13 Oct 2017 03:21:39 +0000 (03:21 +0000)]
[clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

At the moment if LLVM_BUILD_INSTRUMENTED is set to True
one has to set LLVM_PROFTDATA even if it's not really used
(because of message(FATAL_ERROR ...)).
Building the instrumented version of Clang can be useful even if
one doesn't plan to build the target generate-profdata
(currently that target would only compile utils/perf-training/cxx/hello_world.cpp).
For example, one can run the instrumented version of Clang
via a separate build system against a different codebase,
collect/analyze the profiles and merge them by llvm-profdata later.

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

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

6 years agoSupport for destroying operator delete, per C++2a proposal P0722.
Richard Smith [Fri, 13 Oct 2017 01:55:36 +0000 (01:55 +0000)]
Support for destroying operator delete, per C++2a proposal P0722.

This feature is not (yet) approved by the C++ committee, so this is liable to
be reverted or significantly modified based on committee feedback.

No functionality change intended for existing code (a new type must be defined
in namespace std to take advantage of this feature).

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

6 years agoRecommit r315087 "[refactor] add support for refactoring options"
Alex Lorenz [Fri, 13 Oct 2017 01:53:13 +0000 (01:53 +0000)]
Recommit r315087 "[refactor] add support for refactoring options"

The recommit fixes a UB bug that occurred only on a small number of bots.

Original message:

This commit adds initial support for refactoring options. One can now use
optional and required std::string options.

This commit also adds a NewNameOption for the local-rename refactoring action to
allow rename to work with custom names.

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

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

6 years ago[MS] Don't bail on replacing dllimport vbase dtors with base dtors
Reid Kleckner [Fri, 13 Oct 2017 00:53:02 +0000 (00:53 +0000)]
[MS] Don't bail on replacing dllimport vbase dtors with base dtors

Fix PR32990 by effectively reverting r283063 and solving it a different
way.

We want to limit the hack to not replace equivalent available_externally
dtors specifically to libc++, which uses always_inline. It seems certain
versions of libc++ do not provide all the symbols that an explicit
template instantiation is expected to provide.

If we get to the code that forms a real alias, only *then* check if this
is available_externally, and do that by asking a better question, which
is "is this a declaration for the linker?", because *that's* what means
we can't form an alias to it.

As a follow-on simplification, remove the InEveryTU parameter. Its last
use guarded this code for forming aliases, but we should never form
aliases to declarations, regardless of what we know about every TU.

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

6 years ago[Analyzer] Assume that CFBooleanRef const globals are non-null
George Karpenkov [Fri, 13 Oct 2017 00:51:41 +0000 (00:51 +0000)]
[Analyzer] Assume that CFBooleanRef const globals are non-null

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

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

6 years agoTypos in tutorial
Jan Korous [Fri, 13 Oct 2017 00:31:07 +0000 (00:31 +0000)]
Typos in tutorial

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

6 years agoHandle/assert on DK_Remark
Adam Nemet [Thu, 12 Oct 2017 23:56:54 +0000 (23:56 +0000)]
Handle/assert on DK_Remark

We don't generate remarks during inline assembly parsing so no need to handle
these for now.

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

6 years ago[Sema][ObjC] Complete merging ObjC methods before checking their
Akira Hatanaka [Thu, 12 Oct 2017 23:24:38 +0000 (23:24 +0000)]
[Sema][ObjC] Complete merging ObjC methods before checking their
overriding methods.

This should fix test case Analysis/retain-release.m that was failing on
the reverse iteration bot:

http://lab.llvm.org:8011/builders/reverse-iteration

The test used to fail because the loop in CheckObjCMethodOverrides would
merge attribute ns_returns_retained on methods while checking whether
the overriding methods were compatible. Since OverrideSearch::Overridden
is a SmallPtrSet and the order in which the elements of the set are
visited is non-deterministic, the test would fail when method 'clone' of
the protocol 'F18P' was visited before F18(Cat)'s method 'clone' was
visited.

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

6 years ago[Sema][Crash] Correctly handle an non-dependent noexcept expr in function template
Erich Keane [Thu, 12 Oct 2017 23:01:53 +0000 (23:01 +0000)]
[Sema][Crash] Correctly handle an non-dependent noexcept expr in function template

It seems that all of the other templated cases are handled correctly,
however the function template case was not correctly handled. This
patch recovers from this condition by setting the function to noexcept
after diagnosing. Previously it simply set NoexceptExpr to null,
which caused an Assert when this was evaluated during substitution.

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

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

6 years agoRevert "[Sema] Diagnose tautological comparison with type's min/max values"
Roman Lebedev [Thu, 12 Oct 2017 22:03:20 +0000 (22:03 +0000)]
Revert "[Sema] Diagnose tautological comparison with type's min/max values"

This reverts r315614,r315615,r315621,r315622
Breaks http://bb9.pgr.jp/#/builders/20/builds/59

/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:95:17: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare]
    if (max_sec > Lim::max()) return false;
        ~~~~~~~ ^ ~~~~~~~~~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:13: error: comparison 'long long' < -9223372036854775808 is always false [-Werror,-Wtautological-constant-compare]
    if (sec < Lim::min() || sec > Lim::max())   return false;
        ~~~ ^ ~~~~~~~~~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:33: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare]
    if (sec < Lim::min() || sec > Lim::max())   return false;
                            ~~~ ^ ~~~~~~~~~~
3 errors generated.
--

I'm not yet sure what is the proper fix.

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

6 years ago[cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.
Matt Morehouse [Thu, 12 Oct 2017 22:00:09 +0000 (22:00 +0000)]
[cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.

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