From 2b09dedac4c824c51bc0a8934b33c0f50ce0e126 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Tue, 15 Dec 2020 16:13:17 +0100 Subject: [PATCH] [lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory 7ad49aec125b3c1205b164331d0aa954d773f890 added a __memory subdirectory to libc++ but the code we use to find libc++ from the debug info support files wasn't prepared to encounter unknown subdirectories within libc++. The import-std-module tests automatically fell back to not importing the std module which caused them to fail. This patch removes our hardcoded exception for the 'experimental' subdirectory and instead just ignores all subdirectories of c++/vX/ when searching the support files. --- .../Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp index f1272c6..d2162cf 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp @@ -38,9 +38,11 @@ bool CppModuleConfiguration::analyzeFile(const FileSpec &f) { // Check for /c++/vX/ that is used by libc++. static llvm::Regex libcpp_regex(R"regex(/c[+][+]/v[0-9]/)regex"); - if (libcpp_regex.match(f.GetPath())) { - // Strip away libc++'s /experimental directory if there is one. - posix_dir.consume_back("/experimental"); + // If the path is in the libc++ include directory use it as the found libc++ + // path. Ignore subdirectories such as /c++/v1/experimental as those don't + // need to be specified in the header search. + if (libcpp_regex.match(f.GetPath()) && + parent_path(posix_dir, Style::posix).endswith("c++")) { return m_std_inc.TrySet(posix_dir); } -- 2.7.4