Commit Graph

472 Commits

Author SHA1 Message Date
Alp Toker a3c494f0db Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]"
We've decided to make the core rewriter class and PP rewriters mandatory.
They're only a few hundred lines of code in total and not worth supporting as a
distinct build configuration, especially since doing so disables key compiler
features.

This reverts commit r213150.

Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter."

This reverts commit r213148.

Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/"

This reverts commit r213146.

llvm-svn: 213159
2014-07-16 15:12:48 +00:00
NAKAMURA Takumi 692d6bb544 clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter.
llvm-svn: 213148
2014-07-16 13:36:39 +00:00
Nikola Smiljanic b8f8099895 Move DR532 test where it belongs.
llvm-svn: 210064
2014-06-03 02:56:59 +00:00
Nikola Smiljanic 4461de208a PR12961 - Extend DR532 to cover C++98/03.
llvm-svn: 209955
2014-05-31 02:10:59 +00:00
Aaron Ballman f00500bc8e This test is no longer relevant. It is covered already by [basic.scope.pdecl]p10, and our current test for that is more thorough (though our test is named p9.cpp).
llvm-svn: 209892
2014-05-30 13:17:17 +00:00
David Majnemer 27d69dbbd0 CodeGen: Fix linkage of reference temporaries
Summary:
A reference temporary should inherit the linkage of the variable it
initializes.  Otherwise, we may hit cases where a reference temporary
wouldn't have the same value in all translation units.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 207451
2014-04-28 22:17:59 +00:00
Ismail Pazarbasi 025f428c73 Replace "can not" with "cannot" in diagnostics messages.
llvm-svn: 203302
2014-03-07 22:36:23 +00:00
David Blaikie 6cab596218 Improve diagnostic for using non-class/namespace/scoped enum in a nested name specifier.
Rather than simply saying "X is not a class or namespace", clarify what
X is by providing the aka type in the case where X is a type, or
pointing to the named declaration if there's an unambiguous one to refer
to. In the ambiguous case, the ambiguities are already enumerated
(though could be clarified by describing what kind of entities they are)

Included a few FIXMEs in tests where some further improvements could be
made.

llvm-svn: 201038
2014-02-09 06:54:23 +00:00
Richard Smith beef3453cd Clean up variable template handling a bit, and correct the behavior of name
lookup when declaring a variable template specialization.

llvm-svn: 199438
2014-01-16 23:39:20 +00:00
Richard Smith 83b11aae18 PR18401: Fix assert by implementing the current proposed direction of core
issue 1430. Don't allow a pack expansion to be used as an argument to an alias
template unless the corresponding parameter is a parameter pack.

llvm-svn: 198833
2014-01-09 02:22:22 +00:00
Alp Toker 95e7ff2ed1 Eliminate UnaryTypeTraitExpr
Remove UnaryTypeTraitExpr and switch all remaining type trait related handling
over to TypeTraitExpr.

The UTT/BTT/TT enum prefix and evaluation code is retained pending further
cleanup.

This is part of the ongoing work to unify type traits following the removal of
BinaryTypeTraitExpr in r197273.

llvm-svn: 198271
2014-01-01 05:57:51 +00:00
Alp Toker 6ed7251683 Revert "Don't require -re suffix on -verify directives with regexes."
This patch was submitted to the list for review and didn't receive a LGTM.

(In fact one explicit objection and one query were raised.)

This reverts commit r197295.

llvm-svn: 197299
2013-12-14 01:07:05 +00:00
Hans Wennborg 9b395ef284 Don't require -re suffix on -verify directives with regexes.
Differential Revision: http://llvm-reviews.chandlerc.com/D2392

llvm-svn: 197295
2013-12-14 00:46:53 +00:00
Alp Toker cbb9034e2a Eliminate BinaryTypeTraitExpr
There's nothing special about type traits accepting two arguments.

This commit eliminates BinaryTypeTraitExpr and switches all related handling
over to TypeTraitExpr.

Also fixes a CodeGen failure with variadic type traits appearing in a
non-constant expression.

The BTT/TT prefix and evaluation code is retained as-is for now but will soon
be further cleaned up.

This is part of the ongoing work to unify type traits.

llvm-svn: 197273
2013-12-13 20:49:58 +00:00
Hans Wennborg 86be54cc80 Tighten test regexes checking for __attribute__((thiscall)) on function types.
The tests were perhaps made too relaxed in r197164 when we switched to the new
MinGW ABI. This makes sure we check explicitly for an optional thiscall
attribute and nothing else.

We should still look into whether we should print these attributes at all in
these cases.

