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

664 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 7557a1348d Egregious, disgusting workaround for PR5866. We need to rework how we
keep track of friends within templates, which will provide a real for
PR5866. For now, this makes sure we don't do something entirely stupid
with friends of specializations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92143 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 20:56:24 +00:00
Daniel Dunbar 5184626563 Fix -Asserts warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92137 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 19:19:26 +00:00
Douglas Gregor 6e790ab61b Allow the first parameter of operator new to be a cv-qualified
size_t. Also, fix an issue with initialization of parameters in calls,
where we weren't removing the cv-qualifiers on the parameter type
itself. Fixes PR5823.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91941 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 23:42:49 +00:00
Douglas Gregor 90f9382b3e Switch Sema::AddCXXDirectInitializerToDecl over to InitializationSequence
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 22:17:25 +00:00
Eli Friedman 4a2c19bf23 Switch default arguments over to InitializationSequence.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 02:46:13 +00:00
John McCall a236a55847 Stop diagnosing the use of inner classes as friends. ddunbar asked whether
this was useful, and on review Doug and I decided it was probably on the level
of a bug in the standard and therefore not worth a warning even in -pedantic.
If someone disagrees and urgently wants clang++ to warn about this in strict
c++98 mode, we can talk about it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 00:59:39 +00:00
Douglas Gregor 9e9199d864 Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, since the context is available in the Decl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 00:34:07 +00:00
John McCall 2b194418b8 Reorganize the base-lookup bits of ActOnMemInitializer in order to better
support diagnostics and error recovery.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 10:41:20 +00:00
John McCall 7a1dc562d4 Refactor to remove more dependencies on PreDeclaratorDC. I seem to have made
the redeclaration problems in the [temp.explicit]p3 testcase worse, but I can
live with that;  they'll need to be fixed more holistically anyhow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91771 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 10:49:29 +00:00
John McCall 731ad843b7 Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing
a new scope.  Resolves an ancient xfail and an LLVM misparse.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91769 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 09:28:58 +00:00
Douglas Gregor 18ef5e28a9 Switch the initialization required by return statements over to the
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:

  - InitializationSequence now has a "C conversion sequence" category
    and step kind, which falls back to
  - Changed the diagnostics for returns to always have the result type
    of the function first and the type of the expression second.
    CheckSingleAssignmentConstraints to peform checking in C. 
  - Improved ASTs for initialization of return values. The ASTs now
    capture all of the temporaries we need to create, but
    intentionally do not bind the tempoary that is actually returned,
    so that it won't get destroyed twice.
  - Make sure to perform an (elidable!) copy of the class object that
    is returned from a class.
  - Fix copy elision in CodeGen to properly see through the
    subexpressions that occur with elidable copies.
  - Give "new" its own entity kind; as with return values and thrown
    objects, we don't bind the expression so we don't call a
    destructor for it.

Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91669 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 05:02:21 +00:00
Eli Friedman ff2d87840d Correctly calcluate abstract-ness in the case where an implicitly declared
method overrides a pure virtual method.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 20:00:27 +00:00
Douglas Gregor 16006c9013 When value-initializing a class with no user-defined constructors but
with a non-trivial default constructor, zero-initialize the storage
and then call the default constructor. Fixes PR5800.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 18:50:27 +00:00
Douglas Gregor 6864748fc9 Fix semantic diagnostics that embed English works, from Nicola Gigante!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91503 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 03:45:30 +00:00
John McCall 5fdd7643ae Successive anonymous namespaces name the same scope. I misinterpreted the
standard the last time.  Fixes PR5766.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 02:06:49 +00:00
Douglas Gregor 99a2e600f9 Switch the C++ new expression over to InitializationSequence, rather
than using its own partial implementation of initialization. 

Switched CheckInitializerTypes over to
InitializedEntity/InitializationKind, to help move us closer to
InitializationSequence.

Added InitializedEntity::getName() to retrieve the name of the entity,
for diagnostics that care about such things.

Implemented support for default initialization in
InitializationSequence.

Clean up the determination of the "source expressions" for an
initialization sequence in InitializationSequence::Perform.

Taught CXXConstructExpr to store more location information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 01:38:02 +00:00
Anders Carlsson 0ece491d8f ShouldDestroyTemporaries? I don't think so.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:51:39 +00:00
Douglas Gregor 5cc07df89a Fix some diagnostic-related FIXMEs, from Nicola Gigante
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 16:44:32 +00:00
Anders Carlsson 156c78e4ef More improvements to checking allocation and deallocation functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 17:53:43 +00:00
Anders Carlsson fcfdb2ba42 Fix tyop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91204 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12 02:43:16 +00:00
Anders Carlsson 20d45d2a9e Correctly diagnose [basic.stc.dynamic.allocation]p1
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12 00:32:00 +00:00
Anders Carlsson a3ccda5891 Factor operator new declaration checking out into a separate function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12 00:26:23 +00:00
Anders Carlsson 46991d6364 More work on improving the operator delete diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12 00:16:02 +00:00
Anders Carlsson 1152c39c8a Fix build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 23:31:21 +00:00
Anders Carlsson 9d59ecb4d2 Improve diagnostics for malformed delete operator function declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 23:23:22 +00:00
Benjamin Kramer 8d04258483 Random string-related cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 13:33:18 +00:00
John McCall d7533ec10b Check if the target of a using decl is already declared in this scope before
doing any of the other redeclaration checks.  We were missing a few cases.
Fixes PR 5752.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 02:33:26 +00:00
John McCall 60fa3cfd7a Implement access declarations. Most of the work here is parsing them, which
is difficult because they're so terribly, terribly ambiguous.


