Граф коммитов

716 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 1274ccd90a Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
bit by me). 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116122 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08 23:50:27 +00:00
Douglas Gregor 1b39820526 Fix handling of dependent nested namespace specifiers in UsingDecls
during template instantiation, from Martin Vejnar!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 17:58:28 +00:00
Douglas Gregor 200b292139 When we run into an error parsing or type-checking the left-hand side
of a binary expression, continue on and parse the right-hand side of
the binary expression anyway, but don't call the semantic actions to
type-check. Previously, we would see the error and then, effectively,
skip tokens until the end of the statement. 

The result should be more useful recovery, both in the normal case
(we'll actually see errors beyond the first one in a statement), but
it also helps code completion do a much better job, because we do
"real" code completion on the right-hand side of an invalid binary
expression rather than completing with the recovery completion. For
example, given

  x = p->y

if there is no variable named "x", we can still complete after the p->
as a member expression. Along the recovery path, we would have
completed after the "->" as if we were in an expression context, which
is mostly useless.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17 22:25:06 +00:00
Douglas Gregor 5833b0b831 When marking the declarations in a default argument expression as
"used", at the time that the default argument itself is used, also
mark destructors that will be called by this expression. This fixes a
regression that I introduced in r113700, which broke WebKit, and fixes
<rdar://problem/8427926>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113883 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 22:55:20 +00:00
Abramo Bagnara 2c5399f99c Parentheses around address non-type template argument is demoted to an extension warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113739 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 06:06:58 +00:00
Douglas Gregor a4d5de539b When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade the
error to a warning if we're in a case that would be allowed in
C++0x. This "fixes" PR8084 by making Clang accept more code than GCC
and (non-strict) EDG do. 

Also, add the missing test case for the C++0x semantics, which should
have been in r113717.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113718 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-12 05:24:55 +00:00
Douglas Gregor 4fcf5b2f81 Teach the EvaluatedExprVisitor and its client, which marks
declarations in potentially-evaluated subexpressions, about
recursion. Fixes the release-mode self-host failure I introduced in
r113700.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 23:32:50 +00:00
Douglas Gregor be0f7bd61c When parsing default function arguments, do not mark any declarations
used in the default function argument as "used". Instead, when we
actually use the default argument, make another pass over the
expression to mark any used declarations as "used" at that point. This
addresses two kinds of related problems:

  1) We were marking some declarations "used" that shouldn't be,
  because we were marking them too eagerly.
  2) We were failing to mark some declarations as "used" when we
  should, if the first time it was instantiated happened to be an
  unevaluated context, we wouldn't mark them again at a later point.

I've also added a potentially-handy visitor class template
EvaluatedExprVisitor, which only visits the potentially-evaluated
subexpressions of an expression. I bet this would have been useful for
noexcept...

Fixes PR5810 and PR8127.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113700 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 20:24:53 +00:00
Douglas Gregor c6cb2b02f0 Tweak GetPreamblePCHPath() to more closely match the behavior of the
Windows GetTempPath() function, and be sure to create the directory in
which the precompiled preamble will reside before creating the
temporary file itself.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113695 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 17:51:16 +00:00
John McCall 4e6356426f Support in-class initialization of static const floating-point data members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113663 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 23:21:22 +00:00
Chris Lattner 2f69a816a0 "const std::vector<int>*" not "std::vector<int> const*"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113094 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 00:27:00 +00:00
Chris Lattner 0c42bb653d 'const std::type_info*' instead of 'std::type_info const*'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113092 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 00:17:29 +00:00
Chris Lattner 58f9e13e87 make clang print types as "const int *" instead of "int const*",
which is should have done from the beginning.  As usual, the most
fun with this sort of change is updating all the testcases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 00:04:01 +00:00
Chandler Carruth 030ef472f3 Fix PR7402 when it strikes via template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113019 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 21:54:20 +00:00
Chandler Carruth 17fb855280 Allow anonymous and local types. The support was already in place for these,
but this makes them work even as an extension in C++98. This resolves PR8077.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 21:12:34 +00:00
Douglas Gregor 71b87e4fa6 When template substitution into a template parameter reduces the level
of that parameter, reduce the level by the number of active template
argument lists rather than by 1. The number of active template
argument lists is only > 1 when we have a class template partial
specialization of a member template of a class template that itself is
a member template of another class template. 

... and Boost.MSM does this. Fixes PR7669.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 23:23:59 +00:00
Gabor Greif d304fe66c0 add two more use-cases (explicit instantiation) that should pass now
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112533 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 21:45:06 +00:00
Gabor Greif ab297ac4d3 fix dual aspect of PR8007,
namely when the friend function prototype is already used
at the point of the template definition that is supposed
to inject the friend function. Testcase verifies four
scenarios.
I would like receive some code review for this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112524 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 21:10:05 +00:00
Douglas Gregor e2248be874 Fix an corner-case assertion introduced by the refactoring in r112258;
when we're taking the address of a unresolvable value, it might be an
implicit member access. Fixes some Boost.Spirit regressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112487 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 16:00:47 +00:00
John McCall cd05e81e2e When perform exact-qualifier-match template argument deduction,
properly account for the possibility that certain opaque types
might be more qualified than they appear.  Fixes PR7708.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 22:14:41 +00:00
John McCall 67d22fb57e If filtering a lookup result leaves it ambiguous, keep the ambiguity
kind.  Fixes PR7252.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 20:17:00 +00:00
Gabor Greif 4d99a3da7e add another test for PR8007
this is still failing, need to come up with a fix
(but we are in good company as the first gcc version
 pass this test will be v4.6)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112369 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 12:12:45 +00:00