llvm-svn: 197252
2013-12-13 18:34:23 +00:00
Rafael Espindola 3497069784 Switch to the new MingW ABI.
GCC 4.7 changed the MingW ABI. On the clang side this means that methods now
have the thiscall calling convention by default.

llvm-svn: 197164
2013-12-12 16:07:11 +00:00
Richard Smith a98f8fc8d8 Give a more appropriate diagnostic when a template specialization or
instantiation appears in a non-enclosing namespace (the previous diagnostic
talked about the C++98 rule even in C++11 mode).

llvm-svn: 196642
2013-12-07 05:09:50 +00:00
Richard Smith a230224be4 Implement DR482: namespace members can be redeclared with a qualified name
within their namespace, and such a redeclaration isn't required to be a
definition any more.

Update DR status page to say Clang 3.4 instead of SVN and add new Clang 3.5
category (but keep Clang 3.4 yellow for now).

llvm-svn: 196481
2013-12-05 07:51:02 +00:00
David Majnemer 192d1798b2 Sema: Instantiate local class and their members appropriately
We would fail to instantiate them when the surrounding function was
instantiated. Instantiate the class and add it's members to the list of
pending instantiations, they should be resolved when we are finished
with the function's body.

This fixes PR9685.

llvm-svn: 195827
2013-11-27 08:20:38 +00:00
Richard Smith cd556eb265 Issue a diagnostic if we see a templated friend declaration that we do not
support.

llvm-svn: 194273
2013-11-08 18:59:56 +00:00
David Majnemer 6bedcfa79f Sema: Emit a nicer diagnostic when IndirectFieldDecls show up inappropriately in non-type template arguments
llvm-svn: 193462
2013-10-26 06:12:44 +00:00
David Majnemer 766e259e38 Sema: Do not allow template declarations inside local classes
Summary:
Enforce the rule in C++11 [temp.mem]p2 that local classes cannot have
member templates.

This fixes PR16947.

N.B.  C++14 has slightly different wording to afford generic lambdas
declared inside of functions.

Fun fact:  Some formulations of local classes with member templates
would cause clang to crash during Itanium mangling, such as the
following:

void outer_mem() {
  struct Inner {
    template <typename = void>
    struct InnerTemplateClass {
      static void itc_mem() {}
    };
  };
  Inner::InnerTemplateClass<>::itc_mem();
}

Reviewers: eli.friedman, rsmith, doug.gregor, faisalv

Reviewed By: doug.gregor

CC: cfe-commits, ygao

Differential Revision: http://llvm-reviews.chandlerc.com/D1866

llvm-svn: 193144
2013-10-22 04:14:18 +00:00
Kaelyn Uhrain 8aa8da85ca Allow CorrectTypo to replace CXXScopeSpecifiers that refer to classes.
Now that CorrectTypo knows how to correctly search classes for typo
correction candidates, there is no good reason to only replace an
existing CXXScopeSpecifier if it refers to a namespace. While the actual
enablement was a matter of changing a single comparison, the fallout
from enabling the functionality required a lot more code changes
(including my two previous commits).

llvm-svn: 193020
2013-10-19 00:05:00 +00:00
Richard Smith 9a00bbfa4c PR17592: Ensure we diagnose shadowing a template parameter with a local extern
declaration.

llvm-svn: 192846
2013-10-16 21:12:00 +00:00
Richard Smith b12cf6ceb7 Hopefully unbreak bots which are seeing an assert in this test. Temporary, real
fix to come once I've tracked down the problem (which is pre-existing and not
related to the change which introduced this test).

llvm-svn: 191279
2013-09-24 05:07:58 +00:00
Richard Smith 300e0c36a3 Implement restriction that a partial specialization must actually specialize
something, for variable templates.

llvm-svn: 191278
2013-09-24 04:49:23 +00:00
Richard Smith ef985ac91c Fix accepts-invalid if a variable template explicit instantiation is missing an
argument list, but could be instantiated with argument list of <>.

llvm-svn: 190913
2013-09-18 02:10:12 +00:00
Richard Smith e5b5220072 PR17075: When performing partial ordering of a member function against a
non-member function, the number of arguments in the two candidate calls
will be different (the non-member call will have one extra argument).
We used to get confused by this, and fail to compare the last argument
when testing whether the member is better, resulting in us always
thinking it is, even if the non-member is more specialized in the last
argument.

