summaryrefslogtreecommitdiffstats
path: root/clang/unittests
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-03 05:58:29 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-03 05:58:29 +0000
commit0d9e24b1dba68e5fd19b092c533abb790ecd7546 (patch)
tree13d68f19f119c008fc76fe8962d00e8fc6546a15 /clang/unittests
parentde044e5bb84655a22aab983151f3b1cb1b01c3c9 (diff)
downloadbcm5719-llvm-0d9e24b1dba68e5fd19b092c533abb790ecd7546.tar.gz
bcm5719-llvm-0d9e24b1dba68e5fd19b092c533abb790ecd7546.zip
Change Lexer::makeFileCharRange() to have it accept a CharSourceRange
instead of a SourceRange, and handle the case where the range is a char (not token) range. llvm-svn: 149677
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Lex/LexerTest.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/clang/unittests/Lex/LexerTest.cpp b/clang/unittests/Lex/LexerTest.cpp
index 2742f66663b..28199c4aace 100644
--- a/clang/unittests/Lex/LexerTest.cpp
+++ b/clang/unittests/Lex/LexerTest.cpp
@@ -115,13 +115,13 @@ TEST_F(LexerTest, LexAPI) {
EXPECT_TRUE(Lexer::isAtEndOfMacroExpansion(rsqrLoc, SourceMgr, LangOpts, &Loc));
EXPECT_EQ(Loc, macroRange.getEnd());
- CharSourceRange range = Lexer::makeFileCharRange(SourceRange(lsqrLoc, idLoc),
- SourceMgr, LangOpts);
+ CharSourceRange range = Lexer::makeFileCharRange(
+ CharSourceRange::getTokenRange(lsqrLoc, idLoc), SourceMgr, LangOpts);
EXPECT_TRUE(range.isInvalid());
- range = Lexer::makeFileCharRange(SourceRange(idLoc, rsqrLoc),
+ range = Lexer::makeFileCharRange(CharSourceRange::getTokenRange(idLoc, rsqrLoc),
SourceMgr, LangOpts);
EXPECT_TRUE(range.isInvalid());
- range = Lexer::makeFileCharRange(SourceRange(lsqrLoc, rsqrLoc),
+ range = Lexer::makeFileCharRange(CharSourceRange::getTokenRange(lsqrLoc, rsqrLoc),
SourceMgr, LangOpts);
EXPECT_TRUE(!range.isTokenRange());
EXPECT_EQ(range.getAsRange(),
@@ -129,8 +129,8 @@ TEST_F(LexerTest, LexAPI) {
macroRange.getEnd().getLocWithOffset(1)));
StringRef text = Lexer::getSourceText(
- CharSourceRange::getTokenRange(SourceRange(lsqrLoc, rsqrLoc)),
- SourceMgr, LangOpts);
+ CharSourceRange::getTokenRange(lsqrLoc, rsqrLoc),
+ SourceMgr, LangOpts);
EXPECT_EQ(text, "M(foo)");
SourceLocation macroLsqrLoc = toks[3].getLocation();
@@ -140,19 +140,21 @@ TEST_F(LexerTest, LexAPI) {
SourceLocation fileIdLoc = SourceMgr.getSpellingLoc(macroIdLoc);
SourceLocation fileRsqrLoc = SourceMgr.getSpellingLoc(macroRsqrLoc);
- range = Lexer::makeFileCharRange(SourceRange(macroLsqrLoc, macroIdLoc),
- SourceMgr, LangOpts);
+ range = Lexer::makeFileCharRange(
+ CharSourceRange::getTokenRange(macroLsqrLoc, macroIdLoc),
+ SourceMgr, LangOpts);
EXPECT_EQ(SourceRange(fileLsqrLoc, fileIdLoc.getLocWithOffset(3)),
range.getAsRange());
- range = Lexer::makeFileCharRange(SourceRange(macroIdLoc, macroRsqrLoc),
+ range = Lexer::makeFileCharRange(CharSourceRange::getTokenRange(macroIdLoc, macroRsqrLoc),
SourceMgr, LangOpts);
EXPECT_EQ(SourceRange(fileIdLoc, fileRsqrLoc.getLocWithOffset(1)),
range.getAsRange());
macroPair = SourceMgr.getExpansionRange(macroLsqrLoc);
- range = Lexer::makeFileCharRange(SourceRange(macroLsqrLoc, macroRsqrLoc),
- SourceMgr, LangOpts);
+ range = Lexer::makeFileCharRange(
+ CharSourceRange::getTokenRange(macroLsqrLoc, macroRsqrLoc),
+ SourceMgr, LangOpts);
EXPECT_EQ(SourceRange(macroPair.first, macroPair.second.getLocWithOffset(1)),
range.getAsRange());
OpenPOWER on IntegriCloud