diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-12 05:44:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-12 05:44:03 +0000 |
commit | cff9cc95de367a3aea885a7f8fee304fe2707b92 (patch) | |
tree | a7c6af20ebfdf923c65851535855ab6b5063ba56 /Driver/RewriteTest.cpp | |
parent | b13c5eef3634e32075511d11ded4b699c17fb0d7 (diff) |
start implementing a token rewriter. At this point, it just reads in a file
and lets a client iterate over it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r-- | Driver/RewriteTest.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp index 446ae1a4fb..6709860272 100644 --- a/Driver/RewriteTest.cpp +++ b/Driver/RewriteTest.cpp @@ -21,6 +21,12 @@ void clang::DoRewriteTest(Preprocessor &PP, const std::string &InFileName, SourceManager &SM = PP.getSourceManager(); const LangOptions &LangOpts = PP.getLangOptions(); + TokenRewriter Rewriter(SM.getMainFileID(), SM, LangOpts); + + + + + std::pair<const char*,const char*> File =SM.getBufferData(SM.getMainFileID()); // Create a lexer to lex all the tokens of the main file in raw mode. Even @@ -37,5 +43,7 @@ void clang::DoRewriteTest(Preprocessor &PP, const std::string &InFileName, RawLex.LexFromRawLexer(RawTok); } - + for (TokenRewriter::token_iterator I = Rewriter.token_begin(), + E = Rewriter.token_end(); I != E; ++I) + std::cout << PP.getSpelling(*I); }
\ No newline at end of file |