diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/tools/clang/unittests/Lex/LexerTest.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/unittests/Lex/LexerTest.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/unittests/Lex/LexerTest.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/gnu/llvm/tools/clang/unittests/Lex/LexerTest.cpp b/gnu/llvm/tools/clang/unittests/Lex/LexerTest.cpp index 317e2c83633..c913062a7ab 100644 --- a/gnu/llvm/tools/clang/unittests/Lex/LexerTest.cpp +++ b/gnu/llvm/tools/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( @@ -474,8 +473,7 @@ TEST_F(LexerTest, GetBeginningOfTokenWithEscapedNewLine) { } TEST_F(LexerTest, AvoidPastEndOfStringDereference) { - std::vector<Token> LexedTokens = Lex(" // \\\n"); - EXPECT_TRUE(LexedTokens.empty()); + EXPECT_TRUE(Lex(" // \\\n").empty()); EXPECT_TRUE(Lex("#include <\\\\").empty()); EXPECT_TRUE(Lex("#include <\\\\\n").empty()); } |
