]> granicus.if.org Git - clang/log
clang
7 years agoImprove handling of instantiated thread_local variables in Itanium C++ ABI.
Richard Smith [Fri, 13 Jan 2017 00:43:31 +0000 (00:43 +0000)]
Improve handling of instantiated thread_local variables in Itanium C++ ABI.

 * Do not initialize these variables when initializing the rest of the
   thread_locals in the TU; they have unordered initialization so they can be
   initialized by themselves.

   This fixes a rejects-valid bug: we would make the per-variable initializer
   function internal, but put it in a comdat keyed off the variable, resulting
   in link errors when the comdat is selected from a different TU (as the per
   TU TLS init function tries to call an init function that does not exist).

 * On Darwin, when we decide that we're not going to emit a thread wrapper
   function at all, demote its linkage to External. Fixes a verifier failure
   on explicit instantiation of a thread_local variable on Darwin.

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

7 years agoFix two test cases I missed updating in r291850. Sorry for the noise.
Chandler Carruth [Thu, 12 Jan 2017 22:48:28 +0000 (22:48 +0000)]
Fix two test cases I missed updating in r291850. Sorry for the noise.

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

7 years agoReplace some stray uses of the old spelling of the flag with the new
Chandler Carruth [Thu, 12 Jan 2017 22:43:37 +0000 (22:43 +0000)]
Replace some stray uses of the old spelling of the flag with the new
spelling. NFC.

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

7 years agoAddress review comments on r290392:
Chandler Carruth [Thu, 12 Jan 2017 22:40:13 +0000 (22:40 +0000)]
Address review comments on r290392:
- Don't break using '-mllvm -disable-llvm-optzns' (yet).
- Don't add support for '-mllvm -disable-llvm-passes'.

This is important for LLVM 4 as we haven't yet really told folks this is
coming. I'll add release notes about this.

I've also added some explicit testing of this so its more obvious what
is happening here.

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

7 years agoClear the release notes for 5.0.0
Hans Wennborg [Thu, 12 Jan 2017 21:55:16 +0000 (21:55 +0000)]
Clear the release notes for 5.0.0

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

7 years agoUpdate docs/conf.py version
Hans Wennborg [Thu, 12 Jan 2017 21:41:38 +0000 (21:41 +0000)]
Update docs/conf.py version

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

7 years agoAdd entry for -MJ.
Joerg Sonnenberger [Thu, 12 Jan 2017 21:11:55 +0000 (21:11 +0000)]
Add entry for -MJ.

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

7 years agoclang-format: Fix regression introduced by r291801.
Daniel Jasper [Thu, 12 Jan 2017 20:06:28 +0000 (20:06 +0000)]
clang-format: Fix regression introduced by r291801.

Uncovered by polly tests.

Before:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa,
                                 {}, aaaaaaaaaaaaaaaaaaaaaaa);

After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {},
                                 aaaaaaaaaaaaaaaaaaaaaaa);

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

7 years agoAdd additional testcases for nsw markings on ++ and --.
Eli Friedman [Thu, 12 Jan 2017 19:51:44 +0000 (19:51 +0000)]
Add additional testcases for nsw markings on ++ and --.

clang has generated correct IR for char/short decrement since r126816,
but we didn't have any test coverage for decrement.

Patch by Andrew Rogers.

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

7 years agoclang-format: Treat braced lists like other complex parameters.
Daniel Jasper [Thu, 12 Jan 2017 19:35:26 +0000 (19:35 +0000)]
clang-format: Treat braced lists like other complex parameters.

Specifically, wrap before them if they are multi-line so that we don't
create long hanging indents. This prevents having a lot of code
indented a lot in some cases.

Before:
  someFunction(Param, {List1, List2,
                       List3});

After:
  someFunction(Param,
               {List1, List2,
                List3});

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

7 years agoUsersManual.rst: Update clang-cl options list again
Hans Wennborg [Thu, 12 Jan 2017 19:26:54 +0000 (19:26 +0000)]
UsersManual.rst: Update clang-cl options list again

This time, make ignored options, such as /utf-8, show up as well if they
have help text.

Also, since we're now exposing -fdelayed-template-parsing, add help text
to the -fno version so that shows up as well.

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

7 years ago[Modules] Fix misleading warning about missing textual header in umbrella header
Bruno Cardoso Lopes [Thu, 12 Jan 2017 19:15:33 +0000 (19:15 +0000)]
[Modules] Fix misleading warning about missing textual header in umbrella header

When a textual header is present inside a umbrella dir but not in the
header, we get the misleading warning:

warning: umbrella header for module 'FooFramework' does not include
header 'Baz_Private.h'

The module map in question:

framework module FooFramework {
    umbrella header "FooUmbrella.h"

    export *
    module * { export * }

    module Private {
        textual header "Baz_Private.h"
    }
}

Fix this by taking textual headers into account.

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

7 years agoUsersManual.rst: Update clang-cl options list
Hans Wennborg [Thu, 12 Jan 2017 18:15:06 +0000 (18:15 +0000)]
UsersManual.rst: Update clang-cl options list

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

7 years ago[analyzer] Don't dereference the array value when binding it to a reference.
Artem Dergachev [Thu, 12 Jan 2017 18:00:03 +0000 (18:00 +0000)]
[analyzer] Don't dereference the array value when binding it to a reference.

