@@ -35,8 +35,9 @@ bool CppModuleConfiguration::SetOncePath::TrySet(llvm::StringRef path) {
3535static llvm::SmallVector<std::string, 2 >
3636getTargetIncludePaths (const llvm::Triple &triple) {
3737 llvm::SmallVector<std::string, 2 > paths;
38- if (!triple.clone (true , false ).str ().empty ()) {
39- paths.push_back (" /usr/include/" + triple.clone (true , false ).str ());
38+ llvm::StringRef triple_no_objfmt = triple.str (4 );
39+ if (!triple_no_objfmt.empty ()) {
40+ paths.push_back ((" /usr/include/" + triple_no_objfmt).str ());
4041 if (!triple.getArchName ().empty () ||
4142 triple.getOSAndEnvironmentName ().empty ())
4243 paths.push_back ((" /usr/include/" + triple.getArchName () + " -" +
@@ -75,13 +76,14 @@ bool CppModuleConfiguration::analyzeFile(const FileSpec &f,
7576 parent_path (posix_dir, Style::posix).ends_with (" c++" )) {
7677 if (!m_std_inc.TrySet (posix_dir))
7778 return false ;
78- if (triple.clone (true , false ).str ().empty ())
79+ llvm::StringRef triple_no_objfmt = triple.str (4 );
80+ if (triple_no_objfmt.empty ())
7981 return true ;
8082
8183 posix_dir.consume_back (" c++/v1" );
8284 // Check if this is a target-specific libc++ include directory.
8385 return m_std_target_inc.TrySet (
84- (posix_dir + triple. clone ( true , false ). str () + " /c++/v1" ).str ());
86+ (posix_dir + triple_no_objfmt + " /c++/v1" ).str ());
8587 }
8688
8789 std::optional<llvm::StringRef> inc_path;
0 commit comments