Commit Graph

46481 Commits

Author SHA1 Message Date
Benjamin Kramer bc9ef590cb [Basic] Remove source manager references from diag state points.
This is just wasted space, we don't support state points from multiple
source managers. Validate that there's no state when resetting the
source manager and use the 'global' reference to the sourcemanager
instead of the ones in the diag state.

llvm-svn: 292402
2017-01-18 15:50:26 +00:00
Arpith Chacko Jacob 42793e000a Revert r292374 to debug Windows buildbot failure.
llvm-svn: 292400
2017-01-18 15:36:05 +00:00
Jonathan Roelofs 8277c41a89 Warn when calling a non interrupt function from an interrupt on ARM
The idea for this originated from a really tricky bug: ISRs on ARM don't
automatically save off the VFP regs, so if say, memcpy gets interrupted and the
ISR itself calls memcpy, the regs are left clobbered when the ISR is done.

https://reviews.llvm.org/D28820

llvm-svn: 292375
2017-01-18 15:31:11 +00:00
Arpith Chacko Jacob 68019578a3 [OpenMP] Codegen support for 'target parallel' on the host.
This patch adds support for codegen of 'target parallel' on the host.
It is also the first combined directive that requires two or more
captured statements.  Support for this functionality is included in
the patch.

A combined directive such as 'target parallel' has two captured
statements, one for the 'target' and the other for the 'parallel'
region.  Two captured statements are required because each has
different implicit parameters (see SemaOpenMP.cpp).  For example,
the 'parallel' has 'global_tid' and 'bound_tid' while the 'target'
does not.  The patch adds support for handling multiple captured
statements based on the combined directive.

When codegen'ing the 'target parallel' directive, the 'target'
outlined function is created using the outer captured statement
and the 'parallel' outlined function is created using the inner
captured statement.

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

llvm-svn: 292374
2017-01-18 15:14:52 +00:00
Renato Golin 629f397af3 Revert "[xray] try to fix thumb buildbot"
This reverts commit r292268, as it didn't fix the buildbots.

llvm-svn: 292355
2017-01-18 09:05:32 +00:00
Craig Topper 367c86ddbe [AVX-512] Replace subvector broadcast builtins with shufflevectors and selects.
Verified that the backend codegens this equally well.

llvm-svn: 292329
2017-01-18 02:17:10 +00:00
Dan Gohman 839f215e19 [WebAssembly] Add minimal support for the new wasm object format triple.
llvm-svn: 292269
2017-01-17 21:46:38 +00:00
Renato Golin 0d4797d635 [xray] try to fix thumb buildbot
llvm-svn: 292268
2017-01-17 21:37:24 +00:00
Akira Hatanaka 8eccb9bbb1 [Sema] Fix bug in handling of designated initializer.
CheckDesignatedInitializer wasn't taking into account the base classes
when computing the index for the field in the derived class, which
caused the test case to crash during IRGen because of a malformed AST.

rdar://problem/26795040

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

llvm-svn: 292245
2017-01-17 19:35:54 +00:00
George Rimar c39f5491a4 [Clang] - Update code to match upcoming llvm::zlib API.
D28684 changed llvm::zlib to return Error instead of Status.
It was accepted and committed in r292214, but then reverted in r292217
because I missed that clang code also needs to be updated.

Patch do that.

D28684 recommitted again as r292226

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

llvm-svn: 292227
2017-01-17 15:45:31 +00:00
Frederic Riss 1633f68fe1 Fix AArch64 global-merge backend option name.
-mglobal-merge is translated to the appropriate backend option in
the driver. r277322 changed the AArch64 option name in the backend,
but the driver was never updated.

llvm-svn: 292192
2017-01-17 03:38:45 +00:00
Richard Smith 957fbf1f9f Partial revert of r290511.
The rules around typechecking deduced template arguments during partial
ordering are not clear, and while the prior behavior does not seem to be
correct (it doesn't follow the general model of partial ordering where each
template parameter is replaced by a non-dependent but unique value), the new
behavior is also not clearly right and breaks some existing idioms.

The new behavior is retained for dealing with non-type template parameters
with 'auto' types, as without it even the most basic uses of that feature
don't work. We can revisit this once CWG has come to an agreement on how
partial ordering with 'auto' non-type template parameters is supposed to
work.

llvm-svn: 292183
2017-01-17 02:14:37 +00:00
Antonio Maiorano 3adfb6a3ee clang-format: Make GetStyle return Expected<FormatStyle> instead of FormatStyle
Change the contract of GetStyle so that it returns an error when an error occurs
(i.e. when it writes to stderr), and only returns the fallback style when it
can't find a configuration file.

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

