skan updated this revision to Diff 205001.
skan added a comment.

move test case to print-header-includes.c


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62115/new/

https://reviews.llvm.org/D62115

Files:
  lib/Frontend/HeaderIncludeGen.cpp
  test/Frontend/print-header-includes.c


Index: test/Frontend/print-header-includes.c
===================================================================
--- test/Frontend/print-header-includes.c
+++ test/Frontend/print-header-includes.c
@@ -29,4 +29,15 @@
 // MS-BLACKLIST: Note: including file:  {{[^ ]*test2.h}}
 // MS-BLACKLIST-NOT: Note
 
+// RUN: %clang_cc1 -H -fsyntax-only %s 2>&1 | FileCheck %s \
+// RUN: --check-prefix=GCC-STDOUT
+// GCC-STDOUT: .
+// GCC-STDOUT-SAME: Inputs{{\/|\\\\}}test.h
+// GCC-STDOUT: ..
+// GCC-STDOUT-SAME: Inputs{{\/|\\\\}}test2.h
+
+#if defined(_WIN32) || defined(_WIN64)
+#include "Inputs\test.h"
+#else
 #include "Inputs/test.h"
+#endif
Index: lib/Frontend/HeaderIncludeGen.cpp
===================================================================
--- lib/Frontend/HeaderIncludeGen.cpp
+++ lib/Frontend/HeaderIncludeGen.cpp
@@ -51,6 +51,10 @@
 static void PrintHeaderInfo(raw_ostream *OutputFile, StringRef Filename,
                             bool ShowDepth, unsigned CurrentIncludeDepth,
                             bool MSStyle) {
+  // Simplify Filename that starts with "./"
+  if (Filename.startswith("./"))
+    Filename = Filename.substr(2);
+
   // Write to a temporary string to avoid unnecessary flushing on errs().
   SmallString<512> Pathname(Filename);
   if (!MSStyle)


Index: test/Frontend/print-header-includes.c
===================================================================
--- test/Frontend/print-header-includes.c
+++ test/Frontend/print-header-includes.c
@@ -29,4 +29,15 @@
 // MS-BLACKLIST: Note: including file:  {{[^ ]*test2.h}}
 // MS-BLACKLIST-NOT: Note
 
+// RUN: %clang_cc1 -H -fsyntax-only %s 2>&1 | FileCheck %s \
+// RUN: --check-prefix=GCC-STDOUT
+// GCC-STDOUT: .
+// GCC-STDOUT-SAME: Inputs{{\/|\\\\}}test.h
+// GCC-STDOUT: ..
+// GCC-STDOUT-SAME: Inputs{{\/|\\\\}}test2.h
+
+#if defined(_WIN32) || defined(_WIN64)
+#include "Inputs\test.h"
+#else
 #include "Inputs/test.h"
+#endif
Index: lib/Frontend/HeaderIncludeGen.cpp
===================================================================
--- lib/Frontend/HeaderIncludeGen.cpp
+++ lib/Frontend/HeaderIncludeGen.cpp
@@ -51,6 +51,10 @@
 static void PrintHeaderInfo(raw_ostream *OutputFile, StringRef Filename,
                             bool ShowDepth, unsigned CurrentIncludeDepth,
                             bool MSStyle) {
+  // Simplify Filename that starts with "./"
+  if (Filename.startswith("./"))
+    Filename = Filename.substr(2);
+
   // Write to a temporary string to avoid unnecessary flushing on errs().
   SmallString<512> Pathname(Filename);
   if (!MSStyle)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to