jansvoboda11 updated this revision to Diff 417527.
jansvoboda11 added a comment.

Remove slash from test to make it pass on Windows


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122237

Files:
  clang/lib/Lex/HeaderSearch.cpp
  clang/test/Preprocessor/microsoft-header-search-fail.c


Index: clang/test/Preprocessor/microsoft-header-search-fail.c
===================================================================
--- /dev/null
+++ clang/test/Preprocessor/microsoft-header-search-fail.c
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -Eonly -fms-compatibility %t/test.c -I %t/include -verify
+
+//--- test.c
+#include "x/header.h"
+#include "z/header.h"
+
+// expected-warning-re@include/y/header.h:1 {{#include resolved using 
non-portable Microsoft search rules as: {{.*}}x/culprit.h}}
+// expected-error@include/z/header.h:1 {{'culprit.h' file not found}}
+
+//--- include/x/header.h
+#include "y/header.h"
+
+//--- include/y/header.h
+#include "culprit.h"
+
+//--- include/x/culprit.h
+
+//--- include/z/header.h
+#include "culprit.h"
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -976,7 +976,8 @@
   // this is a matching hit.
   if (!SkipCache && CacheLookup.StartIt == NextIt) {
     // Skip querying potentially lots of directories for this lookup.
-    It = CacheLookup.HitIt;
+    if (CacheLookup.HitIt)
+      It = CacheLookup.HitIt;
     if (CacheLookup.MappedName) {
       Filename = CacheLookup.MappedName;
       if (IsMapped)


Index: clang/test/Preprocessor/microsoft-header-search-fail.c
===================================================================
--- /dev/null
+++ clang/test/Preprocessor/microsoft-header-search-fail.c
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -Eonly -fms-compatibility %t/test.c -I %t/include -verify
+
+//--- test.c
+#include "x/header.h"
+#include "z/header.h"
+
+// expected-warning-re@include/y/header.h:1 {{#include resolved using non-portable Microsoft search rules as: {{.*}}x/culprit.h}}
+// expected-error@include/z/header.h:1 {{'culprit.h' file not found}}
+
+//--- include/x/header.h
+#include "y/header.h"
+
+//--- include/y/header.h
+#include "culprit.h"
+
+//--- include/x/culprit.h
+
+//--- include/z/header.h
+#include "culprit.h"
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -976,7 +976,8 @@
   // this is a matching hit.
   if (!SkipCache && CacheLookup.StartIt == NextIt) {
     // Skip querying potentially lots of directories for this lookup.
-    It = CacheLookup.HitIt;
+    if (CacheLookup.HitIt)
+      It = CacheLookup.HitIt;
     if (CacheLookup.MappedName) {
       Filename = CacheLookup.MappedName;
       if (IsMapped)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to