[PATCH] D56728: Regression test case for r350891 [Correct the source range returned from preprocessor callbacks]

Jordan Rupprecht via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 15 09:23:28 PST 2019


rupprecht created this revision.
rupprecht added a reviewer: aaron.ballman.
Herald added subscribers: cfe-commits, jsji, kbarton, nemanjai.

r350891 caused some internal failures that this test case exposes.


Repository:
  rC Clang

https://reviews.llvm.org/D56728

Files:
  unittests/Lex/PPCallbacksTest.cpp


Index: unittests/Lex/PPCallbacksTest.cpp
===================================================================
--- unittests/Lex/PPCallbacksTest.cpp
+++ unittests/Lex/PPCallbacksTest.cpp
@@ -483,6 +483,16 @@
   EXPECT_EQ(
       GetSourceStringToEnd(CharSourceRange(Results7[1].ConditionRange, false)),
       "defined(FLOOFY)");
+  const auto &Results8 =
+      DirectiveExprRange("#define FLOOFY 0\n#if __FILE__ > FLOOFY\n#endif\n");
+  EXPECT_EQ(Results8.size(), 1U);
+  EXPECT_EQ(
+      GetSourceStringToEnd(CharSourceRange(Results8[0].ConditionRange, false)),
+      "__FILE__ > FLOOFY");
+  EXPECT_EQ(
+      Lexer::getSourceText(CharSourceRange(Results8[0].ConditionRange, false),
+                           SourceMgr, LangOpts),
+      "__FILE__ > FLOOFY");
 }
 
 } // namespace


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56728.181807.patch
Type: text/x-patch
Size: 787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190115/cdf7d26e/attachment.bin>


More information about the cfe-commits mailing list