Commit Graph

104 Commits

Author SHA1 Message Date
Fariborz Jahanian ca2f085a4e Diagnose when base classes and members to be intialized
with constructors don't have a matching constructor.

llvm-svn: 76913
2009-07-23 23:32:59 +00:00
Fariborz Jahanian 0228bc1a41 Add constructor used to initialize base/member in
CXXBaseOrMemberInitializer AST node. Needed by
its clients to do the initialization.

llvm-svn: 76826
2009-07-23 00:42:24 +00:00
Douglas Gregor b77af8f4aa Fix some memory allocation/deallocation issues
llvm-svn: 76783
2009-07-22 20:55:49 +00:00
Fariborz Jahanian f87fbc058d Improved on performance of the algorithm for proper ordering of
ctor's initialization of bases and fields.

llvm-svn: 76776
2009-07-22 20:25:00 +00:00
Douglas Gregor 8a27391190 "This patch implements the restrictions on union members detailed in
[class.union]p1", from John McCall!

llvm-svn: 76766
2009-07-22 18:25:24 +00:00
Fariborz Jahanian 5c14ec30cd Allocate BaseOrMemberInitializers and CXXBaseSpecifier nodes
via ASTContext.

llvm-svn: 76758
2009-07-22 17:41:53 +00:00
Fariborz Jahanian 891436d54c Minor mod. per Doug's comment.
llvm-svn: 76708
2009-07-22 00:42:46 +00:00
Fariborz Jahanian aee31ac316 Patch to accomodate Doug's comment on default
destruction of base/members for each destructor AST.

llvm-svn: 76663
2009-07-21 22:36:06 +00:00
Douglas Gregor 82fe3e3398 Add the location of the tag keyword into TagDecl. From Enea
Zaffanella, with tweaks from Abramo Bagnara.

llvm-svn: 76576
2009-07-21 14:46:17 +00:00
Ted Kremenek 8a286fbdb9 Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.

llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Ted Kremenek b825c0ddc5 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Fariborz Jahanian 16094c2467 Added ASTs to destructor decl AST for default destruction of object's
base/members.

llvm-svn: 75849
2009-07-15 22:34:08 +00:00
Fariborz Jahanian 5da7ecb245 Fixed a bug in building ctor-initializer AST.
llvm-svn: 75692
2009-07-14 22:40:50 +00:00
Fariborz Jahanian c75e143709 Support data members of array type in default
ctor-initializer AST build.

llvm-svn: 75662
2009-07-14 18:56:31 +00:00
Fariborz Jahanian 6dc0284cff Moved a FIXME to where it was meant to be.
llvm-svn: 75651
2009-07-14 18:29:14 +00:00
Fariborz Jahanian 49c81799b0 Patch to build AST for ctor's initializer list according to
semantics of order of construction [class.init].

llvm-svn: 75649
2009-07-14 18:24:21 +00:00
Alisdair Meredith f6eb60a851 Fix breakage on Windows, cannot redeclare loop variable i in the immediate scope of loop. Rename variable to j.
llvm-svn: 75365
2009-07-11 14:32:10 +00:00
Anders Carlsson 7ca3f6feea Fix type of 'this' and add a decltype test.
llvm-svn: 75291
2009-07-10 21:35:09 +00:00
Fariborz Jahanian 3554b5a37c Patch to build list of inherited virtual base classes
in their order of construction for each class and use it 
to to check on propery order of base class construction 
under -Wreorder option.

llvm-svn: 75270
2009-07-10 20:13:23 +00:00
Douglas Gregor be759256b9 Fix a corner case with argument-dependent lookup and overloaded function sets.
llvm-svn: 74999
2009-07-08 10:57:20 +00:00
Fariborz Jahanian 003a880c41 A few change per Doug's feedback.
- Fariborz

llvm-svn: 74909
2009-07-07 16:24:08 +00:00
Fariborz Jahanian 9fa077c626 Patch to allocate list of bases in CXXRecordDecl
using ASTContxt allocation.

llvm-svn: 74717
2009-07-02 18:26:15 +00:00
Fariborz Jahanian 5c6af0a998 Use Destroy for member initializer list clean up.
Per Doug's comments. Doug please review.

llvm-svn: 74666
2009-07-01 23:35:25 +00:00
Fariborz Jahanian 52337414b7 Updated CXXConstructorDecl AST node for ctor-initilaizer list.
No change in functionality.

llvm-svn: 74639
2009-07-01 21:05:43 +00:00
Argyrios Kyrtzidis cfbfe78e9e De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Fariborz Jahanian 651185bf47 A more detailed diagnosis of ill-formed ctor-initializer
list.

llvm-svn: 74480
2009-06-30 00:02:17 +00:00
Douglas Gregor 15448f8d23 Improve support for overloaded operator templates.
llvm-svn: 74390
2009-06-27 21:05:07 +00:00
Douglas Gregor ad3f2fcf43 Improved semantic analysis and AST respresentation for function
templates.

