summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-08-28 07:59:38 +0000
committerJohn McCall <rjmccall@apple.com>2009-08-28 07:59:38 +0000
commitaa74a0c3b5a93777115ae07515a56020c78fabc7 (patch)
tree3102a3e4aeb178875cc67fcd49a135b9c18ffde0 /clang/lib/AST/DeclCXX.cpp
parent2a2459a291babcf4ec810229b0b62da2706fe02c (diff)
downloadbcm5719-llvm-aa74a0c3b5a93777115ae07515a56020c78fabc7.tar.gz
bcm5719-llvm-aa74a0c3b5a93777115ae07515a56020c78fabc7.zip
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. llvm-svn: 80353
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r--clang/lib/AST/DeclCXX.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 70e48976daa..46acf67d295 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -777,20 +777,20 @@ bool OverloadIterator::Equals(const OverloadIterator &Other) const {
return !isa<OverloadedFunctionDecl>(D) || Iter == Other.Iter;
}
-FriendFunctionDecl *FriendFunctionDecl::Create(ASTContext &C,
- DeclContext *DC,
- SourceLocation L,
- DeclarationName N, QualType T,
- DeclaratorInfo *DInfo,
- bool isInline,
- SourceLocation FriendL) {
- return new (C) FriendFunctionDecl(DC, L, N, T, DInfo, isInline, FriendL);
-}
+FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
+ SourceLocation L,
+ FriendUnion Friend,
+ SourceLocation FriendL) {
+ if (Friend.is<NamedDecl*>()) {
+ NamedDecl *D = Friend.get<NamedDecl*>();
+ assert(isa<FunctionDecl>(D) ||
+ isa<CXXRecordDecl>(D) ||
+ isa<FunctionTemplateDecl>(D) ||
+ isa<ClassTemplateDecl>(D));
+ assert(D->getFriendObjectKind());
+ }
-FriendClassDecl *FriendClassDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L, QualType T,
- SourceLocation FriendL) {
- return new (C) FriendClassDecl(DC, L, T, FriendL);
+ return new (C) FriendDecl(DC, L, Friend, FriendL);
}
LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C,
OpenPOWER on IntegriCloud