[cfe-commits] r39147 - in /cfe/cfe/trunk: Parse/ParseExpr.cpp include/clang/Parse/Action.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:39:52 PDT 2007
Author: sabre
Date: Wed Jul 11 11:39:52 2007
New Revision: 39147
URL: http://llvm.org/viewvc/llvm-project?rev=39147&view=rev
Log:
split ParseStringExpr into semantic/minimal actions
Modified:
cfe/cfe/trunk/Parse/ParseExpr.cpp
cfe/cfe/trunk/include/clang/Parse/Action.h
Modified: cfe/cfe/trunk/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseExpr.cpp?rev=39147&r1=39146&r2=39147&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseExpr.cpp Wed Jul 11 11:39:52 2007
@@ -932,6 +932,12 @@
ConsumeStringToken();
} while (isTokenStringLiteral());
+
+ // If using minimal actions, don't do any semantic analysis of the parsed
+ // string fragments.
+ if (MinimalActions)
+ return MinimalActions->ParseStringExpr(&StringToks[0], StringToks.size());
+
// Include space for the null terminator.
++SizeBound;
@@ -1098,8 +1104,8 @@
StringTokLocs.push_back(StringToks[i].getLocation());
// Hand this off to the Actions.
- return Actions.ParseStringExpr(&ResultBuf[0], ResultPtr-&ResultBuf[0],
- AnyWide, &StringTokLocs[0],
- StringTokLocs.size());
+ return SemaActions->ParseStringExpr(&ResultBuf[0], ResultPtr-&ResultBuf[0],
+ AnyWide, &StringTokLocs[0],
+ StringTokLocs.size());
}
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=39147&r1=39146&r2=39147&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:39:52 2007
@@ -26,6 +26,7 @@
class Action;
// Lex.
class IdentifierInfo;
+ class LexerToken;
/// Action - 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
@@ -208,15 +209,6 @@
return Val; // Default impl returns operand.
}
- /// ParseStringExpr - The (null terminated) string data is specified with
- /// StrData+StrLen. isWide is true if this is a wide string. The Toks/NumToks
- /// array exposes the input tokens to provide location information.
- virtual ExprResult ParseStringExpr(const char *StrData, unsigned StrLen,
- bool isWide,
- SourceLocation *TokLocs, unsigned NumToks){
- return 0;
- }
-
// Postfix Expressions.
virtual ExprResult ParsePostfixUnaryOp(SourceLocation OpLoc,
tok::TokenKind Kind, ExprTy *Input) {
@@ -300,6 +292,17 @@
virtual DeclTy *ParsedClassDeclaration(Scope *S,
IdentifierInfo **IdentList,
unsigned NumElts);
+
+ //===--------------------------------------------------------------------===//
+ // Expression Parsing Callbacks.
+ //===--------------------------------------------------------------------===//
+
+ /// ParseStringExpr - The specified tokens were lexed as pasted string
+ /// fragments (e.g. "foo" "bar" L"baz").
+ virtual ExprResult ParseStringExpr(const LexerToken *Toks, unsigned NumToks){
+ return 0;
+ }
+
};
/// SemanticAction - Clients the implement this interface expect Decl nodes to
@@ -308,6 +311,15 @@
class SemanticAction : public Action {
public:
+ /// ParseStringExpr - The (null terminated) string data is specified with
+ /// StrData+StrLen. isWide is true if this is a wide string. The Toks/NumToks
+ /// array exposes the input tokens to provide location information.
+ virtual ExprResult ParseStringExpr(const char *StrData, unsigned StrLen,
+ bool isWide,
+ SourceLocation *TokLocs, unsigned NumToks){
+ return 0;
+ }
+
};
} // end namespace clang
More information about the cfe-commits
mailing list