For example, this now type-checks (but does not instantiate the body
of deref<int>):

  template<typename T> T& deref(T* t) { return *t; }

  void test(int *ip) {
    int &ir = deref(ip);
  }

Specific changes/additions:
  * Template argument deduction from a call to a function template.
  * Instantiation of a function template specializations (just the
  declarations) from the template arguments deduced from a call.
  * FunctionTemplateDecls are stored directly in declaration contexts
  and found via name lookup (all forms), rather than finding the
  FunctionDecl and then realizing it is a template. This is
  responsible for most of the churn, since some of the core
  declaration matching and lookup code assumes that all functions are
  FunctionDecls.

llvm-svn: 74213
2009-06-25 22:08:12 +00:00
Fariborz Jahanian 477d242a2e patch to mark use of implicit copy constructors.
llvm-svn: 73922
2009-06-22 23:34:40 +00:00
Douglas Gregor fec52635f0 Parsing and AST support for using declarations, from John Thompson!
llvm-svn: 73812
2009-06-20 00:51:54 +00:00
Fariborz Jahanian 423a81f259 Patch for implementation of C++'s object model. This is
work in progress.

llvm-svn: 73782
2009-06-19 19:55:27 +00:00
Fariborz Jahanian b1743254e7 Removed deadcode related to addition of constructor
decls to a class.

llvm-svn: 73650
2009-06-17 22:44:31 +00:00
Anders Carlsson 20ee0ed4ea If a CXXRecordDecl is a class template, the 'this' type should be the injected class name type. Fixes pr4383.
llvm-svn: 73284
2009-06-13 02:59:33 +00:00
Anders Carlsson 8544647e9c Make ParmVarDecl::getDefaultArg() more robust, it now asserts that the argument is not unparsed. Add a new hasDefaultArg() and use it in places where getDefaultArg() was called when the argument was unparsed.
llvm-svn: 72984
2009-06-06 04:14:07 +00:00
Anders Carlsson 4f44fd5c6f Get rid of CXXTempVarDecl.
llvm-svn: 72637
2009-05-30 21:10:34 +00:00
Douglas Gregor 182319375a Pretty printing and improved representation for namespace alias declarations
llvm-svn: 72616
2009-05-30 06:48:27 +00:00
Douglas Gregor 3bc6e4c72a Printing for using directives, e.g.,
using namespace std::debug;

Extended UsingDirectiveDecl to store the nested-name-specifier that
precedes the nominated namespace.

llvm-svn: 72614
2009-05-30 06:31:56 +00:00
Anders Carlsson 0a63741a3f Add code for emitting C++ destructors. Not used yet.
llvm-svn: 72591
2009-05-29 21:03:38 +00:00
Anders Carlsson 36d87e179a Add setters/getters to CXXMethodDecl so it can keep track of which virtual member functions it overrides (if any)
llvm-svn: 71968
2009-05-16 23:58:37 +00:00
Douglas Gregor 1ec5e9f025 Make sure that the type associated with a class template is dependent.
llvm-svn: 71878
2009-05-15 19:11:46 +00:00
Eli Friedman 37e663df63 Silence gcc warnings.
llvm-svn: 70086
2009-04-25 22:20:56 +00:00
Anders Carlsson 643e0a40db Fix assert.
llvm-svn: 69961
2009-04-24 06:06:07 +00:00
Anders Carlsson 21d30b41fc Add the beginnings of a CXXTempVarDecl class.
llvm-svn: 69652
2009-04-21 01:57:48 +00:00
Anders Carlsson 6dc3575220 Add support for the __has_trivial_destructor type trait.
llvm-svn: 69345
2009-04-17 02:34:54 +00:00
Anders Carlsson fe63dc52f9 Add support for the __has_trivial_constructor type trait.
llvm-svn: 69245
2009-04-16 00:08:20 +00:00
Douglas Gregor bcced4ec31 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Chris Lattner 63595ddcb5 switch TemplateOrInstantiation to be a PointerUnion, which
simplifies some code.

llvm-svn: 67993
2009-03-29 07:03:59 +00:00
Anders Carlsson ff25fdf2fb Create AST nodes for namespace aliases.
llvm-svn: 67962
2009-03-28 22:58:02 +00:00
Anders Carlsson 6750d16002 Add
const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
                                    AccessSpecifier AS);
   
so we can easily add access specifiers to diagnostics.

llvm-svn: 67795
2009-03-26 23:46:50 +00:00
Douglas Gregor 8ea8fd48f2 Instantiation for member classes of class templates. Note that only
the declarations of member classes are instantiated when the owning
class template is instantiated. The definitions of such member classes
are instantiated when a complete type is required.

This change also introduces the injected-class-name into a class
template specialization.

llvm-svn: 67707
2009-03-25 21:17:03 +00:00