[llvm-branch-commits] [lldb] 2b09ded - [lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory

Raphael Isemann via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 15 07:21:21 PST 2020


Author: Raphael Isemann
Date: 2020-12-15T16:16:00+01:00
New Revision: 2b09dedac4c824c51bc0a8934b33c0f50ce0e126

URL: https://github.com/llvm/llvm-project/commit/2b09dedac4c824c51bc0a8934b33c0f50ce0e126
DIFF: https://github.com/llvm/llvm-project/commit/2b09dedac4c824c51bc0a8934b33c0f50ce0e126.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
index f1272c67d20f..d2162cf4c574 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);
   }
 


        


More information about the llvm-branch-commits mailing list