[cfe-commits] [PATCH] Extend lexical scope of attributes to include function parameters.
Douglas Gregor
dgregor at apple.com
Wed Sep 7 13:03:41 PDT 2011
On Sep 7, 2011, at 12:32 PM, Delesley Hutchins wrote:
> Thanks for the comment! Here's an updated version:
>
> http://codereview.appspot.com/4978056/
Much better, thanks!
index e847afc..16fbeb3 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -1240,6 +1240,13 @@ public:
void EnterDeclaratorContext(Scope *S, DeclContext *DC);
void ExitDeclaratorContext(Scope *S);
+ /// Return true if D is a function declaration.
+ bool IsFunction(Decl *D) { return dyn_cast_or_null<FunctionDecl>(D); }
Well… okay, if we have to check in the parser whether we have a function, please use Decl::isFunctionOrFunctionTemplate() and handle the function-template case.
+ /// Push the parameters of D, which must be a FunctionDecl, into scope.
+ void EnterFunctionContext(Decl* D);
+ void ExitFunctionContext() { PopDeclContext(); }
+
DeclContext *getFunctionLevelDeclContext();
/// getCurFunctionDecl - If inside of a function body, this returns a pointer
How about naming these EnterDelayedFunctionContext and ExitDelayedFunctionContext?
- Doug
More information about the cfe-commits
mailing list