llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-modules <details> <summary>Changes</summary> Also add the filename to the comments it emits, to help identify where included text ends. --- Patch is 25.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/67613.diff 5 Files Affected: - (modified) clang/lib/Frontend/Rewrite/InclusionRewriter.cpp (+26-7) - (modified) clang/test/Frontend/rewrite-includes-cli-include.c (+1) - (modified) clang/test/Frontend/rewrite-includes-missing.c (+2-2) - (modified) clang/test/Frontend/rewrite-includes.c (+74-56) - (modified) clang/test/Modules/preprocess-module.cpp (+3-3) ``````````diff diff --git a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp index d3a3db0139c6d2f..6ab57adc41bfe8b 100644 --- a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp +++ b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp @@ -90,8 +90,10 @@ class InclusionRewriter : public PPCallbacks { bool EnsureNewline); void CommentOutDirective(Lexer &DirectivesLex, const Token &StartToken, const MemoryBufferRef &FromFile, StringRef EOL, - unsigned &NextToWrite, int &Lines); + unsigned &NextToWrite, int &Lines, + const IncludedFile *Inc = nullptr); const IncludedFile *FindIncludeAtLocation(SourceLocation Loc) const; + StringRef getIncludedFileName(const IncludedFile *Inc) const; const Module *FindModuleAtLocation(SourceLocation Loc) const; const Module *FindEnteredModule(SourceLocation Loc) const; bool IsIfAtLocationTrue(SourceLocation Loc) const; @@ -311,6 +313,17 @@ void InclusionRewriter::OutputContentUpTo(const MemoryBufferRef &FromFile, WriteFrom = WriteTo; } +StringRef +InclusionRewriter::getIncludedFileName(const IncludedFile *Inc) const { + if (Inc) { + auto B = SM.getBufferOrNone(Inc->Id); + assert(B && "Attempting to process invalid inclusion"); + if (B) + return llvm::sys::path::filename(B->getBufferIdentifier()); + } + return StringRef(); +} + /// Print characters from \p FromFile starting at \p NextToWrite up until the /// inclusion directive at \p StartToken, then print out the inclusion /// inclusion directive disabled by a #if directive, updating \p NextToWrite @@ -320,7 +333,8 @@ void InclusionRewriter::CommentOutDirective(Lexer &DirectiveLex, const Token &StartToken, const MemoryBufferRef &FromFile, StringRef LocalEOL, - unsigned &NextToWrite, int &Line) { + unsigned &NextToWrite, int &Line, + const IncludedFile *Inc) { OutputContentUpTo(FromFile, NextToWrite, SM.getFileOffset(StartToken.getLocation()), LocalEOL, Line, false); @@ -332,12 +346,14 @@ void InclusionRewriter::CommentOutDirective(Lexer &DirectiveLex, // OutputContentUpTo() would not output anything anyway. return; } - OS << "#if 0 /* expanded by -frewrite-includes */" << MainEOL; + OS << "#if 0 /* " << getIncludedFileName(Inc) + << " expanded by -frewrite-includes */" << MainEOL; OutputContentUpTo(FromFile, NextToWrite, SM.getFileOffset(DirectiveToken.getLocation()) + DirectiveToken.getLength(), LocalEOL, Line, true); - OS << "#endif /* expanded by -frewrite-includes */" << MainEOL; + OS << (Inc ? "#else" : "#endif") << " /* " << getIncludedFileName(Inc) + << " expanded by -frewrite-includes */" << MainEOL; } /// Find the next identifier in the pragma directive specified by \p RawToken. @@ -400,15 +416,16 @@ void InclusionRewriter::Process(FileID FileId, case tok::pp_include: case tok::pp_include_next: case tok::pp_import: { + SourceLocation Loc = HashToken.getLocation(); + const IncludedFile *Inc = FindIncludeAtLocation(Loc); CommentOutDirective(RawLex, HashToken, FromFile, LocalEOL, NextToWrite, - Line); + Line, Inc); if (FileId != PP.getPredefinesFileID()) WriteLineInfo(FileName, Line - 1, FileType, ""); StringRef LineInfoExtra; - SourceLocation Loc = HashToken.getLocation(); if (const Module *Mod = FindModuleAtLocation(Loc)) WriteImplicitModuleImport(Mod); - else if (const IncludedFile *Inc = FindIncludeAtLocation(Loc)) { + else if (Inc) { const Module *Mod = FindEnteredModule(Loc); if (Mod) OS << "#pragma clang module begin " @@ -420,6 +437,8 @@ void InclusionRewriter::Process(FileID FileId, if (Mod) OS << "#pragma clang module end /*" << Mod->getFullModuleName(true) << "*/\n"; + OS << "#endif /* " << getIncludedFileName(Inc) + << " expanded by -frewrite-includes */" << LocalEOL; // Add line marker to indicate we're returning from an included // file. diff --git a/clang/test/Frontend/rewrite-includes-cli-include.c b/clang/test/Frontend/rewrite-includes-cli-include.c index d63f966f79ca6af..437bc2ffadf1960 100644 --- a/clang/test/Frontend/rewrite-includes-cli-include.c +++ b/clang/test/Frontend/rewrite-includes-cli-include.c @@ -3,6 +3,7 @@ main_file_line // CHECK: {{^}}# 1 "<built-in>"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes2.h" 1{{$}} // CHECK-NEXT: {{^}}int included_line2;{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes2.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 1 "<built-in>" 2{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*}}rewrite-includes-cli-include.c"{{$}} // CHECK-NEXT: FileCheck diff --git a/clang/test/Frontend/rewrite-includes-missing.c b/clang/test/Frontend/rewrite-includes-missing.c index 25a59a03217ff73..984c322fd2a51f6 100644 --- a/clang/test/Frontend/rewrite-includes-missing.c +++ b/clang/test/Frontend/rewrite-includes-missing.c @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -verify -E -frewrite-includes %s -o - | FileCheck -strict-whitespace %s #include "foobar.h" // expected-error {{'foobar.h' file not found}} -// CHECK: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "foobar.h" -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 3 "{{.*}}rewrite-includes-missing.c"{{$}} // CHECK-NEXT: {{^}}# 4 "{{.*}}rewrite-includes-missing.c"{{$}} diff --git a/clang/test/Frontend/rewrite-includes.c b/clang/test/Frontend/rewrite-includes.c index 15254931250c1af..20571f99803ca12 100644 --- a/clang/test/Frontend/rewrite-includes.c +++ b/clang/test/Frontend/rewrite-includes.c @@ -28,72 +28,77 @@ static int unused; // CHECK: {{^}}// STARTCOMPARE{{$}} // CHECK-NEXT: {{^}}#define A(a,b) a ## b{{$}} // CHECK-NEXT: {{^}}A(in,t) a;{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes1.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes1.h"{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes1.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 7 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 1{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#pragma clang system_header{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 3{{$}} // CHECK-NEXT: {{^}}int included_line1;{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes2.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes2.h"{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes2.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 3{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes2.h" 1 3{{$}} // CHECK-NEXT: {{^}}int included_line2;{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes2.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 4 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 2 3{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes1.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 8 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}#ifdef FIRST{{$}} // CHECK-NEXT: {{^}}#define HEADER "rewrite-includes3.h"{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes3.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include HEADER{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes3.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 10 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes3.h" 1{{$}} // CHECK-NEXT: {{^}}unsigned int included_line3 = -10;{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes3.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 11 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}#else{{$}} // CHECK-NEXT: {{^}}# 12 "{{.*}}rewrite-includes.c"{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes4.h"{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 12 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 13 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 14 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}} // indented{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes5.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#/**/include /**/ "rewrite-includes5.h" /**/ {{\\}}{{$}} // CHECK-NEXT: {{^}} {{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes5.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 16 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes5.h" 1{{$}} // CHECK-NEXT: {{^}}int included_line5;{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes5.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 17 "{{.*}}rewrite-includes.c" 2{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes6.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes6.h" // comment{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes6.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 17 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes6.h" 1{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#pragma once{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes6.h"{{$}} // CHECK-NEXT: {{^}}int included_line6;{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes6.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 18 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}} {{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes6.h" /* comment{{$}} // CHECK-NEXT: {{^}} continues */{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 20 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 21 "{{.*}}rewrite-includes.c"{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes7.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes7.h"{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes7.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 21 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes7.h" 1{{$}} // CHECK-NEXT: {{^}}#ifndef REWRITE_INCLUDES_7{{$}} @@ -101,15 +106,16 @@ static int unused; // CHECK-NEXT: {{^}}int included_line7;{{$}} // CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 5 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes7.h"{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes7.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 22 "{{.*}}rewrite-includes.c" 2{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes7.h"{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 22 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c"{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes8.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes8.h"{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes8.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h" 1{{$}} // CHECK-NEXT: {{^}}#if 0 /* disabled by -frewrite-includes */{{$}} @@ -135,10 +141,11 @@ static int unused; // CHECK-NEXT: {{^}}# 5 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h"{{$}} // CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 6 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h"{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes8.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 24 "{{.*}}rewrite-includes.c" 2{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes9.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes9.h"{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes9.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 24 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h" 1{{$}} // CHECK-NEXT: {{^}}#if 0 /* disabled by -frewrite-includes */{{$}} @@ -147,15 +154,17 @@ static int unused; // CHECK-NEXT: {{^}}#endif /* disabled by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#if 1 /* evaluated by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h"{{$}} -// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#if 0 /* rewrite-includes9.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include_next <rewrite-includes9.h>{{$}} -// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECK-NEXT: {{^}}#else /* rewrite-includes9.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)NextIncludes(/|\\\\)}}rewrite-includes9.h" 1{{$}} // CHECK-NEXT: {{^}}int included_line9;{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes9.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h" 2{{$}} // CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 4 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h"{{$}} +// CHECK-NEXT: {{^}}#endif /* rewrite-includes9.h expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 25 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}static int unused;{{$}} // CHECK-NEXT: {{^}}// ENDCOMPARE{{$}} @@ -163,59 +172,65 @@ static int unused; // CHECKNL: {{^}}// STARTCOMPARE{{$}} // CHECKNL-NEXT: {{^}}#define A(a,b) a ## b{{$}} // CHECKNL-NEXT: {{^}}A(in,t) a;{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* rewrite-includes1.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes1.h"{{$}} -// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#else /* rewrite-includes1.h expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#pragma clang system_header{{$}} -// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}int included_line1;{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* rewrite-includes2.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes2.h"{{$}} -// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#else /* rewrite-includes2.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}int included_line2;{{$}} +// CHECKNL-NEXT: {{^}}#endif /* rewrite-includes2.h expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#endif /* rewrite-includes1.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#ifdef FIRST{{$}} // CHECKNL-NEXT: {{^}}#define HEADER "rewrite-includes3.h"{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* rewrite-includes3.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include HEADER{{$}} -// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#else /* rewrite-includes3.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}unsigned int included_line3 = -10;{{$}} +// CHECKNL-NEXT: {{^}}#endif /* rewrite-includes3.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#else{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes4.h"{{$}} -// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#endif{{$}} // CHECKNL-NEXT: {{^}} // indented{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* rewrite-includes5.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#/**/include /**/ "rewrite-includes5.h" /**/ {{\\}}{{$}} // CHECKNL-NEXT: {{^}} {{$}} -// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#else /* rewrite-includes5.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}int included_line5;{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#endif /* rewrite-includes5.h expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* rewrite-includes6.h expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes6.h" // comment{{$}} -// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#else /* rewrite-includes6.h expanded by -frewrite-includes */{{$}} +// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHEC... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/67613 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits