]> granicus.if.org Git - clang/log
clang
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

7 years agoAdd a cc1 option to force disabling lifetime-markers emission from clang
Mehdi Amini [Fri, 6 Jan 2017 23:18:09 +0000 (23:18 +0000)]
Add a cc1 option to force disabling lifetime-markers emission from clang

Summary: This intended as a debugging/development flag only.

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

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

7 years agoRevisit PR10177: don't instantiate a variable if it's only referenced in a
Richard Smith [Fri, 6 Jan 2017 22:52:53 +0000 (22:52 +0000)]
Revisit PR10177: don't instantiate a variable if it's only referenced in a
dependent context and can't be used in a constant expression.

Per C++ [temp.inst]p2, "the instantiation of a static data member does not
occur unless the static data member is used in a way that requires the
definition to exist".

This doesn't /quite/ match that, as we still instantiate static data members
that are usable in constant expressions even if the use doesn't require a
definition. A followup patch will fix that for both variables and functions.

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

7 years agoUse CodegenOpts::less when creating a TargetMachine for clang `-O1`
Mehdi Amini [Fri, 6 Jan 2017 20:52:30 +0000 (20:52 +0000)]
Use CodegenOpts::less when creating a TargetMachine for clang `-O1`

Summary:
Clang was initializing the TargetMachine with CodeGenOpt::Default
for O1. This change is aligning it on llc:

-O0: OptLevel = CodeGenOpt::None
-O1: OptLevel = CodeGenOpt::Less
-O2 -Os -Oz: OptLevel = CodeGenOpt::Default
-O3: OptLevel = CodeGenOpt::Aggressive

Reviewers: echristo, chandlerc

Subscribers: cfe-commits

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

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

7 years agoReapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCom...
David Blaikie [Fri, 6 Jan 2017 19:49:01 +0000 (19:49 +0000)]
Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer"

Aleksey Shlypanikov pointed out my mistake in migrating an explicit
unique_ptr to auto - I was expecting the function returned a unique_ptr,
but instead it returned a raw pointer - introducing a leak.

Thanks Aleksey!

This reapplies r291184, reverted in r291249.

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

7 years agoClean up redundant isa<T> before getAs<T>. NFC.
George Burgess IV [Fri, 6 Jan 2017 19:10:48 +0000 (19:10 +0000)]
Clean up redundant isa<T> before getAs<T>. NFC.

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

7 years ago[OpenMP] fix typo - the standalone 'distribute' pragma should be 'teams distribute...
Kelvin Li [Fri, 6 Jan 2017 18:49:49 +0000 (18:49 +0000)]
[OpenMP] fix typo - the standalone 'distribute' pragma should be 'teams distribute' pragma

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

7 years ago[CUDA] Add a host target triple to cuda-version-check.cu
Reid Kleckner [Fri, 6 Jan 2017 18:16:03 +0000 (18:16 +0000)]
[CUDA] Add a host target triple to cuda-version-check.cu

It passes --sysroot for the Linux CUDA installation. To make this test
pass when targetting Windows, you would need to pass
--sysroot=Inputs/CUDA-windows.

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

7 years agoMake ASTContext::getDeclAlign return the correct alignment for
Akira Hatanaka [Fri, 6 Jan 2017 17:56:15 +0000 (17:56 +0000)]
Make ASTContext::getDeclAlign return the correct alignment for
FunctionDecls.

This commit silences an incorrect warning that is issued when a function
pointer is cast to another function pointer type. The warning gets
issued because alignments of the source and destination do not match in
Sema::CheckCastAlign, which happens because ASTContext::getTypeInfoImpl
and ASTContext::getDeclAlign return different values for functions (the
former returns 4 while the latter returns 1).

This should fix PR31558.

rdar://problem/29533528

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

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

7 years agoRevert "Fix examples for recent shared_ptrification"
David Blaikie [Fri, 6 Jan 2017 17:50:34 +0000 (17:50 +0000)]
Revert "Fix examples for recent shared_ptrification"

