[cfe-commits] r39180 - in /cfe/cfe/trunk: AST/Type.cpp Parse/ParseDecl.cpp include/clang/Parse/Action.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:40:40 PDT 2007
Author: sabre
Date: Wed Jul 11 11:40:40 2007
New Revision: 39180
URL: http://llvm.org/viewvc/llvm-project?rev=39180&view=rev
Log:
add an action for parsing type names.
Modified:
cfe/cfe/trunk/AST/Type.cpp
cfe/cfe/trunk/Parse/ParseDecl.cpp
cfe/cfe/trunk/include/clang/Parse/Action.h
Modified: cfe/cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Type.cpp?rev=39180&r1=39179&r2=39180&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Type.cpp (original)
+++ cfe/cfe/trunk/AST/Type.cpp Wed Jul 11 11:40:40 2007
@@ -70,11 +70,10 @@
S = '*' + S;
// Handle things like 'int (*A)[4];' correctly.
- // FIXME: this should include vectors.
+ // FIXME: this should include vectors, but vectors use attributes I guess.
if (isa<ArrayType>(PointeeType.getTypePtr()))
S = '(' + S + ')';
-
PointeeType.getAsString(S);
}
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=39180&r1=39179&r2=39180&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:40:40 2007
@@ -32,8 +32,7 @@
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
ParseDeclarator(DeclaratorInfo);
- // TODO: Return something useful as the type, obtained from actions.
- return 0;
+ return Actions.ParseTypeName(CurScope, DeclaratorInfo).Val;
}
/// ParseAttributes - Parse a non-empty attributes list.
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=39180&r1=39179&r2=39180&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:40:40 2007
@@ -70,10 +70,11 @@
}
};
- /// Expr/StmtResult - Provide a unique type to wrap ExprTy/StmtTy, etc,
+ /// Expr/Stmt/TypeResult - Provide a unique type to wrap ExprTy/StmtTy/TypeTy,
/// providing strong typing and allowing for failure.
typedef ActionResult<0> ExprResult;
typedef ActionResult<1> StmtResult;
+ typedef ActionResult<2> TypeResult;
//===--------------------------------------------------------------------===//
// Symbol Table Tracking Callbacks.
@@ -117,7 +118,15 @@
unsigned NumElts) {
return 0;
}
-
+
+ //===--------------------------------------------------------------------===//
+ // Type Parsing Callbacks.
+ //===--------------------------------------------------------------------===//
+
+ virtual TypeResult ParseTypeName(Scope *S, Declarator &D) {
+ return 0;
+ }
+
//===--------------------------------------------------------------------===//
// Statement Parsing Callbacks.
//===--------------------------------------------------------------------===//
More information about the cfe-commits
mailing list