diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-19 15:59:19 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-19 15:59:19 +0000 |
commit | e64d9037658a1b95c79ea275af6167a110b3c563 (patch) | |
tree | 79bac7a7812f12b2c41875e32869b4ff9d5e79b2 /unittests/Lex/LexerTest.cpp | |
parent | 11b652d41d0d97380ab321a1dba48ecb044f9de8 (diff) |
Introduce Lexer::getSourceText() that returns a string for the source
that the given source range encompasses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Lex/LexerTest.cpp')
-rw-r--r-- | unittests/Lex/LexerTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/unittests/Lex/LexerTest.cpp b/unittests/Lex/LexerTest.cpp index 05478eef9f..fecdb7fc05 100644 --- a/unittests/Lex/LexerTest.cpp +++ b/unittests/Lex/LexerTest.cpp @@ -114,6 +114,11 @@ TEST_F(LexerTest, LexAPI) { EXPECT_EQ(range.getAsRange(), SourceRange(macroRange.getBegin(), macroRange.getEnd().getLocWithOffset(1))); + + StringRef text = Lexer::getSourceText( + CharSourceRange::getTokenRange(SourceRange(lsqrLoc, rsqrLoc)), + SourceMgr, LangOpts); + EXPECT_EQ(text, "M(foo)"); } } // anonymous namespace |