@@ -265,11 +265,24 @@ void PrintPPOutputPPCallbacks::WriteFooterContent(StringRef CodeFooter) {
265265 *OS << ' \n ' ;
266266}
267267
268+ static bool is_separator (char value) { return value == ' \\ ' ; }
269+
268270void PrintPPOutputPPCallbacks::WriteLineInfo (unsigned LineNo,
269271 const char *Extra,
270272 unsigned ExtraLen) {
271273 startNewLineIfNeeded ();
272274
275+ if (PP.getLangOpts ().isSYCL ()) {
276+ StringRef CurFilenameWithNoLeadingDotSlash =
277+ llvm::sys::path::remove_leading_dotbackslash_only (CurFilename.str ());
278+ if ((CurFilenameWithNoLeadingDotSlash ==
279+ PP.getPreprocessorOpts ().IncludeFooter ) ||
280+ CurFilenameWithNoLeadingDotSlash ==
281+ PP.getPreprocessorOpts ().IncludeHeader ) {
282+ CurFilename = " <uninit>" ;
283+ }
284+ }
285+
273286 // Emit #line directives or GNU line markers depending on what mode we're in.
274287 if (UseLineDirectives) {
275288 *OS << " #line" << ' ' << LineNo << ' ' << ' "' ;
@@ -288,6 +301,7 @@ void PrintPPOutputPPCallbacks::WriteLineInfo(unsigned LineNo,
288301 else if (FileType == SrcMgr::C_ExternCSystem)
289302 OS->write (" 3 4" , 4 );
290303 }
304+
291305 *OS << ' \n ' ;
292306}
293307
@@ -913,8 +927,6 @@ static void PrintIncludeFooter(Preprocessor &PP, SourceLocation Loc,
913927 return ;
914928 FileID FooterFileID = SourceMgr.ComputeValidFooterFileID (Footer);
915929 StringRef FooterContentBuffer = SourceMgr.getBufferData (FooterFileID);
916- // print out the name of the integration footer.
917- Callbacks->WriteFooterInfo (Footer);
918930 SmallVector<StringRef, 8 > FooterContentArr;
919931 FooterContentBuffer.split (FooterContentArr, ' \r ' );
920932 // print out the content of the integration footer.
@@ -1185,15 +1197,6 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream *OS,
11851197 PrintPreprocessedTokens (PP, Tok, Callbacks);
11861198 *OS << ' \n ' ;
11871199
1188- if (!PP.getPreprocessorOpts ().IncludeFooter .empty () &&
1189- !PP.IncludeFooterProcessed ) {
1190- assert (PP.getLangOpts ().SYCLIsHost &&
1191- " The 'include-footer' is expected in host compilation only" );
1192- SourceLocation Loc = Tok.getLocation ();
1193- PrintIncludeFooter (PP, Loc, PP.getPreprocessorOpts ().IncludeFooter ,
1194- Callbacks);
1195- }
1196-
11971200 // Remove the handlers we just added to leave the preprocessor in a sane state
11981201 // so that it can be reused (for example by a clang::Parser instance).
11991202 PP.RemovePragmaHandler (MicrosoftExtHandler.get ());
0 commit comments