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

196 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian 6250921cc5 More work toward having an access method for visible
conversion functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-12 18:26:03 +00:00
Anders Carlsson 61faec1e9c Use the correct CastKind for derived-to-base pointer conversions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81608 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-12 04:46:44 +00:00
Fariborz Jahanian 5346278f81 Patch to build visible conversion function list lazily and make its
first use in calling the conversion function on delete statements.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 21:44:33 +00:00
Douglas Gregor 043cad21b7 Diagnose VLAs as an error in C++.
Also, treat the GNU __null as an integral constant expression to match
GCC's behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81490 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 00:18:58 +00:00
Douglas Gregor 9cd9f3f55d For a C++ delete expression where the operand is of class type that
has a single conversion to pointer-to-object type, implicitly convert
to that pointer-to-object type (C++ [expr.delete]p1).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81401 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 23:39:55 +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
Anders Carlsson 0aebc81e02 If a cast expression needs either a conversion function or a constructor to be called, generate implicit child expressions that call them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81383 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 21:33:21 +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
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 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 a78c5c34fb If a destructor is referenced or a pseudo-destructor expression is
formed without a trailing '(', diagnose the error (these expressions
must be immediately called), emit a fix-it hint, and fix the code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81015 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 18:29:40 +00:00
Douglas Gregor a71d819bb8 Implement AST, semantics, and CodeGen for C++ pseudo-destructor
expressions, e.g.,

  p->~T()

when p is a pointer to a scalar type. 

We don't currently diagnose errors when pseudo-destructor expressions
are used in any way other than by forming a call.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81009 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 17:36:40 +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
Douglas Gregor c68afe2cbe Improve template instantiation for member access expressions that
involve qualified names, e.g., x->Base::f. We now maintain enough
information in the AST to compare the results of the name lookup of
"Base" in the scope of the postfix-expression (determined at template
definition time) and in the type of the object expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 21:38:09 +00:00
Douglas Gregor 2dd078ae50 Rewrite of our handling of name lookup in C++ member access expressions, e.g.,
x->Base::f

We no longer try to "enter" the context of the type that "x" points
to. Instead, we drag that object type through the parser and pass it
into the Sema routines that need to know how to perform lookup within
member access expressions.

We now implement most of the crazy name lookup rules in C++
[basic.lookup.classref] for non-templated code, including performing
lookup both in the context of the type referred to by the member
access and in the scope of the member access itself and then detecting
ambiguities when the two lookups collide (p1 and p4; p3 and p7 are
still TODO). This change also corrects our handling of name lookup
within template arguments of template-ids inside the
nested-name-specifier (p6; we used to look into the scope of the
object expression for them) and fixes PR4703.

I have disabled some tests that involve member access expressions
where the object expression has dependent type, because we don't yet
have the ability to describe dependent nested-name-specifiers starting
with an identifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 22:59:36 +00:00
Anders Carlsson b633c4ee62 Add a CK_FunctionToPointerDecay cast kind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 20:37:18 +00:00
Douglas Gregor c4bf26fbdf Preliminary AST representation and semantic analysis for
explicitly-specified template argument lists in member reference
expressions, e.g.,

  x->f<int>()



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 00:37:14 +00:00
Douglas Gregor f328a2857d Add parsing for references to member function templates with explicit
template argument lists, e.g., x.f<int>().

Semantic analysis will be a separate commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80624 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 21:16:32 +00:00
Douglas Gregor a6f0f9d589 Support explicit C++ member operator syntax, from James Porter!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80608 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 19:52:13 +00:00
Fariborz Jahanian 31976591de Patch for code gen. for c-style cast which ends in
using class's conversion functions [12.3.2-p2]


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 19:15:16 +00:00
Fariborz Jahanian 7fe5d72fbc path to ir-gen 12.3.1 Conversion by constructor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 22:04:50 +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
Fariborz Jahanian 4fc7ab3641 ir-gen related patch for type conversion
with class type conversion methods. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 15:11:24 +00:00
Anders Carlsson 7b361b5880 Add an InOverloadResolution flag to TryCopyInitialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:37:39 +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 d28b42862b Remove default argument from TryCopyInitialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:18:13 +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 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 bb60a509f4 In ActOnCXXTypeConstructExpr, check that the type is complete and non-abstract before creating any expressions. This assures that any templates are instantiated if necessary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 03:53:50 +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
Anders Carlsson d497ba7ca5 Remove the PrintType argument from RequireCompleteType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 22:59:12 +00:00
Fariborz Jahanian 9099ff0cf9 AST for conversion by conversion functions. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80135 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 20:34:58 +00:00
Anders Carlsson 2cf738f194 More support for pseudo dtors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 19:22:42 +00:00
Fariborz Jahanian e9f42087aa update to CXXFunctionalCastExpr to support ir-gen for
type convesions of class objects [class.conv]. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 18:55:36 +00:00
Anders Carlsson 3aa4ca439d Address some of Doug's comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 17:36:19 +00:00
Anders Carlsson ec7738776b Parsing of pseudo-destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 23:46:41 +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
Douglas Gregor 20b3e9918c Implement support for equality comparisons (!=, ==) of member
pointers, by extending the "composite pointer type" logic to include
member pointer types.

Introduce test cases for member pointer comparisons, including those
that involve the builtin operator candidates implemented earlier. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 17:42:35 +00:00
Anders Carlsson 27a5b9b9ba Add CK_NullToMemberPointer and CK_BaseToDerivedMemberPointer cast kinds. Make -ast-dump print out the cast kinds of cast expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22 23:33:40 +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
Argyrios Kyrtzidis e8661906d4 Use Sema's LocInfoType to pass and preserve type source info through the Parser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79395 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 01:28:28 +00:00
Argyrios Kyrtzidis a1d5662d96 Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema interfaces.
DeclaratorDecl contains a DeclaratorInfo* to keep type source info.
Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl.
EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo.

Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79392 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 01:27:57 +00:00
Anders Carlsson d67c4c31a8 Store the delete operator for delete expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 20:29:29 +00:00
Anders Carlsson 9abf2aedae AddInitializerToDecl can't take a FullExprArg. Make it take an ExprArg, and create the CXXExprWithTemporaries before setting the initializer on the VarDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 05:13:48 +00:00
Anders Carlsson 089c2602eb BuildCXXConstructExpr doesn't need to take an ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-15 23:41:35 +00:00
Argyrios Kyrtzidis e955e7221a Check whether a tag was defined in a C++ condition declaration using GetTypeForDeclarator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 05:20:41 +00:00
Anders Carlsson 8249576432 Use CastExpr::CK_ArrayToPointerDecay and fix an assert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78502 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 21:04:35 +00:00
Anders Carlsson cdb6197975 More CastKind work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07 22:21:05 +00:00