We implement access declarations in terms of using declarations, which is
quite reasonable.  However, we should really persist the access/using
distinction in the AST and use the appropriate name in diagnostics.  This
isn't a priority, so I'll just file a PR and hope someone else does it. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91095 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 02:10:03 +00:00
John McCall 41ce66f8e2 Improve the diagnostic when a new declaration conflicts with a using shadow
declaration.  Rename note_using_decl to note_using, which is possibly less confusing.
Add a test for non-class-scope using decl collisions and be sure to note the case
we can't diagnose yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 19:51:03 +00:00
John McCall 9f54ad4381 Implement redeclaration checking and hiding semantics for using declarations. There
are a couple of O(n^2) operations in this, some analogous to the usual O(n^2)
redeclaration problem and some not.  In particular, retroactively removing
shadow declarations when they're hidden by later decls is pretty unfortunate.
I'm not yet convinced it's worse than the alternative, though.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91045 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 09:41:52 +00:00
Douglas Gregor 20093b4bf6 Reimplement reference initialization (C++ [dcl.init.ref]) using the
new notion of an "initialization sequence", which encapsulates the
computation of the initialization sequence along with diagnostic
information and the capability to turn the computed sequence into an
expression. At present, I've only switched one CheckReferenceInit
callers over to this new mechanism; more will follow.

Aside from (hopefully) being much more true to the standard, the
diagnostics provided by this reference-initialization code are a bit
better than before. Some examples:

p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct
Derived'
      cannot bind to a value of unrelated type 'struct Base'
  Derived &dr2 = b; // expected-error{{non-const lvalue reference to
  ...
           ^     ~
p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to
a value of
      type 'struct Base const' drops qualifiers
  Base &br3 = bc; // expected-error{{drops qualifiers}}
        ^     ~~

p5-var.cpp:57:15: error: ambiguous conversion from derived class
      'struct Diamond' to base class 'struct Base':
    struct Diamond -> struct Derived -> struct Base
    struct Diamond -> struct Derived2 -> struct Base
  Base &br5 = diamond; // expected-error{{ambiguous conversion from
      ...
              ^~~~~~~
p5-var.cpp:59:9: error: non-const lvalue reference to type 'long'
      cannot bind to
      a value of unrelated type 'int'
  long &lr = i; // expected-error{{non-const lvalue reference to type
      ...
        ^    ~

p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct
Base' cannot
      bind to a temporary of type 'struct Base'
  Base &br1 = Base(); // expected-error{{non-const lvalue reference to
  ...
        ^     ~~~~~~

p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field
'i'
  int & ir1 = (ib.i); // expected-error{{non-const reference cannot
  ...
        ^     ~~~~~~
p5-var.cpp:98:7: note: bit-field is declared here
  int i : 17; // expected-note{{bit-field is declared here}}
      ^






git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 23:02:17 +00:00
Anders Carlsson b6cc91be4d Pass the current SourceLocation to getAssignOperatorMethod, fixing a crash when the assign operator method needs to be instantiated. Doug, please review the updated default-assignment-operator.cpp change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 03:01:51 +00:00
John McCall 604e7f14d6 Correctly implement the C++03 and 0x restrictions on class-member using
declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 07:46:18 +00:00
Anders Carlsson d6a637f8c8 Rework how virtual member functions are marked. If a class has no key function, we now wait until the end of the translation unit to mark its virtual member functions as references. This lays the groundwork for fixing PR5557.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90752 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 08:24:59 +00:00
Anders Carlsson f53df2398e Move key functions to a separate map.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 04:35:11 +00:00
John McCall a93c934af4 DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated variables,
but the results are imperfect.

For posterity, I did:

cat <<EOF > $cmdfile
s/DeclaratorInfo/TypeSourceInfo/g
s/DInfo/TInfo/g
s/TypeTypeSourceInfo/TypeSourceInfo/g
s/SourceTypeSourceInfo/TypeSourceInfo/g
EOF

find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \;
find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \;
find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 02:54:59 +00:00
Eli Friedman 0336843eb0 Fix a slight oversight in computing whether a copy constructor is elidable.
Fixes PR5695.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 09:26:33 +00:00
Eli Friedman d013733c73 Fix for PR5693: shift some code into SetClassDeclAttributesFromBase so that
it gets called during template instantiation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 23:03:49 +00:00
John McCall ed97649e95 Fix "using typename" and the instantiation of non-dependent using declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 22:46:56 +00:00
Douglas Gregor 1ab537be68 Unify the end-of-class code paths used by the parser and template
instantiation, to ensure that we mark class template specilizations as
abstract when we need to and perform checking of abstract classes.

Also, move the checking that determines whether we are creating a
variable of abstract class type *after* we check whether the type is
complete. Otherwise, we won't see when we have an abstract class
template specialization that is implicitly instantiated by this
declaration. This is the "something else" that Sebastian had noted
earlier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 18:33:45 +00:00
Anders Carlsson 51f940457a When instantiating a class, if a base specifier is not dependent we still need to copy its attributes down to the instantiated class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 17:49:57 +00:00
John McCall 701c89e02c Honor using declarations in overload resolution. Most of the code for
overloaded-operator resolution is wildly untested, but the parallel code for
methods seems to satisfy some trivial tests.