This replaces the hack in r291754, which was fixing pr31592, which was
caused by r291754, with a more appropriate solution.

rdar://problem/28832541
Differential revision: https://reviews.llvm.org/D28602

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

7 years ago[Docs][OpenCL] Added OpenCL feature description to Clang documentation.
Anastasia Stulova [Thu, 12 Jan 2017 17:52:22 +0000 (17:52 +0000)]
[Docs][OpenCL] Added OpenCL feature description to Clang documentation.

Updated index and UsersManual with OpenCL description.

Review: https://reviews.llvm.org/D28080

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

7 years agoRevert r291774 which caused buildbot failure.
Dehao Chen [Thu, 12 Jan 2017 16:56:18 +0000 (16:56 +0000)]
Revert r291774 which caused buildbot failure.

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

7 years agoPass -fprofile-sample-use to lto backends.
Dehao Chen [Thu, 12 Jan 2017 16:29:25 +0000 (16:29 +0000)]
Pass -fprofile-sample-use to lto backends.

Summary: LTO backend will not invoke SampleProfileLoader pass even if -fprofile-sample-use is specified. This patch passes the flag down so that pass manager can add the SampleProfileLoader pass correctly.

Reviewers: mehdi_amini, tejohnson

Subscribers: cfe-commits

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

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

7 years agoTracking exception specification source locations
Malcolm Parsons [Thu, 12 Jan 2017 16:11:28 +0000 (16:11 +0000)]
Tracking exception specification source locations

Summary:
We do not currently track the source locations for exception specifications such
that their source range can be queried through the AST. This leads to trying to
write more complex code to determine the source range for uses like FixItHints
(see D18575 for an example). In addition to use within tools like clang-tidy, I
think this information may become more important to track as exception
specifications become more integrated into the type system.

Patch by Don Hinton.

Reviewers: rsmith

Subscribers: malcolm.parsons, sbarzowski, alexfh, hintonda, cfe-commits

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

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

7 years agoAvoid multiple -Wunreachable-code diagnostics that are triggered by
Alex Lorenz [Thu, 12 Jan 2017 10:48:03 +0000 (10:48 +0000)]
Avoid multiple -Wunreachable-code diagnostics that are triggered by
the same source range and use the unary operator fixit only when it
actually silences the warning.

rdar://24570531

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

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

7 years ago[analyzer] Avoid a crash in DereferenceChecker on string literal initializers.
Artem Dergachev [Thu, 12 Jan 2017 09:46:16 +0000 (09:46 +0000)]
[analyzer] Avoid a crash in DereferenceChecker on string literal initializers.

A hotfix for pr31592 that fixes the crash but not the root cause of the problem.
We need to update the analyzer engine further to account for AST changes
introduced in r289618. At the moment we're erroneously performing a redundant
lvalue-to-rvalue cast in this scenario, and squashing the rvalue of the object
bound to the reference into the reference itself.

rdar://problem/28832541

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

7 years agoPR31469: Don't add friend template class decls to redecl chain in dependent contexts.
Vassil Vassilev [Thu, 12 Jan 2017 09:16:26 +0000 (09:16 +0000)]
PR31469: Don't add friend template class decls to redecl chain in dependent contexts.

Fixes a crash in modules where the template class decl becomes the most recent
decl in the redeclaration chain and forcing the template instantiator try to
instantiate the friend declaration, rather than the template definition.

In practice, A::list<int> produces a TemplateSpecializationType
A::__1::list<int, allocator<type-parameter-0-0> >' failing to replace to
subsitute the default argument to allocator<int>.

Kudos Richard Smith (D28399).

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

7 years agoRemove redundant passing around of a "ContainsAutoType" flag.
Richard Smith [Thu, 12 Jan 2017 02:27:38 +0000 (02:27 +0000)]
Remove redundant passing around of a "ContainsAutoType" flag.

This flag serves no purpose other than to prevent us walking through a type to
check whether it contains an 'auto' specifier; this duplication of information
is error-prone, does not appear to provide any performance benefit, and will
become less practical once we support C++1z deduced class template types and
eventually constrained types from the Concepts TS.

No functionality change intended.

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

7 years ago[index] Introduce symbol subkinds to mark an accessor getter or setter.
Argyrios Kyrtzidis [Wed, 11 Jan 2017 21:42:48 +0000 (21:42 +0000)]
[index] Introduce symbol subkinds to mark an accessor getter or setter.

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

7 years ago[index] Ignore invalid ObjC categories.
Argyrios Kyrtzidis [Wed, 11 Jan 2017 21:08:31 +0000 (21:08 +0000)]
[index] Ignore invalid ObjC categories.

We currently are unable to get a USR for those and it doesn't seem useful to try to index them.

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

7 years ago[index] Add 'IBTypeOf' relation for ObjC methods marked with IBAction and properties...
Argyrios Kyrtzidis [Wed, 11 Jan 2017 21:01:07 +0000 (21:01 +0000)]
[index] Add 'IBTypeOf' relation for ObjC methods marked with IBAction and properties with IBOutletCollection.

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

7 years ago[PowerPC] Fix the wrong implementation of builtin vec_rlnm.
Tony Jiang [Wed, 11 Jan 2017 20:59:42 +0000 (20:59 +0000)]
[PowerPC] Fix the wrong implementation of builtin vec_rlnm.

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