Gabor Greif aaafddba8b check whether sema issues a redefinition error
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112347 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 02:00:22 +00:00
Gabor Greif bb452e99a8 note to self: save before committing; add PR
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112339 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 00:48:36 +00:00
Gabor Greif 19de06bd7b fix test by applying it in top namespace: PR8007 only showed up this way
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112338 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 00:45:56 +00:00
Gabor Greif 40181c4e58 fix PR8007
reordering and redefinition issues still may linger,
I plan to nail them next

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112333 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 00:16:06 +00:00
Gabor Greif c620ace6db reproduction recipe for PR8007, expected to fail for now, review welcome
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112326 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 23:39:49 +00:00
John McCall 7114cbab7e Continue to instantiate sub-statements in a CompoundStmt as long as
we don't see a DeclStmt (failure to instantiate which generally causes
panic).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 19:56:05 +00:00
Nick Lewycky d9ca4ab3ed Add a workaround for PR7947, a crash trying to recover from invalid C++ code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111675 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 20:54:15 +00:00
John McCall 7667245662 Correctly instantiate templates with non-type template arguments that
are local externs.  Fixes <rdar://problem/8302138>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111570 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 23:06:02 +00:00
John McCall e4f26e54d8 When deducing the element type of an array, ignore qualifiers if
the context allows us to ignore qualifiers on the array type itself.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 00:20:19 +00:00
John McCall ec8045d3f0 Implicit decl ref expressions might not have name locations; don't silently
fail to instantiate them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 21:27:17 +00:00
Eli Friedman 647c8b32c2 PR7837: For qualified id's, make sure the decl context is complete if not
dependent in ActOnIdExpression.  (This issue only shows up with member
operators because an operator is never a type.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 23:41:47 +00:00
Douglas Gregor caadc127fe Remove some incorrect assertions when deduction template arguments in
a template-argument-list. When template template parameters are
involved, we won't already have checked the template-argument-list (it
may not be known yet!). Fixes PR7807.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110444 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 14:15:26 +00:00
John McCall 57e9778643 TDK_InconsistentQuals is really totally different from TDK_Inconsistent.
Rename it to TDK_Underqualified to avoid this sort of confusion and give it
its own diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110318 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 09:05:08 +00:00
John McCall 1d8d1ccd36 Instantiate attributes from the pattern record when instantiating
a class template.  Fixes rdar://problem/8243419.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109967 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 02:01:53 +00:00
John McCall 207014eb2b Improve error recovery when presented with an ill-formed template-id
(e.g. due to a broken template argument) following template parameters.

Fixes rdar://problem/8254267



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 06:26:29 +00:00
Douglas Gregor 98c2e6248f Don't set out-of-line template specialization/definition information
for AST nodes that aren't actually out-of-line (i.e., require a
nested-name-specifier). Fixes <rdar://problem/8204126>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109704 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 23:59:57 +00:00
Douglas Gregor 6813d7ba5f Enable expression transformations in the current-instantiation
rebuilder, i.e., remove a silly short-sighted hack from long
ago. Thanks to Abramo Bagnara for the test case/bug report!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 15:14:14 +00:00
Douglas Gregor ac7cbd8102 When a nested-name-specifier refers into a current instantiation that has
dependent bases, construct a dependent nested-name-specifier rather
than complaining that the name could not be found within the current
instantiation itself. Fixes PR7725.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 14:49:07 +00:00
Eli Friedman 787b094695 PR7724: Don't try to evaluate value-dependent expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109532 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 19:14:53 +00:00
Eli Friedman 0f2b97d1b0 PR7698: Make sure we correctly handle the initialization of an array with
dependent size.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 21:19:15 +00:00
Douglas Gregor f9f97a0ea1 When performing template name lookup for a dependent member access
expression such as the "foo" in "this->blah.foo<1, 2>", and we can't
look into the type of "this->blah" (e.g., because it is dependent),
look into the local scope of a template of the same name. Fixes
<rdar://problem/8198511>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 16:54:17 +00:00
Douglas Gregor 0167f3c255 When there are extra or missing template parameter lists in a template
definition, we're likely going to end up breaking the invariants of
the template system, e.g., that the depths of template parameter lists
match up with the nesting template of the template. So, make sure we
mark such ill-formed declarations as invalid or don't even build them
at all.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 23:14:12 +00:00
Chandler Carruth 5495f37302 Wire up '-Wignored-qualifiers' to the warning on 'const' in 'const int f()'.
This flag and warning match GCC semantics. Also, move it to -Wextra as this is
a largely cosmetic issue and doesn't seem to mask problems. Subsequent fixes to
the tests which no longer by default emit the warning. Added explicit test
cases for both C and C++ behavior with the warning turned on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108325 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 06:36:18 +00:00
Douglas Gregor 218f47ff74 When computing the canonical profile of a DeclRefExpr or MemberExpr,
don't include the nested-name-specifier or template arguments: they
were only relevant when resolving the declaration. Fixes PR7460.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 08:37:11 +00:00
Douglas Gregor 5291c3cec0 When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types. 

Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().

Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 08:18:22 +00:00
Douglas Gregor 669eed8d67 Provide a special diagnostic for attempts to explicitly specialize
class templates within class scope (which is ill-formed), and recover
by dropping the explicit specialization entirely. Fixes the infinite
loop in PR7622.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108217 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 00:10:04 +00:00
Chris Lattner 184aa4e6de fix PR7280 by making the warning on code like this:
int test1() {
  return;
}

default to an error.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108108 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-11 23:34:02 +00:00
Chandler Carruth 999194739e Lay the ground work for resoving PR7047. This doesn't actually fix it because
default arguments to template parameters don't have a DeclContext when
instantiated, and so we can't detect that we're in an instantiation context as
opposed to the definition context. However, it fixes the more commonly-occuring
cases in TMP code that use devolve to this type of tautology after
substitution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-10 12:30:03 +00:00