Also change some overload-resolution APIs to take a type instead of an expression,
which lets us avoid creating a spurious CXXThisExpr when resolving implicit
member accesses.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 04:06:58 +00:00
Douglas Gregor 802ab45fea Improve source location information for C++ member initializers in a
constructor, by keeping the DeclaratorInfo* rather than just the type
and a single location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 22:36:29 +00:00
Anders Carlsson 5ec02ae147 In Sema, whenever we think that a function is going to cause a vtable to be generated, we mark any virtual implicit member functions as referenced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 17:15:43 +00:00
Eli Friedman ca6affd016 Make sure to call AddOverriddenMethods for implicit copy assignment operators;
it's rare, but possible, for the difference to be significant.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90301 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 06:59:20 +00:00
Fariborz Jahanian 6bc9768408 Fix a code gen. crash synthesizing a destructor.
Fixes pr5660.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 23:18:25 +00:00
Douglas Gregor 4ba3136b3e Move the checking of overridden virtual functions into the code path
common to both parsing and template instantiation, so that we'll find
overridden virtuals for member functions of class templates when they
are instantiated. 

Additionally, factor out the checking for pure virtual functions, so
that it will be executed both at parsing time and at template
instantiation time. 

These changes fix PR5656 (for real), although one more tweak
w.r.t. member function templates will be coming along shortly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 17:24:26 +00:00
Douglas Gregor 9af2f52fbc Don't automatically assume that an id-expression refers to a
ValueDecl, because that isn't always the case in ill-formed
code. Diagnose a common mistake (forgetting to provide a template
argument list for a class template, PR5655) and dyn_cast so that we
handle the general problem of referring to a non-value declaration
gracefully.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 16:58:18 +00:00
Anders Carlsson 3790980841 When we're trying to define an implicit virtual destructor, make sure that we have a valid delete operator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90156 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 21:24:50 +00:00
Benjamin Kramer 85b4521e34 Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 19:45:26 +00:00
Sean Hunt 0486d74601 Add Parser support for C++0x literal operators ('operator "" i').
DeclarationName can't handle them yet, so right now Parser just errors out on them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90027 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 04:44:28 +00:00
Anders Carlsson d5a942b911 When adding an implicit destructor, make sure to mark it as virtual if it overrides existing destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 21:25:09 +00:00
Fariborz Jahanian 6a587cbd69 Better diagnostic on deleted constructor when no
initializer name is available.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 21:53:11 +00:00
Douglas Gregor 5b6d70e2de Diagnose ill-formed uses of default template arguments in
function templates (in C++98), friend function templates, and
out-of-line definitions of members of class templates.

Also handles merging of default template arguments from previous
declarations of function templates, for C++0x. However, we don't yet
make use of those default template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 17:50:39 +00:00
Douglas Gregor 99e9b4d172 Eliminate CXXConditionDeclExpr with extreme prejudice.
All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).

Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting

Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on
commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 00:27:52 +00:00
Sebastian Redl d1a7846699 Have the parser tell sema whether a member declaration is a function definition. This allows sema to not emit spurious diagnostics in some invalid code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 23:38:44 +00:00
Fariborz Jahanian 2fe168fc89 Refactor argument collection of constructor calls using
the common routine.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 21:37:28 +00:00
Sebastian Redl eb0d8c95b4 Let using directives refer to namespace aliases. Fixes PR5479.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 15:34:23 +00:00
Douglas Gregor 7edfb69ae1 Do not mark declarations as used when performing overload resolution. Fixes PR5541
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89652 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 12:27:39 +00:00
John McCall d5532b6cff Encapsulate "an array of TemplateArgumentLocs and two angle bracket locations" into
a new class.  Use it pervasively throughout Sema.

My fingers hurt.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 01:53:49 +00:00
John McCall ba13543329 "Incremental" progress on using expressions, by which I mean totally ripping
into pretty much everything about overload resolution in order to wean
BuildDeclarationNameExpr off LookupResult::getAsSingleDecl().  Replace  
UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the
idea of a non-member lookup that we haven't totally resolved yet, whether by
overloading, argument-dependent lookup, or (eventually) the presence of   
a function template in the lookup results.  

Incidentally fixes a problem with argument-dependent lookup where we were 
still performing ADL even when the lookup results contained something from
a block scope.  

Incidentally improves a diagnostic when using an ObjC ivar from a class method.
This just fell out from rewriting BuildDeclarationNameExpr's interaction with
lookup, and I'm too apathetic to break it out.

The only remaining uses of OverloadedFunctionDecl that I know of are in
TemplateName and MemberExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89544 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21 08:51:07 +00:00
Sean Hunt bbd37c62e3 Added rudimentary C++0x attribute support.
The following attributes are currently supported in C++0x attribute
lists (and in GNU ones as well):
 - align() - semantics believed to be conformant to n3000, except for
   redeclarations and what entities it may apply to
 - final - semantics believed to be conformant to CWG issue 817's proposed
   wording, except for redeclarations
 - noreturn - semantics believed to be conformant to n3000, except for
   redeclarations
 - carries_dependency - currently ignored (this is an optimization hint)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89543 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21 08:43:09 +00:00
