diff options
Diffstat (limited to 'clang/unittests/Lex/LexerTest.cpp')
-rw-r--r-- | clang/unittests/Lex/LexerTest.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/unittests/Lex/LexerTest.cpp b/clang/unittests/Lex/LexerTest.cpp index 216672a90d5..c913062a7ab 100644 --- a/clang/unittests/Lex/LexerTest.cpp +++ b/clang/unittests/Lex/LexerTest.cpp @@ -286,9 +286,7 @@ TEST_F(LexerTest, LexAPI) { SourceLocation lsqrLoc = toks[0].getLocation(); SourceLocation idLoc = toks[1].getLocation(); SourceLocation rsqrLoc = toks[2].getLocation(); - std::pair<SourceLocation,SourceLocation> - macroPair = SourceMgr.getExpansionRange(lsqrLoc); - SourceRange macroRange = SourceRange(macroPair.first, macroPair.second); + CharSourceRange macroRange = SourceMgr.getExpansionRange(lsqrLoc); SourceLocation Loc; EXPECT_TRUE(Lexer::isAtStartOfMacroExpansion(lsqrLoc, SourceMgr, LangOpts, &Loc)); @@ -297,6 +295,7 @@ TEST_F(LexerTest, LexAPI) { EXPECT_FALSE(Lexer::isAtEndOfMacroExpansion(idLoc, SourceMgr, LangOpts)); EXPECT_TRUE(Lexer::isAtEndOfMacroExpansion(rsqrLoc, SourceMgr, LangOpts, &Loc)); EXPECT_EQ(Loc, macroRange.getEnd()); + EXPECT_TRUE(macroRange.isTokenRange()); CharSourceRange range = Lexer::makeFileCharRange( CharSourceRange::getTokenRange(lsqrLoc, idLoc), SourceMgr, LangOpts); @@ -334,11 +333,11 @@ TEST_F(LexerTest, LexAPI) { EXPECT_EQ(SourceRange(fileIdLoc, fileRsqrLoc.getLocWithOffset(1)), range.getAsRange()); - macroPair = SourceMgr.getExpansionRange(macroLsqrLoc); + macroRange = SourceMgr.getExpansionRange(macroLsqrLoc); range = Lexer::makeFileCharRange( CharSourceRange::getTokenRange(macroLsqrLoc, macroRsqrLoc), SourceMgr, LangOpts); - EXPECT_EQ(SourceRange(macroPair.first, macroPair.second.getLocWithOffset(1)), + EXPECT_EQ(SourceRange(macroRange.getBegin(), macroRange.getEnd().getLocWithOffset(1)), range.getAsRange()); text = Lexer::getSourceText( |