Author: twoh Date: Tue Feb 21 16:30:55 2017 New Revision: 295779 URL: http://llvm.org/viewvc/llvm-project?rev=295779&view=rev Log: Fix for pr31836 - pp_nonportable_path on absolute paths: broken delimiters
Summary: This is a patch for PR31836. As the bug replaces the path separators in the included file name with the characters following them, the test script makes sure that there's no "Ccase-insensitive-include-pr31836.h" in the warning message. Reviewers: rsmith, eric_niebler Reviewed By: eric_niebler Subscribers: karies, cfe-commits Differential Revision: https://reviews.llvm.org/D30000 Added: cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh Modified: cfe/trunk/lib/Lex/PPDirectives.cpp Modified: cfe/trunk/lib/Lex/PPDirectives.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=295779&r1=295778&r2=295779&view=diff ============================================================================== --- cfe/trunk/lib/Lex/PPDirectives.cpp (original) +++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Feb 21 16:30:55 2017 @@ -1976,8 +1976,12 @@ void Preprocessor::HandleIncludeDirectiv 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] : Added: cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh?rev=295779&view=auto ============================================================================== --- cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh (added) +++ cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh Tue Feb 21 16:30:55 2017 @@ -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