llvm-svn: 292174
2017-01-17 00:12:27 +00:00
Pavel Labath d570a61a6c [StaticAnalyzer] Fix android build
std::to_string is not available in the android NDK. Use llvm::to_string instead.

Committing as obvious.

llvm-svn: 292141
2017-01-16 15:57:07 +00:00
Arpith Chacko Jacob 43a8b7bc8c [OpenMP] Refactor code that calls codegen for target regions on the device.
This patch refactors code that calls codegen for target regions.  Currently
the codebase only supports the 'target' directive.  The patch pulls out
common target processing code into a static function that can be called
by codegen for any target directive.

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

llvm-svn: 292134
2017-01-16 15:26:02 +00:00
Joerg Sonnenberger 8450266425 Ensure that clang -pthread creates the right macro. -D_POSIX_THREADS
seems to have been a C&P error from old GCC specs for OpenBSD.

llvm-svn: 292119
2017-01-16 14:07:24 +00:00
Daniel Jasper 240527ca99 clang-format: Always wrap before multi-line parameters/operands.
Before:
  aaaaaaaaaaaaaaaaaa(aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa::
                                   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                     aaaaaaaaaaaaaaaaaaaaa);

After:
  aaaaaaaaaaaaaaaaaa(aaaaaaaa,
                     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa::
                         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                     aaaaaaaaaaaaaaaaaaaaa);

No new test cases, as the existing ones cover this fairly well.

llvm-svn: 292110
2017-01-16 13:13:15 +00:00
Martin Probst e6b5b34f6f clang-format: [JS] revert over-eager ASI check.
Summary: Change r291428 introduced ASI detection after closing curly braces. That would generally be correct, however this breaks indentation for structural statements. What happens is that CompoundStatementIndenter increases indentation for the current line, then after reading ASI creates a new line (with the increased line level), and only after the structural parser sees e.g. the if/then/else branch closed, line level is reduced. That leads to the new line started by ASI having a level too high.

Reviewers: djasper

Subscribers: sammccall, cfe-commits, klimek

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

llvm-svn: 292099
2017-01-16 09:52:40 +00:00
Argyrios Kyrtzidis 0516803ca5 [code-completion] Fix crash when trying to do postfix completion of instance member inside a static function.
llvm-svn: 292052
2017-01-15 06:11:04 +00:00
Yaron Keren fa3674017a Fix PR31644 introduced by r287138 and add a regression test.
Thanks Dimitry Andric for the report and fix!

llvm-svn: 292032
2017-01-14 21:12:08 +00:00
George Burgess IV d5c7e7c113 Fix a typo. NFC.
llvm-svn: 291997
2017-01-14 05:19:34 +00:00
Richard Smith 0c062b408b 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.

llvm-svn: 291988
2017-01-14 02:19:59 +00:00
Daniel Jasper e61f9f9949 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;

llvm-svn: 291974
2017-01-13 23:18:16 +00:00
Richard Smith 509bbd1a66 PR31631: fix bad CFG (and bogus warnings) when an if-statement has an init-statement and has binary operator as its condition.
llvm-svn: 291964
2017-01-13 22:16:41 +00:00
Richard Smith 836a3b416d PR31606: Generalize our tentative DR resolution for inheriting copy/move
constructors to better match the pre-P0136R1 behavior.

llvm-svn: 291955
2017-01-13 20:46:54 +00:00
Malcolm Parsons c6e4583dbb Remove unused lambda captures. NFC
llvm-svn: 291939
2017-01-13 18:55:32 +00:00
David Blaikie 6ad71010ab unique_ptrify Driver::ToolChains
llvm-svn: 291938
2017-01-13 18:53:43 +00:00
David Blaikie 0aaa7625e1 unique_ptrify createDriverOptTable
llvm-svn: 291919
2017-01-13 17:34:15 +00:00
Reid Kleckner 791bbf6f18 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.