John McCall 6826314938 Overhaul previous-declaration and overload checking to work on lookup results
rather than NamedDecl*.  This is a major step towards eliminating
OverloadedFunctionDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 22:49:29 +00:00
John McCall 7d384dd5ac Split LookupResult into its own header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 07:57:50 +00:00
John McCall 7ba107a186 Incremental progress on using declarations. Split UnresolvedUsingDecl into
two classes, one for typenames and one for values;  this seems to have some
support from Doug if not necessarily from the extremely-vague-on-this-point
standard.  Track the location of the 'typename' keyword in a using-typename
decl.  Make a new lookup result for unresolved values and deal with it in
most places.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 02:36:19 +00:00
Douglas Gregor 6490ae5003 Silence some warnings produced by Clang, and add a missing header
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89051 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 06:14:37 +00:00
John McCall 9488ea120e Instead of hanging a using declaration's target decls directly off the using
decl, create shadow declarations and put them in scope like normal.
Work in progress.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 05:59:44 +00:00
Anders Carlsson 9f853df0d3 Unify the way destructor epilogues are generated for synthesized and regular destructors. Also fix PR5529.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 04:44:12 +00:00
John McCall a24dc2e38c Carry lookup configuration throughout lookup on the LookupResult. Give
LookupResult RAII powers to diagnose ambiguity in the results.  Other diagnostics
(e.g. access control and deprecation) will be moved to automatically trigger
during lookup as part of this same mechanism.