(should've rolled in to this revert of the CompilerInstance change in
the first place... anyway)

This reverts commit r291185.

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

7 years agoRevert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeComp...
David Blaikie [Fri, 6 Jan 2017 17:47:10 +0000 (17:47 +0000)]
Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer"

Caused a memory leak reported by asan. Reverting while I investigate.

This reverts commit r291184.

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

7 years ago[OpenCL] Re-enable supported core extensions based on opencl version when disabling...
Konstantin Zhuravlyov [Fri, 6 Jan 2017 16:14:41 +0000 (16:14 +0000)]
[OpenCL] Re-enable supported core extensions based on opencl version when disabling all extensions using pragma

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

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

7 years ago[ubsan] Minimize size of data for type_mismatch (Redo of D19667)
Filipe Cabecinhas [Fri, 6 Jan 2017 14:40:12 +0000 (14:40 +0000)]
[ubsan] Minimize size of data for type_mismatch (Redo of D19667)

Summary:
This patch makes the type_mismatch static data 7 bytes smaller (and it
ends up being 16 bytes smaller due to alignment restrictions, at least
on some x86-64 environments).

It revs up the type_mismatch handler version since we're breaking binary
compatibility. I will soon post a patch for the compiler-rt side.

Reviewers: rsmith, kcc, vitalybuka, pgousseau, gbedwell

Subscribers: llvm-commits

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

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

7 years ago[CodeCompletion] Block property setters: Use dynamic priority heuristic
Alex Lorenz [Fri, 6 Jan 2017 12:00:44 +0000 (12:00 +0000)]
[CodeCompletion] Block property setters: Use dynamic priority heuristic

Now when completing blocks properties that return void the block call completion
result shows up before the setter, otherwise the setter completion shows up
before the block call completion. We normally want to use the result of the
block call, so one typically wouldn't call a block that returns a non-void type
in a standalone statement.

rdar://28846153

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

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

7 years ago[ObjC] The declarator for a block literal should be a definition
Alex Lorenz [Fri, 6 Jan 2017 11:31:12 +0000 (11:31 +0000)]
[ObjC] The declarator for a block literal should be a definition

This change avoids the -Wstrict-prototypes warning for block literals with an
empty argument list or without argument lists.

rdar://15060615

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

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

7 years agoConstify UsingPackDecl::getInstantiatedFromUsingDecl(), NFC.
Yaron Keren [Fri, 6 Jan 2017 11:15:57 +0000 (11:15 +0000)]
Constify UsingPackDecl::getInstantiatedFromUsingDecl(), NFC.

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

7 years agoCodeGen: address post commit review comments for r291123
Saleem Abdulrasool [Fri, 6 Jan 2017 02:27:40 +0000 (02:27 +0000)]
CodeGen: address post commit review comments for r291123

This test would force the execution of the backend.  However, the
backend already has a test for this.  Effectively, this was trying to
test that an API call was made properly.  We do not have a good way to
really test this.  The test itself tested very little.

Addresses post-commit review comments from Eric Christopher.

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

7 years agoshared_ptrify (from InclusiveRefCntPtr) HeaderSearchOptions
David Blaikie [Fri, 6 Jan 2017 01:04:46 +0000 (01:04 +0000)]
shared_ptrify (from InclusiveRefCntPtr) HeaderSearchOptions

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

7 years agoFix bug where types other than 'cv auto', 'cv auto &', and 'cv auto &&' could
Richard Smith [Thu, 5 Jan 2017 23:12:16 +0000 (23:12 +0000)]
Fix bug where types other than 'cv auto', 'cv auto &', and 'cv auto &&' could
incorrectly be deduced from an initializer list in pathological cases.

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

7 years agoAdd missing "original call argument has same type as deduced parameter type"
Richard Smith [Thu, 5 Jan 2017 23:02:44 +0000 (23:02 +0000)]
Add missing "original call argument has same type as deduced parameter type"
check for deductions from elements of a braced-init-list.

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

