[cfe-commits] r71482 - in /cfe/trunk: include/clang/Parse/Action.h include/clang/Parse/DeclSpec.h lib/Parse/ParseDeclCXX.cpp
Anders Carlsson
andersca at mac.com
Mon May 11 15:27:47 PDT 2009
Author: andersca
Date: Mon May 11 17:27:47 2009
New Revision: 71482
URL: http://llvm.org/viewvc/llvm-project?rev=71482&view=rev
Log:
Add an ActOnFriendDecl and call it for friend class decls.
Modified:
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/include/clang/Parse/DeclSpec.h
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=71482&r1=71481&r2=71482&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Mon May 11 17:27:47 2009
@@ -933,6 +933,13 @@
return DeclPtrTy();
}
+ /// ActOnFriendDecl - This action is called when a friend declaration is
+ /// encountered. Returns false on success.
+ virtual bool ActOnFriendDecl(Scope *S, SourceLocation FriendLoc,
+ DeclPtrTy Dcl) {
+ return false;
+ }
+
//===------------------------- C++ Expressions --------------------------===//
Modified: cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=71482&r1=71481&r2=71482&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Parse/DeclSpec.h Mon May 11 17:27:47 2009
@@ -284,6 +284,7 @@
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec);
bool isFriendSpecified() const { return Friend_specified; }
+ SourceLocation getFriendSpecLoc() const { return FriendLoc; }
/// AddAttributes - contatenates two attribute lists.
/// The GCC attribute syntax allows for the following:
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=71482&r1=71481&r2=71482&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon May 11 17:27:47 2009
@@ -525,10 +525,18 @@
}
const char *PrevSpec = 0;
- if (TagOrTempResult.isInvalid())
+ if (TagOrTempResult.isInvalid()) {
DS.SetTypeSpecError();
- else if (DS.SetTypeSpecType(TagType, StartLoc, PrevSpec,
- TagOrTempResult.get().getAs<void>()))
+ return;
+ }
+
+ if (DS.isFriendSpecified() &&
+ !Actions.ActOnFriendDecl(CurScope, DS.getFriendSpecLoc(),
+ TagOrTempResult.get()))
+ return;
+
+ if (DS.SetTypeSpecType(TagType, StartLoc, PrevSpec,
+ TagOrTempResult.get().getAs<void>()))
Diag(StartLoc, diag::err_invalid_decl_spec_combination) << PrevSpec;
}
More information about the cfe-commits
mailing list