]> granicus.if.org Git - clang/log
clang
7 years ago[code-completion] Fix crash when trying to do postfix completion of instance member...
Argyrios Kyrtzidis [Sun, 15 Jan 2017 06:11:04 +0000 (06:11 +0000)]
[code-completion] Fix crash when trying to do postfix completion of instance member inside a static function.

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

7 years agoFix PR31644 introduced by r287138 and add a regression test.
Yaron Keren [Sat, 14 Jan 2017 21:12:08 +0000 (21:12 +0000)]
Fix PR31644 introduced by r287138 and add a regression test.
Thanks Dimitry Andric for the report and fix!

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

7 years agoUpdate the tests to match the typo fix done in r292015
Sylvestre Ledru [Sat, 14 Jan 2017 12:00:40 +0000 (12:00 +0000)]
Update the tests to match the typo fix done in r292015

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

7 years agofix a few typo in the doc but also in the clang messages
Sylvestre Ledru [Sat, 14 Jan 2017 11:41:45 +0000 (11:41 +0000)]
fix a few typo in the doc but also in the clang messages

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

7 years agoAdd LLVMOption to clang-interpreter, corresponding to r291938.
NAKAMURA Takumi [Sat, 14 Jan 2017 08:54:05 +0000 (08:54 +0000)]
Add LLVMOption to clang-interpreter, corresponding to r291938.

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

7 years agoFix a typo. NFC.
George Burgess IV [Sat, 14 Jan 2017 05:19:34 +0000 (05:19 +0000)]
Fix a typo. NFC.

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

7 years agoGive more accurate descriptions of what kind of template we found in diagnostics.
Richard Smith [Sat, 14 Jan 2017 02:19:59 +0000 (02:19 +0000)]
Give more accurate descriptions of what kind of template we found in diagnostics.

We were previouly assuming that every type template was a class template, which
is not true any more.

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

7 years agoclang-format: Fix bug in making line break decisions.
Daniel Jasper [Fri, 13 Jan 2017 23:18:16 +0000 (23:18 +0000)]
clang-format: Fix bug in making line break decisions.

Here, the optimization to not line wrap when it would not lead to a
reduction in columns was overwriting and enforced break that we want to
do no matter what.

Before:
  int i = someFunction(
              aaaaaaa,
              0).aaa(aaaaaaaaaaaaa) *
              aaaaaaa +
          aaaaaaa;

After:
  int i = someFunction(aaaaaaa, 0)
                  .aaa(aaaaaaaaaaaaa) *
              aaaaaaa +
          aaaaaaa;

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

7 years agoPR31631: fix bad CFG (and bogus warnings) when an if-statement has an init-statement...
Richard Smith [Fri, 13 Jan 2017 22:16:41 +0000 (22:16 +0000)]
PR31631: fix bad CFG (and bogus warnings) when an if-statement has an init-statement and has binary operator as its condition.

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

7 years ago[clang] Emit `diagnose_if` warnings from system headers
Eric Fiselier [Fri, 13 Jan 2017 22:11:40 +0000 (22:11 +0000)]
[clang] Emit `diagnose_if` warnings from system headers

Summary: In order for libc++ to meaningfully use `diagnose_if` warnings they need to be emitted from system headers by default. This patch changes the `diagnose_if` warning diagnostic to be shown in system headers.

Reviewers: george.burgess.iv, rsmith, aaron.ballman

Subscribers: cfe-commits

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

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

7 years agoPR31606: Generalize our tentative DR resolution for inheriting copy/move
Richard Smith [Fri, 13 Jan 2017 20:46:54 +0000 (20:46 +0000)]
PR31606: Generalize our tentative DR resolution for inheriting copy/move
constructors to better match the pre-P0136R1 behavior.

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

7 years agoFix shared library build after r291938 by adding missing dependency on libOption
David Blaikie [Fri, 13 Jan 2017 19:47:55 +0000 (19:47 +0000)]
Fix shared library build after r291938 by adding missing dependency on libOption

