Add Sema support for C++ classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52956 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 3e687b9..9df94d4 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -16,11 +16,13 @@
#define LLVM_CLANG_AST_SEMA_H
#include "IdentifierResolver.h"
+#include "CXXFieldCollector.h"
#include "clang/Parse/Action.h"
#include "clang/Parse/DeclSpec.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/OwningPtr.h"
#include <vector>
#include <string>
@@ -109,6 +111,9 @@
ObjCCompatibleAliasDecl*> ObjCAliasTy;
ObjCAliasTy ObjCAliasDecls;
+ /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
+ llvm::OwningPtr<CXXFieldCollector> FieldCollector;
+
IdentifierResolver IdResolver;
// Enum values used by KnownFunctionIDs (see below).
@@ -215,9 +220,7 @@
virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group);
virtual DeclTy *ActOnStartOfFunctionDef(Scope *S, Declarator &D);
- // Until 'real' implementation is in place, override both
- // 'ActOnStartOfFunctionDef' to satisfy the compiler.
- virtual DeclTy *ActOnStartOfFunctionDef(Scope *S, DeclTy *D) { return D; }
+ virtual DeclTy *ActOnStartOfFunctionDef(Scope *S, DeclTy *D);
virtual void ObjCActOnStartOfMethodDef(Scope *S, DeclTy *D);
virtual DeclTy *ActOnFinishFunctionBody(DeclTy *Decl, StmtTy *Body);
@@ -258,6 +261,8 @@
virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
DeclTy **Elements, unsigned NumElements);
private:
+ DeclContext *getDCParent(DeclContext *DC);
+
/// Set the current declaration context until it gets popped.
void PushDeclContext(DeclContext *DC);
void PopDeclContext();
@@ -545,6 +550,9 @@
SourceLocation LParenLoc, ExprTy *E,
SourceLocation RParenLoc);
+ //// ActOnCXXThis - Parse 'this' pointer.
+ virtual ExprResult ActOnCXXThis(SourceLocation ThisLoc);
+
/// ActOnCXXBoolLiteral - Parse {true,false} literals.
virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
tok::TokenKind Kind);
@@ -585,6 +593,20 @@
bool Virtual, AccessSpecifier Access,
DeclTy *basetype, SourceLocation BaseLoc);
+ virtual void ActOnStartCXXClassDef(Scope *S, DeclTy *TagDecl,
+ SourceLocation LBrace);
+
+ virtual DeclTy *ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
+ Declarator &D, ExprTy *BitfieldWidth,
+ ExprTy *Init, DeclTy *LastInGroup);
+
+ virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
+ DeclTy *TagDecl,
+ SourceLocation LBrac,
+ SourceLocation RBrac);
+
+ virtual void ActOnFinishCXXClassDef(DeclTy *TagDecl,SourceLocation RBrace);
+
// Objective-C declarations.
virtual DeclTy *ActOnStartClassInterface(