7 years ago[index] Add 'contained-by' relation between references and their lexical container.
Argyrios Kyrtzidis [Wed, 11 Jan 2017 20:51:10 +0000 (20:51 +0000)]
[index] Add 'contained-by' relation between references and their lexical container.

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

7 years agoModule: Do not add any link flags when an implementation TU of a module imports
Manman Ren [Wed, 11 Jan 2017 18:47:38 +0000 (18:47 +0000)]
Module: Do not add any link flags when an implementation TU of a module imports
a header of that same module.

This fixes a regression caused by r280409.
rdar://problem/29930553

This is an updated version for r291628 (which was reverted in r291688).

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

7 years agoThis reverts r291628. As suggested by Richard, we can simply
Manman Ren [Wed, 11 Jan 2017 18:32:30 +0000 (18:32 +0000)]
This reverts r291628. As suggested by Richard, we can simply
filter out the implicilty imported modules at CodeGen instead of removing the
implicit ImportDecl when an implementation TU of a module imports a header of
that same module.

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

7 years agoUnbreak the clang-fuzzer build after r291184.
Benjamin Kramer [Wed, 11 Jan 2017 16:42:26 +0000 (16:42 +0000)]
Unbreak the clang-fuzzer build after r291184.

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

7 years agoRemove repeated word in comment (NFC)
Malcolm Parsons [Wed, 11 Jan 2017 11:23:22 +0000 (11:23 +0000)]
Remove repeated word in comment (NFC)

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

7 years ago[Modules] Support #import when entering files with modules
Bruno Cardoso Lopes [Wed, 11 Jan 2017 02:14:51 +0000 (02:14 +0000)]
[Modules] Support #import when entering files with modules

Textual headers and builtins that are #import'd from different
modules should get re-entered when these modules are independent
from each other.

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

rdar://problem/25881934

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

7 years ago[analyzer] Fix crash in body farm for getter without implicit self.
Devin Coughlin [Wed, 11 Jan 2017 01:02:34 +0000 (01:02 +0000)]
[analyzer] Fix crash in body farm for getter without implicit self.

Fix a crash in body farm when synthesizing a getter for a property
synthesized for a property declared in a protocol on a class extension
that shadows a declaration of the property in a category.

In this case, Sema doesn't fill in the implicit 'self' parameter for the getter
in the category, which leads to a crash when trying to synthesize the getter
for it.

To avoid the crash, skip getter synthesis in body farm if the self parameter is
not filled int.

rdar://problem/29938138

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

7 years agoModule: Do not create Implicit ImportDecl for module X if we
Manman Ren [Wed, 11 Jan 2017 00:48:19 +0000 (00:48 +0000)]
Module: Do not create Implicit ImportDecl for module X if we
 are building an implemenation of module X.

This fixes a regression caused by r280409.
rdar://problem/29930553

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

7 years agoRemove dead code.
Richard Smith [Tue, 10 Jan 2017 23:04:46 +0000 (23:04 +0000)]
Remove dead code.

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

7 years agoRemove a couple of parameters that are always false.
Richard Smith [Tue, 10 Jan 2017 22:59:18 +0000 (22:59 +0000)]
Remove a couple of parameters that are always false.

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

7 years agoSerialize the UsesSEH bit on FunctionDecl
Reid Kleckner [Tue, 10 Jan 2017 21:27:03 +0000 (21:27 +0000)]
Serialize the UsesSEH bit on FunctionDecl

Fixes PR31539

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

7 years ago[Driver] Add openSuse AArch64 Triple
Kostya Kortchinsky [Tue, 10 Jan 2017 21:13:08 +0000 (21:13 +0000)]
[Driver] Add openSuse AArch64 Triple

Summary:
openSuse has AArch64 support, with images running on the Raspberry Pi 3.
The libraries and headers live under the aarch64-suse-linux subdirectory,
which is currently not in the AArch64 triples list. Address this by adding
the corresponding string to AArch64Triples.

Reviewers: chandlerc, bruno, bkramer, rengolin

Subscribers: aemerson, rengolin, cfe-commits

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

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

7 years agoDon't try to check implicit conversion sequences for an object argument if
Richard Smith [Tue, 10 Jan 2017 20:52:50 +0000 (20:52 +0000)]
Don't try to check implicit conversion sequences for an object argument if
there is no object argument, when early checking of implicit conversion
sequences for a function template fails.

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

7 years agoFix conversion index / argument index mismatch when diagnosing overload resolution...
Richard Smith [Tue, 10 Jan 2017 20:19:21 +0000 (20:19 +0000)]
Fix conversion index / argument index mismatch when diagnosing overload resolution failure.

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

7 years ago[OpenMP] Remove outdated comments. NFC.
Kelvin Li [Tue, 10 Jan 2017 18:57:07 +0000 (18:57 +0000)]
[OpenMP] Remove outdated comments. NFC.

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

7 years ago[ARM] Use generic bitreverse intrinsic, rather than ARM specific rbit.
Chad Rosier [Tue, 10 Jan 2017 18:55:11 +0000 (18:55 +0000)]
[ARM] Use generic bitreverse intrinsic, rather than ARM specific rbit.

The backend already supports lowering this intrinsic to a rbit instruction.

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