This abstraction makes it much easier to encapsulate aliasing declarations
(e.g. using declarations) inside the lookup system:  eventually, lookup will
just produce the aliases in the LookupResult, and the standard access methods
will naturally strip the aliases off.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89027 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 02:14:36 +00:00
Eli Friedman e73d3bc991 Simplify the AST a bit by skipping creating member initializers for members
with a trivial constructor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 23:07:59 +00:00
Douglas Gregor a4923eb7c4 First part of changes to eliminate problems with cv-qualifiers and
sugared types. The basic problem is that our qualifier accessors
(getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at
the current QualType and not at any qualifiers that come from sugared
types, meaning that we won't see these qualifiers through, e.g.,
typedefs:

  typedef const int CInt;
  typedef CInt Self;

Self.isConstQualified() currently returns false!

Various bugs (e.g., PR5383) have cropped up all over the front end due
to such problems. I'm addressing this problem by splitting each
qualifier accessor into two versions: 

  - the "local" version only returns qualifiers on this particular
    QualType instance
  - the "normal" version that will eventually combine qualifiers from this
    QualType instance with the qualifiers on the canonical type to
    produce the full set of qualifiers.

This commit adds the local versions and switches a few callers from
the "normal" version (e.g., isConstQualified) over to the "local"
version (e.g., isLocalConstQualified) when that is the right thing to
do, e.g., because we're printing or serializing the qualifiers. Also,
switch a bunch of
  
  Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType()

expressions over to 

  Context.hasSameUnqualifiedType(T1, T2)




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 21:35:15 +00:00
Anders Carlsson 6d7013940a Make sure that virtual destructors have delete operators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 22:49:34 +00:00
Douglas Gregor c07a494b37 Don't gratuitously mark the default constructors of base or member initializers as used
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 08:51:10 +00:00
Sebastian Redl a82e4ae149 - Have TryStaticImplicitCast set the cast kind to NoOp when binding a reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly.
- Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions.
- Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 21:15:49 +00:00
Douglas Gregor 19aeac6ea4 When type-checking a static cast (or the static_cast part of a C-style
cast) that is converting to a class type, enumerate its constructors
as in any other direct initialization. This ensures that we get the
proper conversion sequence.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 03:27:21 +00:00
Douglas Gregor 66724ea67d If we attempt to add a constructor template specialization that looks
like a copy constructor to the overload set, just ignore it. This
ensures that we don't try to use such a constructor as a copy
constructor *without* triggering diagnostics at the point of
declaration.

Note that we *do* diagnose such copy constructors when explicitly
written by the user (e.g., as an explicit specialization).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 01:20:54 +00:00
Anders Carlsson 8db68da430 Clear temporaries in more places.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 20:11:49 +00:00
Anders Carlsson f8a9a797a4 Fix bug Doug noticed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 19:21:49 +00:00
Douglas Gregor afe7ec28b1 When transforming an expression statement (e.g., for template
instantiation), be sure to finish the expression statement by
providing a FullExprArg, making sure that temporaries get
destroyed. Fixes an obscure failure when parsing
llvm/LinkAllPasses.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 18:34:26 +00:00
Douglas Gregor cffecd08f1 Give CanQual<T> an implicit conversion to bool, so that it can be used
in "if" statements like:

  if (CanQual<ReferenceType> RefType = T.getAs<ReferenceType>())

Thanks to Clang for pointing out this mistake :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86995 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 16:49:45 +00:00
John McCall af8e6ed61b Random const correctness, and incidentally use computeDeclContext when building
a using declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86942 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 03:15:40 +00:00
Fariborz Jahanian b03bfa55d0 Diagnose illegally typed operator new/new[].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:47:18 +00:00
Douglas Gregor 314b97f8c5 Improve parsing of template arguments to lay the foundation for
handling template template parameters properly. This refactoring:

  - Parses template template arguments as id-expressions, representing
    the result of the parse as a template name (Action::TemplateTy)
    rather than as an expression (lame!).

  - Represents all parsed template arguments via a new parser-specific
    type, ParsedTemplateArgument, which stores the kind of template
    argument (type, non-type, template) along with all of the source
    information about the template argument. This replaces an ad hoc
    set of 3 vectors (one for a void*, which was either a type or an
    expression; one for a bit telling whether the first was a type or
    an expression; and one for a single source location pointing at
    the template argument).

  - Moves TemplateIdAnnotation into the new Parse/Template.h. It never
    belonged in the Basic library anyway.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:49:08 +00:00
Anders Carlsson 4881b99bc8 Use PP.getLocForEndOfToken as suggested by John.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 03:32:44 +00:00
Anders Carlsson ad26b7376b If a function with a default argument is redefined and the new function also has a defualt argument then add a fixit hint that removes the default argument. Fixes PR5444.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 03:24:44 +00:00
Eli Friedman 80c30dad6c Add additional note to mark the cause of synthesized constructors. Mark
declaration invalid if the constructor can't be properly built.  Addresses
remaining review comments from Fariborz for r86500.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 19:20:36 +00:00
Eli Friedman f8db4771d4 Remove a useless variable that got left behind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 01:11:03 +00:00
Eli Friedman 49c16da71b Unify the codepaths used to verify base and member initializers for explicitly
and implicitly defined constructors.  This has a number of benefits:

1. Less code.

2. Explicit and implicit constructors get the same diagnostics.

3. The AST explicitly contains constructor calls from implicit default
constructors.  This allows handing some cases that previously weren't handled
correctly in IRGen without any additional code. Specifically, implicit default
constructors containing calls to constructors with default arguments are now
handled correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 01:05:47 +00:00
Douglas Gregor 3eaa9ffa17 Always make sure we're using an unqualified type when building a
constructor name.  Fixes PR5418.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86441 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 07:12:55 +00:00
Eli Friedman 88fad6310d Make sure isCopyAssignment is only true for actual copy assignment operators,
instead of all assignment operators.  The mistake messes up IRGen because
it ends up assuming that the assignment operator is actually the implicit
copy assignment operator, and therefore tries to emit the RHS as an lvalue.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:02:45 +00:00
Fariborz Jahanian 966256afd4 This patch implements Sema for clause 13.3.3.1p4.
It has to do with vararg constructors used as conversion
functions. Code gen needs work. This is WIP.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 00:23:08 +00:00
Douglas Gregor 393896f49d Fixed two places where we needed to force completion of a type
(without complaining if it fails) to get proper semantics: reference
binding with a derived-to-base conversion and the enumeration of
constructors for user-defined conversions. There are probably more
cases to fix, but my prior attempt at statically ensuring that
complete-type checking always happens failed. Perhaps I'll try again.

With this change, Clang can parse include/llvm/*.h!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 13:06:35 +00:00
John McCall 6aee621291 Comments, formatting. Based on patch by Brandon Pearcy!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 23:13:52 +00:00
John McCall b41900410f Diagnose using a field to initialize itself. Patch by Brandon Pearcy!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86061 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 23:02:40 +00:00
Douglas Gregor 1fe6b919f7 Don't try to check the initialization of fields with dependent
types. Fixes PR5352.

Fariborz, please review.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 17:16:11 +00:00
Douglas Gregor 12c118a8ff Switch parsing of using declarations over to ParseUnqualifiedId.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86027 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 16:30:06 +00:00
Douglas Gregor 3f9a0566e6 Introduce a new class, UnqualifiedId, that provides a parsed
representation of a C++ unqualified-id, along with a single parsing
function (Parser::ParseUnqualifiedId) that will parse all of the
various forms of unqualified-id in C++.

Replace the representation of the declarator name in Declarator with
the new UnqualifiedId class, simplifying declarator-id parsing
considerably and providing more source-location information to
Sema. In the future, I hope to migrate all of the other
unqualified-id-parsing code over to this single representation, then
begin to merge actions that are currently only different because we
didn't have a unqualified notion of the name in the parser.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85851 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 01:35:08 +00:00
Anders Carlsson 0ebb6d391d Make sure to call CompleteConstructorCall for bases and members that are initialized implicitly in constructors so that default arguments etc are set correctly. Fixes PR5283.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 15:46:07 +00:00
Fariborz Jahanian 680a3f3581 Use array's base element type in getting to its
constructor. WIP.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 19:04:36 +00:00
Fariborz Jahanian c0fcce4614 Removed an unnecessary arguement passed to InitializeVarWithConstructor
which should come from the variable and wasn't correct for arrays in any case.
No change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 18:41:06 +00:00
Chris Lattner 5a597a9d1c remove a nonsensical todo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85067 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 21:19:07 +00:00
Chris Lattner c7f1904474 change Sema::ActOnFriendTypeDecl to use GetTypeForDeclarator instead
of ConvertDeclSpecToType, which I'd like to keep private to SemaType.cpp.
We do this by cons'ing up a trivial Declarator for the type.

John, please review.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 17:47:27 +00:00
Sebastian Redl 9994a34f6c Audit the code for places where it is assumed that every base specifier refers to a RecordType. Add assertions or conditions as appropriate. This fixes another crash in the Apache stdlib vector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 17:03:50 +00:00
John McCall 54e14c4db7 When building types from declarators, instead of building two types (one for
the DeclaratorInfo, one for semantic analysis), just build a single type whose
canonical type will reflect the semantic analysis (assuming the type is
well-formed, of course).

To make that work, make a few changes to the type system:
* allow the nominal pointee type of a reference type to be a (possibly sugared)
  reference type.  Also, preserve the original spelling of the reference type.
  Both of these can be ignored on canonical reference types.
* Remove ObjCProtocolListType and preserve the associated source information on
  the various ObjC TypeLocs.  Preserve the spelling of protocol lists except in
  the canonical form.
* Preserve some level of source type structure on parameter types, but
  canonicalize on the canonical function type.  This is still a WIP.

Drops code size, makes strides towards accurate source location representation,
slight (~1.7%) progression on Cocoa.h because of complexity drop.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:37:11 +00:00
Douglas Gregor 573d9c3252 Don't (directly) call RequireCompleteType with an invalid source location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84793 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 23:19:44 +00:00
Anders Carlsson 96ad5337a4 Change FixOverloadedFunctionReference to return a (possibly new) expression. Substitute TemplateIdRefExprs with DeclRefExprs. Doug, plz review :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84763 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 17:16:23 +00:00
Anders Carlsson 2782302961 It's OK for a pure virtual function to override another pure virtual function. Fixes PR5222.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 19:34:08 +00:00
Douglas Gregor 663b5a0be7 Testing and some minor fixes for explicit template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 20:14:33 +00:00
Fariborz Jahanian d9290cb5ad Handle ambiguity of reference initialization.
Removes a FIXME.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 00:52:43 +00:00
Douglas Gregor 8c638ab9e7 Remove some non-ASCII characters
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 23:52:38 +00:00
Douglas Gregor 3f09327b26 Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".

This is part of PR3990, but we're not quite there yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 21:16:44 +00:00
Douglas Gregor 096ebfda90 Diagnose attempts to add default function arguments to a
specialization. This completes C++ [temp.expl.spec]!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:02:54 +00:00
Douglas Gregor a735b206fd Improve the internal representation and semantic analysis of friend
function templates.

This commit ensures that friend function templates are constructed as
FunctionTemplateDecls rather than partial FunctionDecls (as they
previously were). It then implements template instantiation for friend
function templates, injecting the friend function template only when
no previous declaration exists at the time of instantiation. 

Oh, and make sure that explicit specialization declarations are not
friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 14:39:41 +00:00
Sebastian Redl dced226e37 Test exception spec compatibility on return type and parameters.
Along the way, use RequireCompleteType when testing exception spec types.
Separate all the ugly spec stuff into its own file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 09:03:14 +00:00
Sebastian Redl 2c7588f126 Implement the core checking for compatible exception specifications in assignment and initialization.
The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet.
This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 12:04:10 +00:00
John McCall f36e02d4af Refactor the LookupResult API to simplify most common operations. Require users to
pass a LookupResult reference to lookup routines.  Call out uses which assume a single
result.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83674 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 21:13:30 +00:00
Fariborz Jahanian 0c728f1eb2 Fix up error reporting when object cannot be constructed
because of missing default constructor of a member.
Fixes pr5154.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 22:15:49 +00:00
John McCall e3af0235ce Refactoring around friend class templates. Better error message for friend enums.
Don't create a new declaration for friend classes if a declaration already exists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 23:34:25 +00:00
Douglas Gregor a8f32e0965 Refactor the code that walks a C++ inheritance hierarchy, searching
for bases, members, overridden virtual methods, etc. The operations
isDerivedFrom and lookupInBases are now provided by CXXRecordDecl,
rather than by Sema, so that CodeGen and other clients can use them
directly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 17:59:45 +00:00
John McCall 9aeed32282 Anonymous namespaces, sema + codegen. A lot of semantics are still broken,
apparently because using directives aren't quite working correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 00:25:31 +00:00
Fariborz Jahanian 893f955321 Issue good diagnostics when initializing a refernce type with
a bad initializer. Fixes pr4274.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 21:23:30 +00:00
John McCall bf1cc05907 Desugaring optimizations. Add single-step desugaring methods to all
concrete types.  Use unqualified desugaring for getAs<> and sundry.
Fix a few users to either not desugar or use qualified desugar, as seemed
appropriate.  Removed Type's qualified desugar method, as it was easy
to accidentally use instead of QualType's.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 23:03:30 +00:00
Argyrios Kyrtzidis f352bddf01 Introduce ObjCProtocolListLoc for keeping source location information for protocol references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 19:43:35 +00:00
Fariborz Jahanian 82ad87b872 Minor API change. No change in functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83022 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 22:03:07 +00:00
Douglas Gregor 182ddf0e5d Improve handling of friend function templates somewhat
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 00:08:27 +00:00
Douglas Gregor d85bea2aff Rework the Parse-Sema interaction for friends to better support friend
class templates. We now treat friend class templates much more like
normal class templates, except that they still get special name lookup
rules. Fixes PR5057 and eliminates a bunch of spurious diagnostics in
<iostream>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 06:47:28 +00:00
John McCall 0953e767ff Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy.  Demote 'volatile' to extended-qualifier status.  Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right;  many more remain.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 19:53:00 +00:00
Fariborz Jahanian 7ad2d562e8 Use Doug's DeclLoc to pinpoint location of the declaration
in a reference initialization diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 00:42:43 +00:00
Douglas Gregor 739d828314 Improve diagnostic location information when checking the initialization of a reference
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 23:04:10 +00:00
Fariborz Jahanian 8f489d692f patch to ir-gen conversion function call used in
initializing a reference class.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 22:34:00 +00:00
Fariborz Jahanian 2b51138433 Remove the FIXME as I said.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:56:34 +00:00
Fariborz Jahanian 51bebc83e7 This patch addresses a few issues related to 8.5.3 [dcl.init.ref]
It uses a recent API to find inherited conversion functions to do
the initializer to reference lvalue conversion (and removes a FIXME).
It issues the ambiguity diagnostics when multiple conversions are found.
WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:55:32 +00:00
John McCall 183700f494 Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely.  Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 23:43:11 +00:00
Douglas Gregor d85cef5a54 Merge uninstantiated default arguments more carefully, and try not to
complain about specializations of member functions that are not
definitions. Fixes PR4995.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 19:51:30 +00:00
John McCall dd4a3b0065 Improved representation and support for friend class templates. Angst about same.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 22:47:08 +00:00
Douglas Gregor 7adb10fa31 When implicitly declaring operators new, new[], delete, and delete[],
give them the appropriate exception specifications. This,
unfortunately, requires us to maintain and/or implicitly generate
handles to namespace "std" and the class "std::bad_alloc". However,
every other approach I've come up with was more hackish, and this
standard requirement itself is quite the hack.

Fixes PR4829.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 22:30:29 +00:00
Anders Carlsson 7171011353 Add back the workaround since it lead to constructor conversion bugs :(
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 21:14:33 +00:00
Anders Carlsson f6c213a931 When performing an user defined conversion sequence, perform the initial standard conversion sequence. This lets us remove a workaround in SemaCompleteConstructorCall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 06:28:28 +00:00
John McCall 05b23ea211 Skeletal support for friend class templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81801 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 21:59:20 +00:00
Fariborz Jahanian debc629300 Removed Context argument from couple of methods which don't
need them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-12 19:02:34 +00:00
John McCall bbbcdd9cc0 Alter Action's friend interface to prepare for templated friend declarations and
to stop making promises we can't currently keep.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 21:02:39 +00:00
Douglas Gregor 6cc1518b9f Cleanup and test C++ default arguments. Improvements include:
- Diagnose attempts to add default arguments to templates (or member
    functions of templates) after the initial declaration (DR217).
  - Improve diagnostics when a default argument is redefined. Now, the
    note will always point at the place where the default argument was
    previously defined, rather than pointing to the most recent
    declaration of the function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 18:44:32 +00:00
Douglas Gregor 1cdcc579df When re-entering a template scope, we may be entering a class template
partial specialization rather than a subclass of TemplateDecl. Fixes a
crash in libstdc++ 4.2's <map>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 00:12:48 +00:00
Douglas Gregor 39da0b8145 Improve handling of initialization by constructor, by ensuring that
such initializations properly convert constructor arguments and fill
in default arguments where necessary. This also makes the ownership
model more clear.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 23:08:42 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
John McCall 6b2becfc43 Support templateids in friend declarations. Fixes bug 4859.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 17:47:29 +00:00
Anders Carlsson d74d4149f7 Handle variadic constructors better. Share code between BuildCXXConstructExpr and BuildCXXTemporaryObjectExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 01:48:42 +00:00
Anders Carlsson f47511ab05 BuildCXXConstructExpr now takes a MultiExprArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-07 22:23:31 +00:00
Anders Carlsson 21e1c4ea0a Reapply 81096, now with a fix. Spot the bug:
for (unsigned i = numargs; i < NumArgs; ++i)
        Args[0] = 0;

;)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81123 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 16:54:02 +00:00
Daniel Dunbar 4355be0758 Revert "Initialize default CXXConstructExpr arguments to 0. Fixes a crash when
destroying the CXXConstructExpr.", this is causing test failures across the
board.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 01:31:23 +00:00
Anders Carlsson 657bff7ff3 Initialize default CXXConstructExpr arguments to 0. Fixes a crash when destroying the CXXConstructExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-05 22:51:06 +00:00
Anders Carlsson ec8e5ea799 Pass the ConstructLoc to BuildCXXConstructExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-05 07:40:38 +00:00
Douglas Gregor 4fe95f99a2 Don't generate any code for an explicit call to a trivial destructor.
Now that parsing, semantic analysis, and (I think) code generation of
pseudo-destructor expressions and explicit destructor calls works,
update the example-dynarray.cpp test to destroy the objects it
allocates and update the test to actually compile + link.
The code seems correct, but the Clang-compiled version dies with a
malloc error. Time to debug!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 19:04:08 +00:00
Fariborz Jahanian 34374e6ce5 Patch to instantiate destructors used to destruct
base and data members when they are needed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 23:18:17 +00:00
Fariborz Jahanian 9d436205be Mark constructors used in initialization of base(s) and fields
as referecned with location where they are used. Still
need to look at destructor aspects of them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 21:32:41 +00:00
Fariborz Jahanian 80545ad0f9 Issue diagnostics in variety of situations involving
reference/const data members when user has declared
the constructor. This necessitated some non-minor
refactoring.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 19:36:46 +00:00
Fariborz Jahanian 916a5ed560 Minor refactoring of my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 23:11:48 +00:00
Fariborz Jahanian cf1b9c790a Referenced instatiated default constructors
must be defined. Fixed pr4853.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 23:02:57 +00:00
Fariborz Jahanian 636a0ffbd2 Allow null initialization of scalara data members
in constructors's initializer list. pr4854



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 17:10:17 +00:00
Anders Carlsson cdc83c7779 Don't assume that a base is always a RecordType, it can also be a TemplateSpecializationType. Also, make sure to get the instantiated union member.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80662 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 06:22:14 +00:00
John McCall ab88d97734 Fix bug 4784 and allow friend declarations to properly extend
existing declaration chains.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 22:39:49 +00:00
Anders Carlsson 05180afbf4 Use DiagnoseMissingMember for UsingDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80470 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 00:58:45 +00:00
Anders Carlsson f4d84b663e Improve diagnostics for missing members. This renames the err_typecheck_no_member to err_typecheck_no_member_deprecated. The idea is that err_typecheck_no_member_deprecated should be phased out and any call sites that reference it should call DiagnoseMissingMember instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 00:54:35 +00:00
Anders Carlsson 595adc1795 Set the access specifier for using decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 19:54:19 +00:00
John McCall 5fee110ac1 For consistency, just make friend declarations AS_public.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 03:50:18 +00:00
Anders Carlsson 8c57a66a2a Store the SourceLocation of right parentheses in member initializers. Patch by Anders Johnsen!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 01:31:33 +00:00
Anders Carlsson faccd72e24 Fix this for real.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 16:57:08 +00:00
Anders Carlsson 08972924fa Pass InOverloadResolution all the way down to IsPointerConversion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 15:33:32 +00:00
Anders Carlsson 0dde18e5a7 Instantiate unresolved using declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 15:18:15 +00:00
John McCall 02cace78cf Omnibus friend decl refactoring. Instead of cloning AST classes for friend
declarations of same, introduce a single AST class and add appropriate bits
(encoded in the namespace) for whether a decl is "real" or not.  Much hackery
about previously-declared / not-previously-declared, but it's essentially
mandated by the standard that friends alter lookup, and this is at least
fairly non-intrusive.

Refactor the Sema methods specific to friends for cleaner flow and less nesting.

Incidentally solve a few bugs, but I remain confident that we can put them back.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 07:59:38 +00:00
Anders Carlsson 550b14b410 Create UnresolvedUsingDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:49:21 +00:00
Anders Carlsson c72160ba4c Factor declaration building out to Sema::BuildUsingDeclaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:40:36 +00:00
Anders Carlsson 73b39cf02e More work on using declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 03:35:18 +00:00
Anders Carlsson cf9f921268 Many improvements to using declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 03:16:11 +00:00
Anders Carlsson 2de3aced4c Remove more default arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:30:43 +00:00
Anders Carlsson da7a18be8f Remove default arguments from TryImplicitConversion and fix a bug found in the process.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:24:15 +00:00
Anders Carlsson 2974b5cd26 Revert the flags change for now, I have a better idea for this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:14:02 +00:00
Anders Carlsson 1937738953 Add a OverloadResolutionFlags and start converting some of the overload methods over to using it instead of bools arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 16:01:18 +00:00
Anders Carlsson 8d4c5ea0ee Don't check member and base initializers if the constructor is dependent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 05:57:30 +00:00
Anders Carlsson 5c36fb22d9 Use early returns to avoid indentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 05:45:01 +00:00
Eli Friedman 2a16a13881 Stub out an error so we don't crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 05:09:36 +00:00
Anders Carlsson e7624a75b7 Add a BuildCXXTemporaryObjectExpr and use it so default arguments will be instantiated correctly for temporary object expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80206 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 05:08:22 +00:00
Anders Carlsson a6ec7ad25a New RequireNonAbstractType function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 00:13:57 +00:00
Anders Carlsson b790661a15 Bye-bye old RequireCompleteType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 23:45:07 +00:00
Douglas Gregor 83ddad3ab5 Implement support for C++ direct initializers that involve dependent
types or type-dependent expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80143 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 21:14:46 +00:00
Anders Carlsson 5653ca5088 If a parameter has a default argument expression, make sure to instantiate the parameter type before checking that the expression is a valid initializer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 13:46:13 +00:00
Anders Carlsson 8644aecd43 Improved support for default arguments in constructors for class templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 13:07:08 +00:00
Anders Carlsson fe2de492d0 InitializeVarWithConstructor now returns true on failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79976 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 05:18:00 +00:00
Anders Carlsson da3f4e2dd5 BuildCXXConstructExpr now returns an OwningExprResult.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79975 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 05:12:04 +00:00
Anders Carlsson 9351c173cd Basic support for default argument expressions for function templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 03:18:48 +00:00
Anders Carlsson ed961f989e Factor setting default arguments out into SetParamDefaultArgument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 02:29:20 +00:00
Anders Carlsson 5f49a0c693 Use hasDefaultArg instead of getDefaultArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 01:23:32 +00:00
Anders Carlsson 66e3067d98 Check that the default argument is well-formed before checking the initializer types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 01:02:06 +00:00
Douglas Gregor 5842ba9fd4 Try to complete a type before looking for conversion functions within
that type. Note that we do not produce a diagnostic if the type is
incomplete; rather, we just don't look for conversion functions. Fixes PR4660.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79919 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 15:23:48 +00:00
Douglas Gregor efd5bdad3c Make sure to adjust function template declarations to their templated
declarations (e.g., FunctionTemplateDecl -> CXXConstructorDecl) before
performing semantic analysis on the declarations. Fixes PR4761.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 11:57:43 +00:00
Douglas Gregor 65ec1fda47 Implement conversion function templates, along with the ability to use
template argument deduction from a conversion function (C++
[temp.deduct.conv]) with implicit conversions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79693 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 23:19:43 +00:00
Douglas Gregor ac373c4ca5 Fix parsing for out-of-line definitions of constructors and
destructors of class templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 22:16:40 +00:00
Douglas Gregor dec06664a1 Introduce support for constructor templates, which can now be declared
and will participate in overload resolution. Unify the instantiation
of CXXMethodDecls and CXXConstructorDecls, which had already gotten
out-of-sync.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79658 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 18:42:58 +00:00
Argyrios Kyrtzidis a5d82000f7 Remove TypeSpecStartLocation from VarDecl/FunctionDecl/FieldDecl, and use DeclaratorInfo to get this information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 00:31:54 +00:00
Douglas Gregor 37b372b76a Initial support for parsing and representation of member function templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 22:52:58 +00:00