File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,13 @@ class IfPreprocessorCallbacks final : public PPCallbacks {
3636private:
3737 void impl (SourceLocation DirectiveLoc, SourceRange ConditionRange,
3838 const llvm::StringLiteral (&Replacements)[2]) {
39- const StringRef Condition =
39+ // Lexer requires its input range to be null-terminated.
40+ SmallString<128 > Condition =
4041 Lexer::getSourceText (CharSourceRange::getTokenRange (ConditionRange),
4142 PP.getSourceManager (), PP.getLangOpts ());
43+ Condition.push_back (' \0 ' );
4244 Lexer Lex (DirectiveLoc, PP.getLangOpts (), Condition.data (),
43- Condition.data (), Condition.data () + Condition.size ());
45+ Condition.data (), Condition.data () + Condition.size () - 1 );
4446 Token Tok;
4547 bool Inverted = false ; // The inverted form of #*def is #*ndef.
4648 std::size_t ParensNestingDepth = 0 ;
You can’t perform that action at this time.
0 commit comments