Workaround clang bug with #undef output

This commit is contained in:
Jonathan Müller 2017-04-12 14:52:28 +02:00
commit db20190fe4

View file

@ -475,7 +475,11 @@ namespace
ts::optional<std::string> parse_undef(position& p)
{
// format (at new line): #undef <name>
if (!p.was_newl() || !starts_with(p, "#undef"))
// due to a clang bug (http://bugs.llvm.org/show_bug.cgi?id=32631) I'll also an undef in the middle of the line
// the only issue is with string literals containing `#undef`.
// those will be stripped and evaluated
// however, this kind of usage should be rare™
if (/*!p.was_newl() ||*/ !starts_with(p, "#undef"))
return ts::nullopt;
p.skip(std::strlen("#undef"));