summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-08-20 07:19:42 +0000
committerJohn McCall <rjmccall@apple.com>2009-08-20 07:19:42 +0000
commitf18970d1dd3a88b7a50e9abd4fd4ceef675a8a2e (patch)
tree9a1592caad17e80d6d2631f2a53680941601ff61
parent43959a93c6aba8b03b09116fe077f4ce8e80005e (diff)
Add syntax examples for the friend declaration types.
Remove an assert trivialized by dominating code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79520 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/DeclCXX.h19
-rw-r--r--lib/Sema/SemaDeclCXX.cpp1
2 files changed, 16 insertions, 4 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 3642fcbec6..327f9ff622 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -1263,7 +1263,13 @@ public:
};
/// FriendFunctionDecl - Represents the declaration (and possibly
-/// the definition) of a friend function.
+/// the definition) of a friend function. For example:
+///
+/// @code
+/// class A {
+/// friend int foo(int);
+/// };
+/// @endcode
class FriendFunctionDecl : public FunctionDecl {
// Location of the 'friend' specifier.
const SourceLocation FriendLoc;
@@ -1293,13 +1299,20 @@ public:
};
/// FriendClassDecl - Represents the declaration of a friend class.
+/// For example:
+///
+/// @code
+/// class X {
+/// friend class Y;
+/// };
+/// @endcode
class FriendClassDecl : public Decl {
// The friended type. In C++0x, this can be an arbitrary type,
// which we simply ignore if it's not a record type.
- const QualType FriendType;
+ QualType FriendType;
// Location of the 'friend' specifier.
- const SourceLocation FriendLoc;
+ SourceLocation FriendLoc;
FriendClassDecl(DeclContext *DC, SourceLocation L,
QualType T, SourceLocation FriendL)
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index e2aee5b136..aa4ac8f1b0 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -3422,7 +3422,6 @@ Sema::DeclPtrTy Sema::ActOnFriendDecl(Scope *S,
// The record declaration we get from friend declarations is not
// canonicalized; see ActOnTag.
- assert(RD);
// C++ [class.friend]p2: A class shall not be defined inside
// a friend declaration.