llvm-svn: 291917
2017-01-13 17:18:19 +00:00
Malcolm Parsons 87a036259b [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

llvm-svn: 291905
2017-01-13 15:01:06 +00:00
Richard Smith 8210ed5586 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.

llvm-svn: 291880
2017-01-13 02:22:01 +00:00
Shoaib Meenai 5adfb5a814 [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

llvm-svn: 291877
2017-01-13 01:28:34 +00:00
Ekaterina Romanova 2e041c9c20 [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

llvm-svn: 291876
2017-01-13 01:14:08 +00:00
Dehao Chen a1bd2d6585 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

llvm-svn: 291870
2017-01-13 00:51:55 +00:00
Anna Zaks b570195c3a [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

llvm-svn: 291869
2017-01-13 00:50:57 +00:00
Anna Zaks e43b4fc0ae [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

llvm-svn: 291868
2017-01-13 00:50:50 +00:00
Anna Zaks dcfc191404 [analyzer] Support inlining of '[self classMethod]' and '[[self class] classMethod]'
Differential Revision: https://reviews.llvm.org/D28495

llvm-svn: 291867
2017-01-13 00:50:47 +00:00
Anna Zaks 14b1af5dcd [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

llvm-svn: 291866
2017-01-13 00:50:41 +00:00
Richard Smith fbe2369f1a 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.

llvm-svn: 291865
2017-01-13 00:43:31 +00:00
Chandler Carruth 5b4081198a 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.

llvm-svn: 291850
2017-01-12 22:40:13 +00:00
Daniel Jasper e37101076c clang-format: Fix regression introduced by r291801.
Uncovered by polly tests.

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

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

llvm-svn: 291807
2017-01-12 20:06:28 +00:00
Daniel Jasper d1a9d8acdf 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});

llvm-svn: 291801
2017-01-12 19:35:26 +00:00
Bruno Cardoso Lopes 052d95a6d6 [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.

llvm-svn: 291794
2017-01-12 19:15:33 +00:00
Artem Dergachev 1d4fb84d82 [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

llvm-svn: 291781
2017-01-12 18:00:03 +00:00
Dehao Chen 37c79c236d Revert r291774 which caused buildbot failure.
llvm-svn: 291775
2017-01-12 16:56:18 +00:00
Dehao Chen bd3689de91 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

llvm-svn: 291774
2017-01-12 16:29:25 +00:00
Malcolm Parsons a3220ce6a3 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

llvm-svn: 291771
2017-01-12 16:11:28 +00:00
Alex Lorenz 569ad73d6b 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

llvm-svn: 291757
2017-01-12 10:48:03 +00:00
Artem Dergachev c9affb0dbd [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

llvm-svn: 291754
2017-01-12 09:46:16 +00:00
Vassil Vassilev 352e4412e1 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).

llvm-svn: 291753
2017-01-12 09:16:26 +00:00
Richard Smith 3beb7c6b5f 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.

llvm-svn: 291737
2017-01-12 02:27:38 +00:00
Argyrios Kyrtzidis 2a89c8594d [index] Introduce symbol subkinds to mark an accessor getter or setter.
llvm-svn: 291707
2017-01-11 21:42:48 +00:00
Argyrios Kyrtzidis 38004319fa [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.

llvm-svn: 291705
2017-01-11 21:08:31 +00:00
Argyrios Kyrtzidis de0f50886f [index] Add 'IBTypeOf' relation for ObjC methods marked with IBAction and properties with IBOutletCollection.
llvm-svn: 291703
2017-01-11 21:01:07 +00:00
Tony Jiang 974e4c7899 [PowerPC] Fix the wrong implementation of builtin vec_rlnm.
llvm-svn: 291702
2017-01-11 20:59:42 +00:00
Argyrios Kyrtzidis df60aa83a3 [index] Add 'contained-by' relation between references and their lexical container.
llvm-svn: 291700
2017-01-11 20:51:10 +00:00
Manman Ren 9803ee8e9a 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).

llvm-svn: 291689
2017-01-11 18:47:38 +00:00
Manman Ren 3e9dea024e 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.

llvm-svn: 291688
2017-01-11 18:32:30 +00:00
Malcolm Parsons ffd21d3961 Remove repeated word in comment (NFC)
llvm-svn: 291667
2017-01-11 11:23:22 +00:00
Bruno Cardoso Lopes ba1b5c98ba [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

llvm-svn: 291644
2017-01-11 02:14:51 +00:00
Devin Coughlin aac894feba [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

llvm-svn: 291635
2017-01-11 01:02:34 +00:00
Manman Ren 7f41c4d802 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

llvm-svn: 291628
2017-01-11 00:48:19 +00:00
Richard Smith 20d252c4c1 Remove dead code.
llvm-svn: 291610
2017-01-10 23:04:46 +00:00
Richard Smith 623270694b Remove a couple of parameters that are always false.
llvm-svn: 291608
2017-01-10 22:59:18 +00:00
Reid Kleckner 0d15738f3b Serialize the UsesSEH bit on FunctionDecl
Fixes PR31539

llvm-svn: 291600
2017-01-10 21:27:03 +00:00
Kostya Kortchinsky af6a9b982c [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

llvm-svn: 291598
2017-01-10 21:13:08 +00:00
Richard Smith 9d05e15c3a 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.

llvm-svn: 291597
2017-01-10 20:52:50 +00:00
Richard Smith 14ead30ab8 Fix conversion index / argument index mismatch when diagnosing overload resolution failure.
llvm-svn: 291596
2017-01-10 20:19:21 +00:00
Chad Rosier c22abb3820 [ARM] Use generic bitreverse intrinsic, rather than ARM specific rbit.
The backend already supports lowering this intrinsic to a rbit instruction.

llvm-svn: 291582
2017-01-10 18:55:11 +00:00
Devin Coughlin dc9834f912 [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

llvm-svn: 291581
2017-01-10 18:49:27 +00:00
Kelvin Li da68118729 [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

llvm-svn: 291579
2017-01-10 18:08:18 +00:00
Matthias Braun 44bfe03da9 CGDecl: Skip static variable initializers in unreachable code
This fixes http://llvm.org/PR31054

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

llvm-svn: 291576
2017-01-10 17:43:01 +00:00
Chad Rosier 5a4a1be690 [AArch64] Use generic bitreverse intrinsic, rather than AArch64 specific.
Differential Revision: https://reviews.llvm.org/D28400

llvm-svn: 291574
2017-01-10 17:20:28 +00:00
Arpith Chacko Jacob bb36fe8dba [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

llvm-svn: 291565
2017-01-10 15:42:51 +00:00
Alex Lorenz 0e613727ee [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

llvm-svn: 291564
2017-01-10 14:41:13 +00:00
Vassil Vassilev 2999d0e8bb Remove fixme, use ASTContext::getCanonicalTemplateSpecializationType.
Reviewed by Richard Smith (D28306).

llvm-svn: 291552
2017-01-10 09:09:09 +00:00
Richard Smith 9451c35982 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!

llvm-svn: 291551
2017-01-10 08:51:46 +00:00
Craig Topper c45744ad93 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

llvm-svn: 291544
2017-01-10 06:02:12 +00:00
Kelvin Li 4101032e5f [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

llvm-svn: 291540
2017-01-10 05:15:35 +00:00
Kelvin Li c4bfc6fa8f [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

llvm-svn: 291537
2017-01-10 04:26:44 +00:00
Richard Smith f388f78bc6 Don't classify variable template names as type templates.
llvm-svn: 291528
2017-01-10 02:15:49 +00:00
Faisal Vali e1403990b7 [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.

llvm-svn: 291525
2017-01-10 01:29:41 +00:00
Gor Nishanov d97f6bfbb1 [coroutines] Sema: Allow co_return all by itself.
Reviewers: rsmith, EricWF

Subscribers: mehdi_amini, llvm-commits, EricWF

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

llvm-svn: 291513
2017-01-10 00:08:31 +00:00
Richard Smith 43a833bec4 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.

llvm-svn: 291512
2017-01-09 23:54:33 +00:00
Richard Smith cf63b845df MSVC seems to use (void) in __FUNCSIG__ for a zero-parameter function even in C++. Follow suit.
llvm-svn: 291489
2017-01-09 22:16:16 +00:00
Richard Smith 2f63d4612f 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.

llvm-svn: 291484
2017-01-09 21:40:40 +00:00
David L. Jones f55ce36c02 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

llvm-svn: 291480
2017-01-09 21:38:07 +00:00
Michal Gorny dc155744c8 [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

llvm-svn: 291477
2017-01-09 20:54:20 +00:00
Manman Ren ffd3e9d766 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

llvm-svn: 291465
2017-01-09 19:20:18 +00:00
Reid Kleckner 82713bf352 [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.

llvm-svn: 291453
2017-01-09 17:27:17 +00:00
Reid Kleckner e4bb54a855 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

llvm-svn: 291450
2017-01-09 17:09:59 +00:00
Reid Kleckner 290feb9c19 [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".

llvm-svn: 291448
2017-01-09 17:04:37 +00:00
Faisal Vali 20f0cf9767 [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!

llvm-svn: 291439
2017-01-09 11:47:51 +00:00
Joerg Sonnenberger 47006c5fcd Use the same ABI logic for AArch64 Big Endian as in other places
covering polys.

llvm-svn: 291437
2017-01-09 11:40:41 +00:00
Joerg Sonnenberger 79557db932 Extend NetBSD/AArch64 to cover Big Endian as well.
llvm-svn: 291436
2017-01-09 11:22:14 +00:00
Daniel Jasper c941e7d21b 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);

llvm-svn: 291434
2017-01-09 11:04:07 +00:00
Gabor Horvath 3d57457298 [analyzer] Add checker for iterators dereferenced beyond their range.
Patch by: Adam Balogh!

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

llvm-svn: 291430
2017-01-09 09:52:32 +00:00
Martin Probst d40bca431d 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

llvm-svn: 291428
2017-01-09 08:56:36 +00:00
Richard Smith 6eedfe77c1 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.

llvm-svn: 291427
2017-01-09 08:01:21 +00:00
Richard Smith de0d34a576 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).

llvm-svn: 291425
2017-01-09 07:14:40 +00:00