7 years agoRemove the ppc insertword/extractword expected fail tests.
Sean Fertile [Thu, 5 Jan 2017 22:54:34 +0000 (22:54 +0000)]
Remove the ppc insertword/extractword expected fail tests.

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

7 years agoFix examples for recent shared_ptrification
David Blaikie [Thu, 5 Jan 2017 22:36:44 +0000 (22:36 +0000)]
Fix examples for recent shared_ptrification

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

7 years agoIntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer
David Blaikie [Thu, 5 Jan 2017 22:19:11 +0000 (22:19 +0000)]
IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer

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

7 years agoAdd vec_insert4b and vec_extract4b functions to altivec.h
Sean Fertile [Thu, 5 Jan 2017 21:43:30 +0000 (21:43 +0000)]
Add vec_insert4b and vec_extract4b functions to altivec.h

Add builtins for the functions and custom codegen mapping the builtins to their
corresponding intrinsics and handling the endian related swapping.

https://reviews.llvm.org/D26546

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

7 years agoIf an explicitly-specified pack might have been extended by template argument
Richard Smith [Thu, 5 Jan 2017 20:27:28 +0000 (20:27 +0000)]
If an explicitly-specified pack might have been extended by template argument
deduction, don't forget to check the argument is valid.

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

7 years agoMove SerializedDiagnosticPrinter's SharedState to std::shared_ptr rather than Intrusi...
David Blaikie [Thu, 5 Jan 2017 19:48:10 +0000 (19:48 +0000)]
Move SerializedDiagnosticPrinter's SharedState to std::shared_ptr rather than IntrusiveRefCntPtr

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

7 years agoMove Preprocessor over to std::shared_ptr rather than IntrusiveRefCntPtr
David Blaikie [Thu, 5 Jan 2017 19:48:07 +0000 (19:48 +0000)]
Move Preprocessor over to std::shared_ptr rather than IntrusiveRefCntPtr

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

7 years agoMove PreprocessorOptions to std::shared_ptr from IntrusiveRefCntPtr
David Blaikie [Thu, 5 Jan 2017 19:11:36 +0000 (19:11 +0000)]
Move PreprocessorOptions to std::shared_ptr from IntrusiveRefCntPtr

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

7 years agoMove FailedModulesSet over to shared_ptr from IntrusiveRefCntPtr
David Blaikie [Thu, 5 Jan 2017 19:11:31 +0000 (19:11 +0000)]
Move FailedModulesSet over to shared_ptr from IntrusiveRefCntPtr

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

7 years agoMove VariantMatcher's Payload to std::shared_ptr rather than IntrusiveRefCntPtr
David Blaikie [Thu, 5 Jan 2017 18:51:54 +0000 (18:51 +0000)]
Move VariantMatcher's Payload to std::shared_ptr rather than IntrusiveRefCntPtr

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

7 years agoSimplify ASTReader ctor by using in-class initializers for many member variables
David Blaikie [Thu, 5 Jan 2017 18:45:45 +0000 (18:45 +0000)]
Simplify ASTReader ctor by using in-class initializers for many member variables

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