7 years ago[analyzer] Treat pointers to static member functions as function pointers
Devin Coughlin [Tue, 10 Jan 2017 18:49:27 +0000 (18:49 +0000)]
[analyzer] Treat pointers to static member functions as function pointers

Sema treats pointers to static member functions as having function pointer
type, so treat treat them as function pointer values in the analyzer as well.
This prevents an assertion failure in SValBuilder::evalBinOp caused by code
that expects function pointers to be Locs (in contrast, PointerToMember values
are nonlocs).

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

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

7 years ago[OpenMP] Sema and parsing for 'target teams distribute simd’ pragma
Kelvin Li [Tue, 10 Jan 2017 18:08:18 +0000 (18:08 +0000)]
[OpenMP] Sema and parsing for 'target teams distribute simd’ pragma

This patch is to implement sema and parsing for 'target teams distribute simd’ pragma.

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

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

7 years agoCGDecl: Skip static variable initializers in unreachable code
Matthias Braun [Tue, 10 Jan 2017 17:43:01 +0000 (17:43 +0000)]
CGDecl: Skip static variable initializers in unreachable code

This fixes http://llvm.org/PR31054

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

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

7 years ago[AArch64] Use generic bitreverse intrinsic, rather than AArch64 specific.
Chad Rosier [Tue, 10 Jan 2017 17:20:28 +0000 (17:20 +0000)]
[AArch64] Use generic bitreverse intrinsic, rather than AArch64 specific.

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

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

7 years ago[OpenMP] Basic support for a parallel directive in a target region on an NVPTX device
Arpith Chacko Jacob [Tue, 10 Jan 2017 15:42:51 +0000 (15:42 +0000)]
[OpenMP] Basic support for a parallel directive in a target region on an NVPTX device

Summary:

This patch introduces support for the execution of parallel constructs in a target
region on the NVPTX device.  Parallel regions must be in the lexical scope of the
target directive.

The master thread in the master warp signals parallel work for worker threads in worker
warps on encountering a parallel region.

Note: The patch does not yet support capture of arguments in a parallel region so
the test cases are simple.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D28145

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

7 years ago[Sema] Avoid -Wshadow warning when a "redefinition of " error is presented
Alex Lorenz [Tue, 10 Jan 2017 14:41:13 +0000 (14:41 +0000)]
[Sema] Avoid -Wshadow warning when a "redefinition of " error is presented

This commit ensures that clang avoids the redundant -Wshadow warning for
variables that already get a "redefinition of " error.

rdar://29067894

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

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

7 years agoRemove fixme, use ASTContext::getCanonicalTemplateSpecializationType.
Vassil Vassilev [Tue, 10 Jan 2017 09:09:09 +0000 (09:09 +0000)]
Remove fixme, use ASTContext::getCanonicalTemplateSpecializationType.

Reviewed by Richard Smith (D28306).

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

7 years agoFix rejects-valid with default member initializers exposed by r291318.
Richard Smith [Tue, 10 Jan 2017 08:51:46 +0000 (08:51 +0000)]
Fix rejects-valid with default member initializers exposed by r291318.

Don't prematurely clean up an RAII object; there's another RAII object in the
same scope that tries to save and restore the same member!

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

7 years ago[X86] Add recent CPU strings to some of the tests that check other cpu names.
Craig Topper [Tue, 10 Jan 2017 06:02:16 +0000 (06:02 +0000)]
[X86] Add recent CPU strings to some of the tests that check other cpu names.

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

7 years agoAMD family 17h (znver1) enablement
Craig Topper [Tue, 10 Jan 2017 06:02:12 +0000 (06:02 +0000)]
AMD family 17h (znver1) enablement

Summary:
This patch enables the following
1. AMD family 17h architecture using "znver1" tune flag (-march, -mcpu).
2. ISAs that are enabled for "znver1" architecture.
3. Checks ADX isa from cpuid to identify "znver1" flag when -march=native is used.
4. ISAs FMA4, XOP are disabled as they are dropped from amdfam17.
5. For the time being, it uses the btver2 scheduler model.
6. Test file is updated to check this flag.

This is linked to llvm review item https://reviews.llvm.org/D28017

Patch by Ganesh Gopalasubramanian. Additional test cases added by Craig Topper.

Reviewers: RKSimon, craig.topper

Subscribers: cfe-commits, RKSimon, ashutosh.nema, llvm-commits

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

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

7 years ago[OpenMP] Support the 'is_device_ptr' clause with 'target parallel for' pragma
Kelvin Li [Tue, 10 Jan 2017 05:15:35 +0000 (05:15 +0000)]
[OpenMP] Support the 'is_device_ptr' clause with 'target parallel for' pragma

This patch is to add support of the 'is_device_ptr' clause with the 'target parallel for' pragma.

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

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

7 years ago[OpenMP] Support the 'is_device_ptr' clause with 'target parallel for simd' pragma
Kelvin Li [Tue, 10 Jan 2017 04:26:44 +0000 (04:26 +0000)]
[OpenMP] Support the 'is_device_ptr' clause with 'target parallel for simd' pragma

This patch is to add support of the 'is_device_ptr' clause with the 'target parallel for simd' pragma.

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

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

7 years agoDon't classify variable template names as type templates.
Richard Smith [Tue, 10 Jan 2017 02:15:49 +0000 (02:15 +0000)]
Don't classify variable template names as type templates.

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

