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

809 Коммитов

Автор SHA1 Сообщение Дата
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 d3a505827f An inherited virtual (where "virtual" wasn't written explicitly) can
be defined as pure. Fixes PR5656.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90237 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 16:18:00 +00:00
John McCall 7dafdf5117 Remove all of Sema's explicit uses of OverloadedFunctionDecl except for
those associated with TemplateNames.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 22:55:35 +00:00
John McCall 129e2df52e Eliminate the use of OverloadedFunctionDecl in member expressions.
Create a new UnresolvedMemberExpr for these lookups.  Assorted hackery
around qualified member expressions;  this will all go away when we
implement the correct (i.e. extremely delayed) implicit-member semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90161 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 22:42:35 +00:00
Benjamin Kramer bb377edda2 Use StringRef in Attr constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 17:08:26 +00:00
Sean Hunt 3e518bda00 Add DeclarationName support for C++0x operator literals. They should now work as
function names outside of templates - they'll probably cause some damage there as
they're largely untested.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90064 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 07:34:05 +00:00
Sean Hunt f4fdd9b58c Fix 80-cols violations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 03:04:53 +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 1a68972b54 Fix thinko.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89983 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 01:26:58 +00:00
Anders Carlsson 954968034e Correctly find overridden destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 20:50:40 +00:00
Fariborz Jahanian 369a3bd997 Allow user re-definition of SEL as well as accessing its fields.
This fixes pr5611.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 23:07:42 +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
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
Fariborz Jahanian 13dcd00615 This patch implements objective-c's 'SEL' type as a built-in
type and fixes a long-standing code gen. crash reported in
at least two PRs and a radar. (radar 7405040 and pr5025). 
There are couple of remaining issues that I would like for
Ted. and Doug to look at:

Ted, please look at failure in Analysis/MissingDealloc.m.
I have temporarily added an expected-warning to make the
test pass. This tests has a declaration of 'SEL' type which
may not co-exist with the new changes.

Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp.
I think the changes which I have ifdef'ed out are correct. They
need be considered for in a few Indexer/PCH test cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89561 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21 19:53:08 +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
Douglas Gregor f6e6fc801c Implement C++ [basic.lookup.classref]p3, which states how the type
name 'T' is looked up in the expression

  t.~T()

Previously, we weren't looking into the type of "t", and therefore
would fail when T actually referred to an injected-class-name. Fixes
PR5530.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 22:03:38 +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
Sebastian Redl a165da09c0 Track overriding methods when instantiating a template class. Fixes PR5550.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 21:51: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
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
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
Anders Carlsson 1f126bd18c Deallocation functions must also be static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 19:08:46 +00:00
Anders Carlsson 67bf2e7706 allocation functions are always static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 18:59:32 +00:00
Douglas Gregor d5b57281cc If any errors have occurred by the time we hit the end of a function body, clear out any remaining temporaries so they aren't seen later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 07:07:58 +00:00
Eli Friedman 49e2b8e2e5 Fix for PR5489: don't skip the complete type requrirement for variable
definitions just because the type happens to be an array type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88752 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 03:40:14 +00:00
Douglas Gregor fd47648b5d Revert r88718, which does NOT solve the constructor-template-as-copy-constructor issue. Big thanks to John for finding this
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 23:59:09 +00:00
Douglas Gregor cad84b7c12 A constructor template cannot be instantiated to a copy
constructor. Make sure that such declarations can never be formed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88718 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 23:14:53 +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
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
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
Douglas Gregor 89c49f09b0 Make sure that Type::getAs<ArrayType>() (or Type::getAs<subclass of
ArrayType>()) does not instantiate. Update all callers that used this
unsafe feature to use the appropriate ASTContext::getAs*ArrayType method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:08:55 +00:00
Sebastian Redl 9770ef0eea When checking the namespace of a redeclaration or definition, look through linkage specs. Fixes PR5430.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86461 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 11:36:54 +00:00
Anders Carlsson f7613d5361 Don't treat variables with non-trivial ctors or dtors as unused. Fixes PR5407.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 07:26:56 +00:00
Anders Carlsson 99a000e3ca Cleanup, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 07:18:14 +00:00
Douglas Gregor 4912c347ce Make sure that EnumConstantDecls always get a type, even when they have type-dependent initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 00:03:12 +00:00
Sebastian Redl 6e82475568 Don't allow definitions of array variables without some size information in C++. Fixed PR5401
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 19:47:47 +00:00
John McCall 54abf7d4fa Change our basic strategy for avoiding deprecation warnings when the decl use
appears in a deprecated context.  In the new strategy, we emit the warnings
as usual unless we're currently parsing a declaration, where "declaration" is
restricted to mean a decl group or a few special cases in Objective C.  If
we *are* parsing a declaration, we queue up the deprecation warnings until
the declaration has been completely parsed, and then emit them only if the
decl is not deprecated.
We also standardize the bookkeeping for deprecation so as to avoid special cases.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 02:18:39 +00:00
Douglas Gregor 02a24ee67c Use ParseUnqualifiedId when parsing id-expressions. This eliminates
yet another copy of the unqualified-id parsing code.

Also, use UnqualifiedId to simplify the Action interface for building
id-expressions. ActOnIdentifierExpr, ActOnCXXOperatorFunctionIdExpr,
ActOnCXXConversionFunctionExpr, and ActOnTemplateIdExpr have all been
removed in favor of the new ActOnIdExpression action.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85904 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 16:56:39 +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
John McCall 833ca991c1 Track source information for template arguments and template specialization
types.  Preserve it through template instantiation.  Preserve it through PCH,
although TSTs themselves aren't serializable, so that's pretty much meaningless.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 08:12:44 +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
Douglas Gregor 0130f3cc4c Rename FunctionDecl::isInline/setInline to
FunctionDecl::isInlineSpecified/setInlineSpecified.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 21:01:01 +00:00
Mike Stump cf57d61525 Almost missed this one... Doc update for last change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 02:07:23 +00:00
Mike Stump 1d7e767dc8 Refine noreturn handling. Fixes -Wmissing-noreturn so that it doesn't
complain that functions that have a return statement should be
declared noreturn.  Fixed PR5286.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85195 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 01:59:05 +00:00
Ted Kremenek 7762291803 Use a pred_iterator instead of a succ_iterator (wrong typedef).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 01:07:53 +00:00