llvm-svn: 190470
2013-09-11 00:52:39 +00:00
Rafael Espindola b69b7fedbf Disable llvm optimizations, but keep -O1 to test available_externally.
llvm-svn: 189919
2013-09-04 04:59:11 +00:00
Larisse Voufo d8dd97c0a2 Bug fix: disallow a variable template to be redeclared as a non-templated variable
llvm-svn: 188350
2013-08-14 03:09:19 +00:00
Larisse Voufo 39a1e507ff Started implementing variable templates. Top level declarations should be fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention...
llvm-svn: 187762
2013-08-06 01:03:05 +00:00
Serge Pavlov 518b26cdcd Regression test for PR12699
llvm-svn: 187734
2013-08-05 18:38:16 +00:00
Richard Smith 6401768ac4 Reinstate r186040, with additional fixes and more test coverage (reverted in
r186331).

Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

llvm-svn: 186546
2013-07-17 23:53:16 +00:00
Chandler Carruth 9324d169bd Re-revert r86040, which was un-reverted in r186199.
This breaks the build of basic patterns with repeated friend
declarations. See the added test case in SemaCXX/friend.cpp or the test
case reported to the original commit log.

Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

llvm-svn: 186331
2013-07-15 17:27:42 +00:00
Serge Pavlov 7cd8f6020f Fix to PR12262 - assertion when substituting explicit template arguments
does not substitute a sizeof-pack expression.
The solution is proposed by Richard Smith.
Differential Revision: http://llvm-reviews.chandlerc.com/D869

llvm-svn: 186306
2013-07-15 06:14:07 +00:00
David Blaikie 66ed89d07f Correctly classify pack expansions as NON_CANONICAL_UNLESS_DEPENDENT
Test coverage for non-dependent pack expansions doesn't demonstrate a
failure prior to this patch (a follow-up commit improving debug info
will cover this commit specifically) but covers a related hole in our
test coverage.

Reviewed by Richard Smith & Eli Friedman.

llvm-svn: 186261
2013-07-13 21:08:08 +00:00
Richard Smith 141942fcca Unrevert r186040, reverted in r186185, with fix for PR16597.
Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

llvm-svn: 186199
2013-07-12 20:38:49 +00:00
Chandler Carruth 9bdd1bb403 Revert r186040 to fix PR16597 while Richard investigates what the best
fix is.

Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

llvm-svn: 186185
2013-07-12 18:54:40 +00:00
Richard Smith 7a73449b31 If we friend a declaration twice, that should not make it visible to name
lookup in the surrounding context. Slightly rework how we handle friend
declarations to inherit the visibility of the prior declaration, rather
than setting a friend declaration to be visible whenever there was a prior
declaration.

llvm-svn: 186040
2013-07-10 22:04:13 +00:00
Richard Smith ffe9da0136 Missing test update from r184884.
llvm-svn: 184885
2013-06-25 22:22:42 +00:00
David Blaikie 47c1150f50 DebugInfo: Support (using GNU extensions) for template template parameters and parameter packs
llvm-svn: 184644
2013-06-22 18:59:18 +00:00
Larisse Voufo d8576e19ce Extend template instantiation bug fix (r184503) with fixit test
llvm-svn: 184577
2013-06-21 18:49:56 +00:00
Larisse Voufo dd08c59317 Add basic fixit test to template instantiation bug fix (r184503)
llvm-svn: 184559
2013-06-21 15:56:15 +00:00
Larisse Voufo 725de3e14f Bug Fix: Template explicit instantiations should not have definitions (FixIts yet to be tested.)
llvm-svn: 184503
2013-06-21 00:08:46 +00:00
Eli Friedman 7796da2409 Add a couple more tests.
llvm-svn: 184501
2013-06-20 23:58:09 +00:00
Nick Lewycky 2c308503ea Include the unexpanded packs in the initializer expression when checking a
pack expanded constructor initializer list. Fixes PR16303!

llvm-svn: 183878
2013-06-13 00:45:47 +00:00
Richard Smith e3b28bc363 Move detection of reference members binding to temporaries from building of
CXXCtorInitializers to the point where we perform the questionable lifetime
extension. This exposed a selection of false negatives in the warning.

llvm-svn: 183869
2013-06-12 21:51:50 +00:00
Richard Smith 034185c2f9 The 'constexpr implies const' rule for non-static member functions is gone in
C++1y, so stop adding the 'const' there. Provide a compatibility warning for
code relying on this in C++11, with a fix-it hint. Update our lazily-written
tests to add the const, except for those ones which were testing our
implementation of this rule.

llvm-svn: 179969
2013-04-21 01:08:50 +00:00
Richard Smith 643a2869b3 Add triples to these tests since they're now using TLS, which isn't available on all targets.
llvm-svn: 179514
2013-04-15 08:00:15 +00:00
Richard Smith fd3834f7a1 Annotate flavor of TLS variable (statically or dynamically initialized) onto the AST.
llvm-svn: 179447
2013-04-13 02:43:54 +00:00