This revision was automatically updated to reflect the committed changes.
Closed by commit rL295779: Fix for pr31836 - pp_nonportable_path on absolute 
paths: broken delimiters (authored by twoh).

Changed prior to commit:
  https://reviews.llvm.org/D30000?vs=88584&id=89285#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30000

Files:
  cfe/trunk/lib/Lex/PPDirectives.cpp
  cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh


Index: cfe/trunk/lib/Lex/PPDirectives.cpp
===================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp
+++ cfe/trunk/lib/Lex/PPDirectives.cpp
@@ -1976,8 +1976,12 @@
       SmallString<128> Path;
       Path.reserve(Name.size()+2);
       Path.push_back(isAngled ? '<' : '"');
+      bool isLeadingSeparator = llvm::sys::path::is_absolute(Name);
       for (auto Component : Components) {
-        Path.append(Component);
+        if (isLeadingSeparator)
+          isLeadingSeparator = false;
+        else
+          Path.append(Component);
         // Append the separator the user used, or the close quote
         Path.push_back(
           Path.size() <= Filename.size() ? Filename[Path.size()-1] :
Index: cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
===================================================================
--- cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
+++ cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
@@ -0,0 +1,9 @@
+// REQUIRES: case-insensitive-filesystem
+// UNSUPPORTED: system-windows
+
+// RUN: mkdir -p %T
+// RUN: touch %T/case-insensitive-include-pr31836.h
+// RUN: echo "#include \"%T/Case-Insensitive-Include-Pr31836.h\"" | %clang_cc1 
-E - 2>&1 | FileCheck %s
+
+// CHECK: warning: non-portable path to file
+// CHECK-SAME: /case-insensitive-include-pr31836.h


Index: cfe/trunk/lib/Lex/PPDirectives.cpp
===================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp
+++ cfe/trunk/lib/Lex/PPDirectives.cpp
@@ -1976,8 +1976,12 @@
       SmallString<128> Path;
       Path.reserve(Name.size()+2);
       Path.push_back(isAngled ? '<' : '"');
+      bool isLeadingSeparator = llvm::sys::path::is_absolute(Name);
       for (auto Component : Components) {
-        Path.append(Component);
+        if (isLeadingSeparator)
+          isLeadingSeparator = false;
+        else
+          Path.append(Component);
         // Append the separator the user used, or the close quote
         Path.push_back(
           Path.size() <= Filename.size() ? Filename[Path.size()-1] :
Index: cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
===================================================================
--- cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
+++ cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
@@ -0,0 +1,9 @@
+// REQUIRES: case-insensitive-filesystem
+// UNSUPPORTED: system-windows
+
+// RUN: mkdir -p %T
+// RUN: touch %T/case-insensitive-include-pr31836.h
+// RUN: echo "#include \"%T/Case-Insensitive-Include-Pr31836.h\"" | %clang_cc1 -E - 2>&1 | FileCheck %s
+
+// CHECK: warning: non-portable path to file
+// CHECK-SAME: /case-insensitive-include-pr31836.h
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to