7 years ago[NFC] Rename RAII ExpressionEvaluationContext variable from Unevaluated to ConstantEv...
Faisal Vali [Tue, 10 Jan 2017 01:29:41 +0000 (01:29 +0000)]
[NFC] Rename RAII ExpressionEvaluationContext variable from Unevaluated to ConstantEvaluated when parsing a constant expression.

This renaming makes it consistent with the context it actually sets: Sema::ConstantEvaluated.

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

7 years ago[coroutines] Sema: Allow co_return all by itself.
Gor Nishanov [Tue, 10 Jan 2017 00:08:31 +0000 (00:08 +0000)]
[coroutines] Sema: Allow co_return all by itself.

Reviewers: rsmith, EricWF

Subscribers: mehdi_amini, llvm-commits, EricWF

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

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

7 years agoCheck that template template arguments match template template parameters
Richard Smith [Mon, 9 Jan 2017 23:54:33 +0000 (23:54 +0000)]
Check that template template arguments match template template parameters
properly even when a non-type template parameter has a dependent type.

Previously, if a non-type template parameter was dependent, but not dependent
on an outer level of template parameter, we would not match the type of the
parameter. Under [temp.arg.template], we are supposed to check that the types
are equivalent, which means checking for syntactic equivalence in the dependent
case.

This also fixes some accepts-invalids when passing templates with auto-typed
non-type template parameters as template template arguments.

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

7 years ago[cmake] Obtain LLVM_CMAKE_PATH from llvm-config
Michal Gorny [Mon, 9 Jan 2017 23:06:39 +0000 (23:06 +0000)]
[cmake] Obtain LLVM_CMAKE_PATH from llvm-config

Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config instead of reconstructing it locally.

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

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

7 years agoAdd a test for diagnose_if.
George Burgess IV [Mon, 9 Jan 2017 22:43:16 +0000 (22:43 +0000)]
Add a test for diagnose_if.

Forgot to add this file as a part of r291418.

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

7 years agoFixing test to work when the compiler defaults to a different C++ standard version.
Douglas Yung [Mon, 9 Jan 2017 22:20:10 +0000 (22:20 +0000)]
Fixing test to work when the compiler defaults to a different C++ standard version.

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

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

7 years agoMSVC seems to use (void) in __FUNCSIG__ for a zero-parameter function even in C+...
Richard Smith [Mon, 9 Jan 2017 22:16:16 +0000 (22:16 +0000)]
MSVC seems to use (void) in __FUNCSIG__ for a zero-parameter function even in C++. Follow suit.

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

7 years agoPR31587: Fix handling of __FUNCSIG__ in C.
Richard Smith [Mon, 9 Jan 2017 21:40:40 +0000 (21:40 +0000)]
PR31587: Fix handling of __FUNCSIG__ in C.

Fix crash if __FUNCSIG__ is used in a function without a prototype, and use
"(void)" as parameter list instead of "()" for a function with a no-parameters
prototype, matching MSVC's observed behavior.

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

7 years agoAllow constexpr construction of subobjects unconditionally, not just in C++14.
David L. Jones [Mon, 9 Jan 2017 21:38:07 +0000 (21:38 +0000)]
Allow constexpr construction of subobjects unconditionally, not just in C++14.

Summary:
Per https://wg21.link/CWG1677, the C++11 standard did not clarify that constant
initialization of an object allowed constexpr brace-or-equal initialization of
subobjects:

  struct foo_t { union { int i; volatile int j; } u; };

  __attribute__((__require_constant_initialization__))
  static const foo_t x = {{0}};

Because foo_t::u has a volatile member, the initializer for x fails. However,
there is really no good reason, because this:

  union foo_u { int i; volatile int j; };
  __attribute__((__require_constant_initialization__))
  static const foo_u x = {0};

does have a constant initializer.