Thanks to Reid Kleckner for the help reproducing/fixing.

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

7 years agoRemove unused lambda captures. NFC
Malcolm Parsons [Fri, 13 Jan 2017 18:55:32 +0000 (18:55 +0000)]
Remove unused lambda captures. NFC

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

7 years agounique_ptrify Driver::ToolChains
David Blaikie [Fri, 13 Jan 2017 18:53:43 +0000 (18:53 +0000)]
unique_ptrify Driver::ToolChains

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

7 years agounique_ptrify createDriverOptTable
David Blaikie [Fri, 13 Jan 2017 17:34:15 +0000 (17:34 +0000)]
unique_ptrify createDriverOptTable

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

7 years agoUse less byval on 32-bit Windows x86 for classes with bases
Reid Kleckner [Fri, 13 Jan 2017 17:18:19 +0000 (17:18 +0000)]
Use less byval on 32-bit Windows x86 for classes with bases

This comes up in V8, which has a Handle template class that wraps a
typed pointer, and is frequently passed by value. The pointer is stored
in the base, HandleBase. This change allows us to pass the struct as a
pointer instead of using byval. This avoids creating tons of temporary
allocas that we copy from during call lowering.

Eventually, it would be good to use FCAs here instead.

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

7 years agoRevert "Support for Python 3 in libclang python bindings"
Jonathan Coe [Fri, 13 Jan 2017 16:06:59 +0000 (16:06 +0000)]
Revert "Support for Python 3 in libclang python bindings"

This reverts commit 4464581bb63e9789e9ee231a8c8800be5f614743.

Memory access issues on Linux were reported by Mathieu Duponchelle and
discussed here: https://reviews.llvm.org/D26082.

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

7 years ago[Sema] Add warning for unused lambda captures
Malcolm Parsons [Fri, 13 Jan 2017 15:01:06 +0000 (15:01 +0000)]
[Sema] Add warning for unused lambda captures

Summary:
Warn when a lambda explicitly captures something that is not used in its body.

The warning is part of -Wunused and can be enabled with -Wunused-lambda-capture.

Reviewers: rsmith, arphaman, jbcoe, aaron.ballman

Subscribers: Quuxplusone, arphaman, cfe-commits

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

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

7 years agoAnother fix for r291850 because there are apparently targets which add
Chandler Carruth [Fri, 13 Jan 2017 02:47:34 +0000 (02:47 +0000)]
Another fix for r291850 because there are apparently targets which add
"-mllvm" flags to the CC1 invocation (notably, Hexagon seems to hit
this).

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

7 years agoImplement DR1265 (wg21.link/cwg1265).
Richard Smith [Fri, 13 Jan 2017 02:22:01 +0000 (02:22 +0000)]
Implement DR1265 (wg21.link/cwg1265).

Diasllow a declaration using the 'auto' type specifier from using two different
meanings of it at once, or from declaring multiple functions with deduced
return types or introducing multiple trailing return types.

The standard does not technically disallow the multiple trailing return types
case if all the declarators declare variables (such as function pointers with
trailing return types), but we disallow that too, following the clear intent.

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

7 years agoAdd a necessary newline for diagnose_if documentation.
Eric Christopher [Fri, 13 Jan 2017 01:52:04 +0000 (01:52 +0000)]
Add a necessary newline for diagnose_if documentation.

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

7 years ago[Sema] Restrict explicit instantation definition dllexport
Shoaib Meenai [Fri, 13 Jan 2017 01:28:34 +0000 (01:28 +0000)]
[Sema] Restrict explicit instantation definition dllexport

In the case where the template class itself is already `dllexport`, the
implicit instantiation will have already emitted all members. When we
check the explicit instantiation definition, the `Specialization` will
have inherited the `dllexport` attribute, so we'll attempt to emit all
members for a second time, which causes an assertion failure. Restrict
the exporting to when the `dllexport` attribute is newly introduced by
the explicit instantiation definition.

