[cfe-commits] r38908 - /cfe/cfe/trunk/include/clang/Parse/Action.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:25:40 PDT 2007
Author: sabre
Date: Wed Jul 11 11:25:40 2007
New Revision: 38908
URL: http://llvm.org/viewvc/llvm-project?rev=38908&view=rev
Log:
Add some methods, add significant documentation.
Modified:
cfe/cfe/trunk/include/clang/Parse/Action.h
Modified: cfe/cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Action.h?rev=38908&r1=38907&r2=38908&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:25:40 2007
@@ -14,17 +14,49 @@
#ifndef LLVM_CLANG_PARSE_PARSERACTIONS_H
#define LLVM_CLANG_PARSE_PARSERACTIONS_H
+#include "clang/Basic/SourceLocation.h"
+
namespace llvm {
namespace clang {
+ // Parse.
+ class Scope;
+ // Semantic.
+ class Declarator;
-/// ParserActions -
+/// ParserActions - As the parser reads the input file and recognizes the
+/// productions of the grammar, it invokes methods on this class to turn the
+/// parsed input into something useful: e.g. a parse tree.
+///
+/// The callback methods that this class provides are phrased as actions that
+/// the parser has just done or is about to do when the method is called. They
+/// are not requests that the actions module do the specified action.
+///
+/// All of the methods here are optional, but you must specify information about
+/// whether something is a typedef or not in order for the parse to complete
+/// accurately. The EmptyParserActions class does this bare-minimum of
+/// tracking.
class ParserActions {
- // SYMBOL TABLE
public:
+ /// Out-of-line virtual destructor to provide home for this class.
+ virtual ~ParserActions();
+
// Types - Though these don't actually enforce strong typing, they document
// what types are required to be identical for the actions.
- typedef void* ExprTy;
+ typedef void ExprTy;
+
+ //===--------------------------------------------------------------------===//
+ // Symbol table tracking callbacks.
+ //===--------------------------------------------------------------------===//
+
+ /// ParseDeclarator - This callback is invoked when a declarator is parsed and
+ /// 'Init' specifies the initializer if any. This is for things like:
+ /// "int X = 4" or "typedef int foo".
+ virtual void ParseDeclarator(SourceLocation Loc, Scope *S, Declarator &D,
+ ExprTy *Init) {}
+ /// PopScope - This callback is called immediately before the specified scope
+ /// is popped and deleted.
+ virtual void PopScope(SourceLocation Loc, Scope *S) {}
};
More information about the cfe-commits
mailing list