================
@@ -552,6 +552,25 @@ file './input.cpp'
}
}
+TEST_F(TokenCollectorTest, FeatureLikeBuiltinMacros) {
+ recordTokens("__has_builtin(__builtin_allow_runtime_check)\n");
+ EXPECT_THAT(Buffer.expandedTokens(),
+ ElementsAre(AllOf(Kind(tok::numeric_constant), HasText("1")),
+ Kind(tok::eof)));
+ auto ExpansionRange =
+ SourceMgr->getExpansionRange(findExpanded("1").front().location());
+ auto MacroInvocation =
+ findSpelled("__has_builtin ( __builtin_allow_runtime_check )");
+ EXPECT_EQ(MacroInvocation.front().location(), ExpansionRange.getBegin());
+ EXPECT_EQ(MacroInvocation.back().location(), ExpansionRange.getEnd());
+
----------------
AaronBallman wrote:
This seems a bit odd to me; the `MacroInvocation` variable is tracking tokens
with extra whitespaces, but it's comparing against `ExpansionRange` which does
not have that whitespace. So I wouldn't have expected these locations to be the
same, which suggests I'm misundstanding something (or there's a bug).
https://github.com/llvm/llvm-project/pull/207130
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits