diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-14 23:22:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-14 23:22:57 +0000 |
commit | 2c78b873f4f3823ae859c15674cb3d76c8554113 (patch) | |
tree | 8b7c7fb3ea053ecadbdeb7745ce2a9f420c1aad7 /include/clang/Rewrite | |
parent | 12bac2566e3136d4bd9d42e6aabe27e1038f7793 (diff) |
Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~~^
instead of the woefully inferior:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^
Most of this is just plumbing to push the reference around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Rewrite')
-rw-r--r-- | include/clang/Rewrite/Rewriter.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/clang/Rewrite/Rewriter.h b/include/clang/Rewrite/Rewriter.h index b05770b2aa..afa018d9cb 100644 --- a/include/clang/Rewrite/Rewriter.h +++ b/include/clang/Rewrite/Rewriter.h @@ -25,6 +25,7 @@ namespace clang { class SourceManager; + class LangOptions; class Rewriter; class Stmt; @@ -117,14 +118,19 @@ private: // Methods only usable by Rewriter. /// are involved. class Rewriter { SourceManager *SourceMgr; - + const LangOptions *LangOpts; std::map<FileID, RewriteBuffer> RewriteBuffers; public: - explicit Rewriter(SourceManager &SM) : SourceMgr(&SM) {} - explicit Rewriter() : SourceMgr(0) {} + explicit Rewriter(SourceManager &SM, const LangOptions &LO) + : SourceMgr(&SM), LangOpts(&LO) {} + explicit Rewriter() : SourceMgr(0), LangOpts(0) {} - void setSourceMgr(SourceManager &SM) { SourceMgr = &SM; } - SourceManager& getSourceMgr() { return *SourceMgr; } + void setSourceMgr(SourceManager &SM, const LangOptions &LO) { + SourceMgr = &SM; + LangOpts = &LO; + } + SourceManager &getSourceMgr() { return *SourceMgr; } + const LangOptions &getLangOpts() { return *LangOpts; } /// isRewritable - Return true if this location is a raw file location, which /// is rewritable. Locations from macros, etc are not rewritable. |