7 years agoSimplify ASTReader ctor by using in-class initializers (NSDMIs to the rest of you...
David Blaikie [Thu, 5 Jan 2017 18:45:43 +0000 (18:45 +0000)]
Simplify ASTReader ctor by using in-class initializers (NSDMIs to the rest of you) for many member variables

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

7 years agoUse shared_ptr instead of IntrusiveRefCntPtr for ModuleFileExtension
David Blaikie [Thu, 5 Jan 2017 18:23:18 +0000 (18:23 +0000)]
Use shared_ptr instead of IntrusiveRefCntPtr for ModuleFileExtension

The intrusiveness wasn't needed here, so this simplifies/clarifies the
ownership model.

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

7 years agoTypo
Joerg Sonnenberger [Thu, 5 Jan 2017 17:59:44 +0000 (17:59 +0000)]
Typo

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

7 years agoMigrate PathDiagnosticPiece to std::shared_ptr
David Blaikie [Thu, 5 Jan 2017 17:26:53 +0000 (17:26 +0000)]
Migrate PathDiagnosticPiece to std::shared_ptr

Simplifies and makes explicit the memory ownership model rather than
implicitly passing/acquiring ownership.

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

7 years agotest: add a requires registered target
Saleem Abdulrasool [Thu, 5 Jan 2017 17:09:20 +0000 (17:09 +0000)]
test: add a requires registered target

It seems that the ARM buildbots do not include x86 support.  However,
other x86 targets do not support the ARM target.  Use a x86 triple and
require the registered target.

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

7 years ago[CUDA] Rename keywords used in macro so they don't conflict with MSVC.
Justin Lebar [Thu, 5 Jan 2017 16:54:11 +0000 (16:54 +0000)]
[CUDA] Rename keywords used in macro so they don't conflict with MSVC.

Summary:
MSVC seems to use "__in" and "__out" for its own purposes, so we have to
pick different names in this macro.

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years ago[CUDA] Don't define functions that the CUDA headers themselves define on Windows.
Justin Lebar [Thu, 5 Jan 2017 16:53:55 +0000 (16:53 +0000)]
[CUDA] Don't define functions that the CUDA headers themselves define on Windows.

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years ago[CUDA] Let NVPTX inherit the host's calling conventions.
Justin Lebar [Thu, 5 Jan 2017 16:53:38 +0000 (16:53 +0000)]
[CUDA] Let NVPTX inherit the host's calling conventions.

Summary:
When compiling device code, we may still see host code with explicit
calling conventions.  NVPTX needs to claim that it supports these CCs,
so that (a) we don't raise noisy warnings, and (b) we don't break
existing code which relies on the existence of these CCs when
specializing templates.  (If a CC doesn't exist, clang ignores it, so
two template specializations which are different only insofar as one
specifies a CC are considered identical and therefore are an error if
that CC is not supported.)

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years ago[CUDA] More correctly inherit primitive types from the host during device compilation.
Justin Lebar [Thu, 5 Jan 2017 16:53:21 +0000 (16:53 +0000)]
[CUDA] More correctly inherit primitive types from the host during device compilation.

Summary:
CUDA lets users share structs between the host and device, so for that
and other reasons, primitive types such as ptrdiff_t should be the same
on both sides of the compilation.

Our code to do this wasn't entirely successful.  In particular, we did a
bunch of work during the NVPTXTargetInfo constructor, only to override
it in the NVPTX{32,64}TargetInfo constructors.  It worked well enough on
Linux and Mac, but Windows is LLP64, which is different enough to break
it.

This patch removes the NVPTX{32,64}TargetInfo classes entirely and fixes
the bug described above.

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years ago[CUDA] Add __declspec spellings for CUDA attributes.
Justin Lebar [Thu, 5 Jan 2017 16:53:04 +0000 (16:53 +0000)]
[CUDA] Add __declspec spellings for CUDA attributes.

Summary: CUDA attributes are spelled __declspec(__foo__) on Windows.

Reviewers: tra

Subscribers: cfe-commits, rnk

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

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

7 years ago[ToolChains] Use "static" instead of an anonymous namespace for a function. NFC
Justin Lebar [Thu, 5 Jan 2017 16:52:47 +0000 (16:52 +0000)]
[ToolChains] Use "static" instead of an anonymous namespace for a function.  NFC

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

7 years ago[Driver] Driver changes to support CUDA compilation on Windows.
Justin Lebar [Thu, 5 Jan 2017 16:52:29 +0000 (16:52 +0000)]
[Driver] Driver changes to support CUDA compilation on Windows.

Summary:
For the most part this is straightforward: Just add a CudaInstallation
object to the MSVC and MinGW toolchains.

CudaToolChain has to override computeMSVCVersion so that
Clang::constructJob passes the right version flag to cc1.  We have to
modify IsWindowsMSVC and friends in Clang::constructJob to be true when
compiling CUDA device code on Windows for the same reason.

Depends on: D28319

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years ago[CUDA] Make CUDAInstallationDetector take the host triple in its constructor.
Justin Lebar [Thu, 5 Jan 2017 16:52:11 +0000 (16:52 +0000)]
[CUDA] Make CUDAInstallationDetector take the host triple in its constructor.

Summary:
Previously it was taking the true target triple, which is not really
what it needs: The location of the CUDA installation depends on the host
OS.

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years ago[TableGen] Only normalize the spelling of GNU-style attributes.
Justin Lebar [Thu, 5 Jan 2017 16:51:54 +0000 (16:51 +0000)]
[TableGen] Only normalize the spelling of GNU-style attributes.

Summary:
When Sema looks up an attribute name, it strips off leading and trailing
"__" if the attribute is GNU-style.  That is, __attribute__((foo)) and
__attribute__((__foo__)) are equivalent.

This is only true for GNU-style attributes.  In particular,
__declspec(__foo__) is not equivalent to __declspec(foo), and Sema
respects this difference.

This patch fixes TableGen to match Sema's behavior.  The spelling
'GNU<"__foo__">' should be normalized to 'GNU<"foo">', but
'Declspec<"__foo__">' should not be changed.

This is necessary to make CUDA compilation work on Windows, because e.g.
the __device__ attribute is spelled __declspec(__device__).

Attr.td does not contain any Declspec spellings that start or end with
"__", so this change should not affect any other attributes.

Reviewers: rnk

Subscribers: cfe-commits, tra

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

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

7 years ago[Windows] Remove functions in intrin.h that are defined in Builtin.def.
Justin Lebar [Thu, 5 Jan 2017 16:51:37 +0000 (16:51 +0000)]
[Windows] Remove functions in intrin.h that are defined in Builtin.def.

Summary:
These duplicate declarations cause a problem for CUDA compiles on
Windows.  All implicitly-defined functions are host+device, and this
applies to the declarations in Builtin.def.  But then when we see the
declarations in intrin.h, they have no attributes, so are host-only
functions.  This is an error.

(A better fix might be to make these builtins host-only, but that is a
much bigger change.)

Reviewers: rnk

Subscribers: cfe-commits, echristo

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

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

7 years agotest: add an explicit triple
Saleem Abdulrasool [Thu, 5 Jan 2017 16:36:15 +0000 (16:36 +0000)]
test: add an explicit triple

Not all targets use the integrated assembler.  Specify a triple to
ensure we use the integrated as for this.

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

7 years ago[OpenMP] Add fields for flags in the offload entry descriptor.
Samuel Antao [Thu, 5 Jan 2017 16:02:49 +0000 (16:02 +0000)]
[OpenMP] Add fields for flags in the offload entry descriptor.

Summary:
This patch adds two fields to the offload entry descriptor. One field is meant to signal Ctors/Dtors and `link` global variables, and the other is reserved for runtime library use.

 Currently, these fields are only filled with zeros in the current code generation, but that will change when `declare target` is added.

The reason, we are adding these fields now is to make the code generation consistent with the runtime library proposal under review in https://reviews.llvm.org/D14031.

Reviewers: ABataev, hfinkel, carlo.bertolli, kkwli0, arpith-jacob, Hahnfeld

Subscribers: cfe-commits, caomhin, jholewinski

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

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

7 years agoCodeGen: plumb header search down to the IAS
Saleem Abdulrasool [Thu, 5 Jan 2017 16:02:32 +0000 (16:02 +0000)]
CodeGen: plumb header search down to the IAS

inline assembly may use the `.include` directive to include other
content into the file.  Without the integrated assembler, the `-I` group
gets passed to the assembler.  Emulate this by collecting the header
search paths and passing them to the IAS.

Resolves PR24811!

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

7 years ago[OpenMP] Update target codegen for NVPTX device.
Arpith Chacko Jacob [Thu, 5 Jan 2017 15:24:05 +0000 (15:24 +0000)]
[OpenMP] Update target codegen for NVPTX device.

This patch includes updates for codegen of the target region for the NVPTX
device. It moves initializers from the compiler to the runtime and updates
the worker loop to assume parallel work is retrieved from the runtime. A
subsequent patch will update the codegen to retrieve the parallel work using
calls to the runtime. It includes the removal of the inline attribute
for the worker loop and disabling debug info in it.

This allows codegen for a target directive and serial execution on the
NVPTX device.

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

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

7 years agoNo canonical-prefixes match in avr-toolchain.c.
Haojian Wu [Thu, 5 Jan 2017 10:06:58 +0000 (10:06 +0000)]
No canonical-prefixes match in avr-toolchain.c.

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

7 years ago[AVR] Revert the functional part of r291083
Dylan McKay [Thu, 5 Jan 2017 07:17:46 +0000 (07:17 +0000)]
[AVR] Revert the functional part of r291083

As Senthil points out, this is unnecessary as we already have these
registers in AddlRegNames.

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

7 years ago[AVR] Support r26 through r31 in inline assembly
Dylan McKay [Thu, 5 Jan 2017 05:31:12 +0000 (05:31 +0000)]
[AVR] Support r26 through r31 in inline assembly

These are synonyms for the X,Y, and Z registers.

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

7 years agoAdd AVR target and toolchain to Clang
Dylan McKay [Thu, 5 Jan 2017 05:20:27 +0000 (05:20 +0000)]
Add AVR target and toolchain to Clang

Summary:
Authored by Senthil Kumar Selvaraj

This patch adds barebones support in Clang for the (experimental) AVR target. It uses the integrated assembler for assembly, and the GNU linker for linking, as lld doesn't know about the target yet.

The DataLayout string is the same as the one in AVRTargetMachine.cpp. The alignment specs look wrong to me, as it's an 8 bit target and all types only need 8 bit alignment. Clang failed with a datalayout mismatch error when I tried to change it, so I left it that way for now.

Reviewers: rsmith, dylanmckay, cfe-commits, rengolin

Subscribers: rengolin, jroelofs, wdng

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

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

7 years agoPer [temp.deduct.call], do not deduce an array bound of 0 from an empty initializer...
Richard Smith [Thu, 5 Jan 2017 04:16:30 +0000 (04:16 +0000)]
Per [temp.deduct.call], do not deduce an array bound of 0 from an empty initializer list.

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

7 years agoFactor out more common logic in template argument deduction from function call arguments.
Richard Smith [Thu, 5 Jan 2017 04:08:31 +0000 (04:08 +0000)]
Factor out more common logic in template argument deduction from function call arguments.

No functionality change intended.

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

7 years agoFix assertion failure on deduction failure due to too short template argument list.
Richard Smith [Thu, 5 Jan 2017 02:31:32 +0000 (02:31 +0000)]
Fix assertion failure on deduction failure due to too short template argument list.

We were previously incorrectly using TDK_TooFewArguments to report a template
argument list that's too short, but it actually means that the number of
arguments in a top-level function call was insufficient. When diagnosing the
problem, SemaOverload would (rightly) assert that the failure kind didn't make
any sense.

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

7 years ago[Sema] Mark undefined ctors as deleted. NFC.
George Burgess IV [Thu, 5 Jan 2017 01:21:21 +0000 (01:21 +0000)]
[Sema] Mark undefined ctors as deleted. NFC.

Looks like these functions exist just to prevent bad implicit
conversions. Rather than waiting for the linker to complain about
undefined references to them, we can mark them as deleted.

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

7 years ago[MS] Instantiate default args during instantiation of exported default ctors
Reid Kleckner [Thu, 5 Jan 2017 01:08:22 +0000 (01:08 +0000)]
[MS] Instantiate default args during instantiation of exported default ctors

Summary:
Replace some old code that probably pre-dated the change to delay
emission of dllexported code until after the closing brace of the
outermost record type. Only uninstantiated default argument expressions
need to be handled now. It is enough to instantiate default argument
expressions when instantiating dllexported default ctors. This also
fixes some double-diagnostic issues in this area.

Fixes PR31500

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoCorrect Vectorcall Register passing and HVA Behavior
Erich Keane [Thu, 5 Jan 2017 00:20:51 +0000 (00:20 +0000)]
Correct Vectorcall Register passing and HVA Behavior

Front end component (back end changes are D27392).  The vectorcall
calling convention was broken subtly in two cases.  First,
it didn't properly handle homogeneous vector aggregates (HVAs).
Second, the vectorcall specification requires that only the
first 6 parameters be eligible for register assignment.
This patch fixes both issues.

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

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

7 years ago[gtest] The way EXPECT_TEST now works after upgrading gtest triggers an
Chandler Carruth [Wed, 4 Jan 2017 23:57:25 +0000 (23:57 +0000)]
[gtest] The way EXPECT_TEST now works after upgrading gtest triggers an
ODR use. These traits don't have a definition as they're intended to be
used strictly at compile time. Change the tests to use static_assert to
move the entire thing into compile-time.

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

7 years agoOnly instantiate members of nested classes in local classes once, rather than once...
Richard Smith [Wed, 4 Jan 2017 23:45:01 +0000 (23:45 +0000)]
Only instantiate members of nested classes in local classes once, rather than once per enclosing class.

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

7 years agoBail out if we try to build a DeclRefExpr naming an invalid declaration.
Richard Smith [Wed, 4 Jan 2017 23:14:16 +0000 (23:14 +0000)]
Bail out if we try to build a DeclRefExpr naming an invalid declaration.

Most code paths would already bail out in this case, but certain paths,
particularly overload resolution and typo correction, would not. Carrying on
with an invalid declaration could in some cases result in crashes due to
downstream code relying on declaration invariants that are not necessarily
met for invalid declarations, and in other cases just resulted in undesirable
follow-on diagnostics.

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

7 years ago[Parse] Don't ignore attributes after a late-parsed attr.
George Burgess IV [Wed, 4 Jan 2017 22:43:01 +0000 (22:43 +0000)]
[Parse] Don't ignore attributes after a late-parsed attr.

Without this, we drop everything after the first late-parsed attribute
in a single __attribute__. (Where "drop" means "stuff everything into
LA->Toks.")

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

7 years agoFix for LLVM Bitcode API change (to use std::shared_ptr)
David Blaikie [Wed, 4 Jan 2017 22:36:43 +0000 (22:36 +0000)]
Fix for LLVM Bitcode API change (to use std::shared_ptr)

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

7 years agoRemove use of intrusive ref count ownership acquisition
David Blaikie [Wed, 4 Jan 2017 22:36:39 +0000 (22:36 +0000)]
Remove use of intrusive ref count ownership acquisition

The one use of CheckerManager (AnalysisConsumer, calling
createCheckerManager) keeps a strong reference to the AnalysisOptions
anyway, so this ownership wasn't necessary.

(I'm not even sure AnalysisOptions needs ref counting at all - but
that's more involved)

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

7 years agoFix failure to treat overloaded function in braced-init-list as a non-deduced context.
Richard Smith [Wed, 4 Jan 2017 22:03:59 +0000 (22:03 +0000)]
Fix failure to treat overloaded function in braced-init-list as a non-deduced context.

Previously, if an overloaded function in a braced-init-list was encountered in
template argument deduction, and the overload set couldn't be resolved to a
particular function, we'd immediately produce a deduction failure. That's not
correct; this situation is supposed to result in that particular P/A pair being
treated as a non-deduced context, and deduction can still succeed if the type
can be deduced from elsewhere.

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

7 years agoRevert accidentally-committed file.
Richard Smith [Wed, 4 Jan 2017 19:48:07 +0000 (19:48 +0000)]
Revert accidentally-committed file.

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

7 years agoFactor out duplicated code and simplify.
Richard Smith [Wed, 4 Jan 2017 19:47:19 +0000 (19:47 +0000)]
Factor out duplicated code and simplify.

No functionality change intended.

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