(This was triggered by musl's pthread_mutex_t type when building under C++11.)

Reviewers: rsmith

Subscribers: EricWF, cfe-commits

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

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

7 years ago[Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin
Michal Gorny [Mon, 9 Jan 2017 20:54:20 +0000 (20:54 +0000)]
[Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin

Correct the logic used to set ATOMIC_*_LOCK_FREE preprocessor macros not
to rely on the ABI alignment of types. Instead, just assume all those
types are aligned correctly by default since clang uses safe alignment
for _Atomic types even if the underlying types are aligned to a lower
boundary by default.

For example, the 'long long' and 'double' types on x86 are aligned to
32-bit boundary by default. However, '_Atomic long long' and '_Atomic
double' are aligned to 64-bit boundary, therefore satisfying
the requirements of lock-free atomic operations.

This fixes PR #19355 by correcting the value of
__GCC_ATOMIC_LLONG_LOCK_FREE on x86, and therefore also fixing
the assumption made in libc++ tests. This also fixes PR #30581 by
applying a consistent logic between the functions used to implement
both interfaces.

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

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

7 years agoPCH: fix a regression that reports a module is defined in both pch and pcm.
Manman Ren [Mon, 9 Jan 2017 19:20:18 +0000 (19:20 +0000)]
PCH: fix a regression that reports a module is defined in both pch and pcm.

In r276159, we started to say that a module X is defined in a pch if we specify
-fmodule-name when building the pch. This caused a regression that reports
module X is defined in both pch and pcm if we generate the pch with
-fmodule-name=X and then in a separate clang invocation, we include the pch and
also import X.pcm.

This patch adds an option CompilingPCH similar to CompilingModule. When we use
-fmodule-name=X while building a pch, modular headers in X will be textually
included and the compiler knows that we are not building module X, so we don't
put module X in SUBMODULE_DEFINITION of the pch.

Differential Revision: http://reviews.llvm.org/D28415

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

7 years ago[Lit Test] Make tests C++11 compatible - nothrow destructors
Charles Li [Mon, 9 Jan 2017 18:24:16 +0000 (18:24 +0000)]
[Lit Test] Make tests C++11 compatible - nothrow destructors

In C++11, a destructor's implicit exception-spec is nothrow.
The IR for the destructor's invocation changed from invoke to call.

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

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

7 years ago[MS] Mark default args of exported default constructors as used
Reid Kleckner [Mon, 9 Jan 2017 17:27:17 +0000 (17:27 +0000)]
[MS] Mark default args of exported default constructors as used

Fixes a regression introduced in r291045, which would lead to link
errors. While we should no longer encounter unparsed or uninstantiated
default arguments in this codepath, we still need to call
CheckCXXDefaultArgExpr to mark the default argument expressions as
ODR-used.

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

7 years agoSplit dllexport default constructor closure tests out into a separate file
Reid Kleckner [Mon, 9 Jan 2017 17:25:30 +0000 (17:25 +0000)]
Split dllexport default constructor closure tests out into a separate file

test/CodeGenCXX/dllexport.cpp has grown quite large at this point. NFC

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

7 years agoFollow up to r291448: use isStructorDecl in one more place
Reid Kleckner [Mon, 9 Jan 2017 17:09:59 +0000 (17:09 +0000)]
Follow up to r291448: use isStructorDecl in one more place

This pointer comparison has shown to be error-prone, so use the standard
helper for it. NFC

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

7 years ago[clang] Enable using --section-ordering-file option of ld.gold
Alexander Shaposhnikov [Mon, 9 Jan 2017 17:06:24 +0000 (17:06 +0000)]
[clang] Enable using --section-ordering-file option of ld.gold

This diffs enables using --section-ordering-file option of ld.gold
via the variable CLANG_ORDER_FILE.

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

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

7 years ago[MS] Fix function type mangling of default ctor closures
Reid Kleckner [Mon, 9 Jan 2017 17:04:37 +0000 (17:04 +0000)]
[MS] Fix function type mangling of default ctor closures

Use the canonical decl in pointer comparisons with the default
constructor closure decl. Otherwise we don't produce the correct
"@@QAEXXZ" mangling, which essentially means "void(void) thiscall public
instance method".

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

7 years ago[cxx1z-constexpr-lambda] [NFC] Add a FIXME to reinstate certain restrictions on const...
Faisal Vali [Mon, 9 Jan 2017 11:47:51 +0000 (11:47 +0000)]
[cxx1z-constexpr-lambda] [NFC] Add a FIXME to reinstate certain restrictions on constexpr lambdas from appearing within function-signatures (CWG1607)

For further background, see Richard's comments: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20170109/181998.html

A patch to fix this is being worked on.

Thanks!

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

7 years agoUse the same ABI logic for AArch64 Big Endian as in other places
Joerg Sonnenberger [Mon, 9 Jan 2017 11:40:41 +0000 (11:40 +0000)]
Use the same ABI logic for AArch64 Big Endian as in other places
covering polys.

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

7 years agoExtend NetBSD/AArch64 to cover Big Endian as well.
Joerg Sonnenberger [Mon, 9 Jan 2017 11:22:14 +0000 (11:22 +0000)]
Extend NetBSD/AArch64 to cover Big Endian as well.

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

7 years agoclang-format: Improve support for override/final as variable names.
Daniel Jasper [Mon, 9 Jan 2017 11:04:07 +0000 (11:04 +0000)]
clang-format: Improve support for override/final as variable names.

Before:
  bool a = f() &&override.f();
  bool a = f() &&final.f();
  void f(const MyOverride & override);
  void f(const MyFinal & final);

After:
  bool a = f() && override.f();
  bool a = f() && final.f();
  void f(const MyOverride &override);
  void f(const MyFinal &final);

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

7 years ago[analyzer] Add checker for iterators dereferenced beyond their range.
Gabor Horvath [Mon, 9 Jan 2017 09:52:32 +0000 (09:52 +0000)]
[analyzer] Add checker for iterators dereferenced beyond their range.

Patch by: Adam Balogh!

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

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

7 years agoclang-format: [JS] fix broken test.
Martin Probst [Mon, 9 Jan 2017 09:00:58 +0000 (09:00 +0000)]
clang-format: [JS] fix broken test.

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

7 years agoclang-format: [JS] ASI after imports
Martin Probst [Mon, 9 Jan 2017 08:56:36 +0000 (08:56 +0000)]
clang-format: [JS] ASI after imports

Summary:
Automatic semicolon insertion should break import and export statements:

Before, this would format on one line:

  // Note: no semi after 'x' below!
  import {x} from 'x'
  export function foo() {}

Into:
  import {x} from 'x' export function foo() {}

With this change, the statements get separated.

This also improves automatic semicolon insertion to consider closing
braces preceding declarations and statements.

Reviewers: klimek

Subscribers: cfe-commits

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

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

7 years agoImplement C++ DR1391 (wg21.link/cwg1391)
Richard Smith [Mon, 9 Jan 2017 08:01:21 +0000 (08:01 +0000)]
Implement C++ DR1391 (wg21.link/cwg1391)

Check for implicit conversion sequences for non-dependent function
template parameters between deduction and substitution. The idea is to accept
as many cases as possible, on the basis that substitution failure outside the
immediate context is much more common during substitution than during implicit
conversion sequence formation.

This re-commits r290808, reverted in r290811 and r291412, with a couple of
fixes for handling of explicitly-specified non-trailing template argument
packs.

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

7 years agoImplement DR1388 (wg21.link/cwg1388).
Richard Smith [Mon, 9 Jan 2017 07:14:40 +0000 (07:14 +0000)]
Implement DR1388 (wg21.link/cwg1388).

This issue clarifies how deduction proceeds past a non-trailing function
parameter pack. Essentially, the pack itself is skipped and consumes no
arguments (except for those implied by an explicitly-specified template
arguments), and nothing is deduced from it. As a small fix to the standard's
rule, we do not allow subsequent deduction to change the length of the function
parameter pack (by preventing extension of the explicitly-specified pack if
present, and otherwise deducing all contained packs to empty packs).

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

7 years agoAdd release notes for `diagnose_if`
George Burgess IV [Mon, 9 Jan 2017 05:58:18 +0000 (05:58 +0000)]
Add release notes for `diagnose_if`

Bots seem happy with `diagnose_if` so far, so I'm optimistically adding
release notes for it.

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

7 years agoAdd the diagnose_if attribute to clang.
George Burgess IV [Mon, 9 Jan 2017 04:12:14 +0000 (04:12 +0000)]
Add the diagnose_if attribute to clang.

`diagnose_if` can be used to have clang emit either warnings or errors
for function calls that meet user-specified conditions. For example:

```
constexpr int foo(int a)
  __attribute__((diagnose_if(a > 10, "configurations with a > 10 are "
                                      "expensive.", "warning")));

int f1 = foo(9);
int f2 = foo(10); // warning: configuration with a > 10 are expensive.
int f3 = foo(f2);
```

It currently only emits diagnostics in cases where the condition is
guaranteed to always be true. So, the following code will emit no
warnings:

```
constexpr int bar(int a) {
  foo(a);
  return 0;
}

constexpr int i = bar(10);
```

We hope to support optionally emitting diagnostics for cases like that
(and emitting runtime checks) in the future.

Release notes will appear shortly. :)

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

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

7 years ago[cxx1z-constexpr-lambda] Implement constant evaluation of non-capturing lambda expres...
Faisal Vali [Mon, 9 Jan 2017 03:02:53 +0000 (03:02 +0000)]
[cxx1z-constexpr-lambda] Implement constant evaluation of non-capturing lambda expressions.

Add a visitor for lambda expressions to RecordExprEvaluator in ExprConstant.cpp that creates an empty APValue of Struct type to represent the closure object. Additionally, add a LambdaExpr visitor to the TemporaryExprEvaluator that forwards constant evaluation of immediately-called-lambda-expressions to the one in RecordExprEvaluator through VisitConstructExpr.

This patch supports:
constexpr auto ID = [] (auto a) { return a; };
static_assert(ID(3.14) == 3.14);
static_assert([](auto a) { return a + 1; }(10) == 11);

Lambda captures are still not supported for constexpr lambdas.

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

7 years agoRevert r291410 and r291411.
Richard Smith [Mon, 9 Jan 2017 01:18:18 +0000 (01:18 +0000)]
Revert r291410 and r291411.

The test-suite bots are still failing even after r291410's fix.

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

7 years agoFix test for targets whose preferred spelling for an 8-byte int is 'long long', not...
Richard Smith [Mon, 9 Jan 2017 01:10:14 +0000 (01:10 +0000)]
Fix test for targets whose preferred spelling for an 8-byte int is 'long long', not 'long'.

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

7 years agoImplement C++ DR1391 (wg21.link/cwg1391)
Richard Smith [Mon, 9 Jan 2017 00:43:47 +0000 (00:43 +0000)]
Implement C++ DR1391 (wg21.link/cwg1391)

Check for implicit conversion sequences for non-dependent function
template parameters between deduction and substitution. The idea is to accept
as many cases as possible, on the basis that substitution failure outside the
immediate context is much more common during substitution than during implicit
conversion sequence formation.

This re-commits r290808, reverted in r290811, with a fix for handling of
explicitly-specified template argument packs.

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

7 years ago[index] Introduce SymbolSubKind for reporting language-specific details.
Argyrios Kyrtzidis [Sun, 8 Jan 2017 23:21:35 +0000 (23:21 +0000)]
[index] Introduce SymbolSubKind for reporting language-specific details.

Initially reports if a constructor symbol is a copy or move constructor.

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

7 years agoUse the correct ObjC EH personality
Benjamin Kramer [Sun, 8 Jan 2017 22:58:07 +0000 (22:58 +0000)]
Use the correct ObjC EH personality

This fixes ObjC exceptions on Win64 (which uses SEH), among others.

Patch by Jonathan Schleifer!

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

7 years agoPR31514: Add recursive self-instantiation check during template argument
Richard Smith [Sun, 8 Jan 2017 22:45:21 +0000 (22:45 +0000)]
PR31514: Add recursive self-instantiation check during template argument
deduction in partial ordering.

This prevents us from crashing due to attempting to instantiate the same class
template specialization definition multiple times. (Debug builds also appear to
sometimes hit the stack limit before hitting the instantiation depth limit in
this case.)

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

7 years agoPR30305: Implement proposed DR resolution to prevent slicing via inherited constructor.
Richard Smith [Sun, 8 Jan 2017 21:45:44 +0000 (21:45 +0000)]
PR30305: Implement proposed DR resolution to prevent slicing via inherited constructor.

The rule we use is that a construction of a class type T from an argument of
type U cannot use an inherited constructor if U is the same as T or is derived
from T (or if the initialization would first convert it to such a type). This
(approximately) matches the rule in use by GCC, and matches the current proposed
DR resolution.

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

7 years ago[cxx1z-constexpr-lambda] Make conversion function constexpr, and teach the expression...
Faisal Vali [Sun, 8 Jan 2017 18:56:11 +0000 (18:56 +0000)]
[cxx1z-constexpr-lambda] Make conversion function constexpr, and teach the expression-evaluator to evaluate the static-invoker.

This patch has been sitting in review hell since july 2016 and our lack of constexpr lambda support is getting embarrassing (given that I've had a branch that implements the feature (modulo *this capture) for over a year.  While in Issaquah I was enjoying shamelessly trying to convince folks of the lie that this was Richard's fault ;) I won't be able to do so in Kona since I won't be attending - so I'm going to aim to have this feature be implemented by then.

I'm quite confident of the approach in this patch, which simply maps the static-invoker 'thunk' back to the corresponding call-operator (specialization).

Thanks!

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

7 years agoFix tests with CLANG_DEFAULT_LINKER
Jonas Hahnfeld [Sun, 8 Jan 2017 10:04:07 +0000 (10:04 +0000)]
Fix tests with CLANG_DEFAULT_LINKER

I originally requested this to be tested in D25263 but in the end
forgot to make sure that it was done.

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

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

7 years agoPR18402: work around bug in libstdc++4.8's detection of whether ::gets exists.
Richard Smith [Sun, 8 Jan 2017 04:01:15 +0000 (04:01 +0000)]
PR18402: work around bug in libstdc++4.8's detection of whether ::gets exists.

This should allow clang to successfully compile libstdc++4.8's headers in C++14
mode.

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

7 years agoFix buildbots.
Richard Smith [Sat, 7 Jan 2017 19:58:39 +0000 (19:58 +0000)]
Fix buildbots.

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

7 years agoConsistently use a ConstantEvaluated context for expressions in attributes,
Richard Smith [Sat, 7 Jan 2017 19:42:26 +0000 (19:42 +0000)]
Consistently use a ConstantEvaluated context for expressions in attributes,
except for those with the "attributes are unevaluated contexts" flag.

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

7 years agoPR20090: Add (passing) test from this bug; it's been fixed for a while.
Richard Smith [Sat, 7 Jan 2017 00:52:10 +0000 (00:52 +0000)]
PR20090: Add (passing) test from this bug; it's been fixed for a while.

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

7 years agoPR23135: Don't instantiate constexpr functions referenced in unevaluated operands...
Richard Smith [Sat, 7 Jan 2017 00:48:55 +0000 (00:48 +0000)]
PR23135: Don't instantiate constexpr functions referenced in unevaluated operands where possible.

This implements something like the current direction of DR1581: we use a narrow
syntactic check to determine the set of places where a constant expression
could be evaluated, and only instantiate a constexpr function or variable if
it's referenced in one of those contexts, or is odr-used.

It's not yet clear whether this is the right set of syntactic locations; we
currently consider all contexts within templates that would result in odr-uses
after instantiation, and contexts within list-initialization (narrowing
conversions take another victim...), as requiring instantiation. We could in
principle restrict the former cases more (only const integral / reference
variable initializers, and contexts in which a constant expression is required,
perhaps). However, this is sufficient to allow us to accept libstdc++ code,
which relies on GCC's behavior (which appears to be somewhat similar to this
approach).

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

7 years ago[ThinLTO] Specify target triple in new test
Teresa Johnson [Sat, 7 Jan 2017 00:09:42 +0000 (00:09 +0000)]
[ThinLTO] Specify target triple in new test

This should fix bot failures in this test.

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

7 years ago[ThinLTO] Optionally ignore empty index file
Teresa Johnson [Fri, 6 Jan 2017 23:37:33 +0000 (23:37 +0000)]
[ThinLTO] Optionally ignore empty index file

Summary:
In order to simplify distributed build system integration, where actions
may be scheduled before the Thin Link which determines the list of
objects selected by the linker. The gold plugin currently will emit
0-sized index files for objects not selected by the link, to enable
checking for expected output files by the build system. If the build
system then schedules a backend action for these bitcode files, we want
to be able to fall back to normal compilation instead of failing.

Fallback is enabled under an option in LLVM (D28410), in which case a
nullptr is returned from llvm::getModuleSummaryIndexForFile. Clang can
just proceed with non-ThinLTO compilation in that case.

I am investigating whether this can be addressed in our build system,
but that is a longer term fix and so this enables a workaround in the
meantime.

Reviewers: mehdi_amini

Subscribers: cfe-commits

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

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