Fixes PR31608.

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

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

7 years ago[DOXYGEN] Documentation for the newly added x86 intrinsics.
Ekaterina Romanova [Fri, 13 Jan 2017 01:14:08 +0000 (01:14 +0000)]
[DOXYGEN] Documentation for the newly added x86 intrinsics.

Added doxygen comments for the newly added intrinsics in avxintrin.h, namely _mm256_cvtsd_f64, _mm256_cvtsi256_si32 and _mm256_cvtss_f32

Added doxygen comments for the new intrinsics in emmintrin.h, namely _mm_loadu_si64 and _mm_load_sd.

Explicit parameter names were added for _mm_clflush and _mm_setcsr

The rest of the changes are editorial, removing trailing spaces at the end of the lines.

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

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

7 years agoTemporarily revert the test change in 291870, which is broken in certain buildbots.
Dehao Chen [Fri, 13 Jan 2017 01:09:43 +0000 (01:09 +0000)]
Temporarily revert the test change in 291870, which is broken in certain buildbots.

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

7 years agoUpdate C++ status pages for Clang 4 branch:
Richard Smith [Fri, 13 Jan 2017 00:57:54 +0000 (00:57 +0000)]
Update C++ status pages for Clang 4 branch:

 * Update version number in DR tests from 4.0 to 4
 * Teach make_cxx_dr_status script about version numbers that don't contain a
   period.
 * Update cxx_status.html and cxx_dr_status.html to list Clang 4 features as
   "Clang 4" rather than "SVN"

Clang 4 features are still listed in yellow rather than green until release.

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

7 years agoPass -fprofile-sample-use to lto backends.
Dehao Chen [Fri, 13 Jan 2017 00:51:55 +0000 (00:51 +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@291870 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Add LocationContext as a parameter to checkRegionChanges
Anna Zaks [Fri, 13 Jan 2017 00:50:57 +0000 (00:50 +0000)]
[analyzer] Add LocationContext as a parameter to checkRegionChanges

This patch adds LocationContext to checkRegionChanges and removes
wantsRegionChangeUpdate as it was unused.

A patch by Krzysztof Wiśniewski!

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

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

7 years ago[tsan] Do not report errors in __destroy_helper_block_
Anna Zaks [Fri, 13 Jan 2017 00:50:50 +0000 (00:50 +0000)]
[tsan] Do not report errors in __destroy_helper_block_

There is a synchronization point between the reference count of a block dropping to zero and it's destruction, which TSan does not observe. Do not report errors in the compiler-emitted block destroy method and everything called from it.

This is similar to https://reviews.llvm.org/D25857

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

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

7 years ago[analyzer] Support inlining of '[self classMethod]' and '[[self class] classMethod]'
Anna Zaks [Fri, 13 Jan 2017 00:50:47 +0000 (00:50 +0000)]
[analyzer] Support inlining of '[self classMethod]' and '[[self class] classMethod]'

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

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

7 years ago[analyzer] Fix false positives in Keychain API checker
Anna Zaks [Fri, 13 Jan 2017 00:50:41 +0000 (00:50 +0000)]
[analyzer] Fix false positives in Keychain API checker

The checker has several false positives that this patch addresses:
- Do not check if the return status has been compared to error (or no error) at the time when leaks are reported since the status symbol might no longer be alive. Instead, pattern match on the assume and stop tracking allocated symbols on error paths.
- The checker used to report error when an unknown symbol was freed. This could lead to false positives, let's not repot those. This leads to loss of coverage in double frees.
- Do not enforce that we should only call free if we are sure that error was not returned and the pointer is not null. That warning is too noisy and we received several false positive reports about it. (I removed: "Only call free if a valid (non-NULL) buffer was returned")
- Use !isDead instead of isLive in leak reporting. Otherwise, we report leaks for objects we loose track of. This change triggered change #1.

This also adds checker specific dump to the state.

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

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

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