12
12
13
13
#include " Plugins/TypeSystem/Swift/SwiftASTContext.h"
14
14
15
- // C++ Includes
16
- #include < mutex> // std::once
17
- #include < queue>
18
- #include < set>
19
- #include < sstream>
20
-
21
15
#include " swift/AST/ASTContext.h"
22
16
#include " swift/AST/ASTDemangler.h"
23
17
#include " swift/AST/ASTMangler.h"
130
124
#include " Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
131
125
#include " Plugins/TypeSystem/Clang/TypeSystemClang.h"
132
126
127
+ #include < mutex>
128
+ #include < queue>
129
+ #include < regex>
130
+ #include < set>
131
+ #include < sstream>
132
+
133
133
namespace {
134
134
135
135
// / Used to sort the log output.
@@ -1145,11 +1145,6 @@ std::string SwiftASTContext::GetResourceDir(StringRef platform_sdk_path,
1145
1145
{
1146
1146
FileSpec faux_swift_dir_spec (swift_dir);
1147
1147
if (faux_swift_dir_spec) {
1148
- // We can't use a C++11 stdlib regex feature here because it doesn't
1149
- // work on Ubuntu 14.04 x86_64. Once we don't care about supporting
1150
- // that anymore, let's pull the code below back in since it is a
1151
- // simpler implementation using std::regex.
1152
- #if 0
1153
1148
// Let's try to regex this.
1154
1149
// We're looking for /some/path/lldb-{os}-{arch}, and want to
1155
1150
// build the following:
@@ -1168,43 +1163,17 @@ std::string SwiftASTContext::GetResourceDir(StringRef platform_sdk_path,
1168
1163
const std::string build_tree_resource_dir =
1169
1164
std::regex_replace (faux_swift_dir, match_regex,
1170
1165
replace_format);
1171
- #else
1172
- std::string build_tree_resource_dir;
1173
- const std::string faux_swift_dir = faux_swift_dir_spec.GetCString ();
1174
-
1175
- // Find something that matches lldb- (particularly,
1176
- // the last one).
1177
- const std::string lldb_dash (" lldb-" );
1178
- auto lldb_pos = faux_swift_dir.rfind (lldb_dash);
1179
- if ((lldb_pos != std::string::npos) && (lldb_pos > 0 ) &&
1180
- ((faux_swift_dir[lldb_pos - 1 ] == ' \\ ' ) ||
1181
- (faux_swift_dir[lldb_pos - 1 ] == ' /' ))) {
1182
- // We found something that matches ^.+[/\\]lldb-.+$
1183
- std::ostringstream stream;
1184
- // Take everything before lldb- (the path leading up to
1185
- // the lldb dir).
1186
- stream << faux_swift_dir.substr (0 , lldb_pos);
1187
-
1188
- // replace lldb- with swift-.
1189
- stream << " swift-" ;
1190
-
1191
- // and now tack on the same components from after
1192
- // the lldb- part.
1193
- stream << faux_swift_dir.substr (lldb_pos + lldb_dash.length ());
1194
- const std::string build_tree_resource_dir = stream.str ();
1166
+ LOG_PRINTF (GetLog (LLDBLog::Types),
1167
+ " trying ePathTypeSwiftDir regex-based build dir: %s" ,
1168
+ build_tree_resource_dir.c_str ());
1169
+ FileSpec swift_resource_dir_spec (build_tree_resource_dir.c_str ());
1170
+ if (IsDirectory (swift_resource_dir_spec)) {
1195
1171
LOG_PRINTF (GetLog (LLDBLog::Types),
1196
- " trying ePathTypeSwiftDir regex-based build dir: %s" ,
1197
- build_tree_resource_dir.c_str ());
1198
- FileSpec swift_resource_dir_spec (build_tree_resource_dir.c_str ());
1199
- if (IsDirectory (swift_resource_dir_spec)) {
1200
- LOG_PRINTF (GetLog (LLDBLog::Types),
1201
- " found Swift resource dir via "
1202
- " ePathTypeSwiftDir + inferred build-tree dir: %s" ,
1203
- swift_resource_dir_spec.GetCString ());
1204
- return swift_resource_dir_spec.GetCString ();
1205
- }
1172
+ " found Swift resource dir via "
1173
+ " ePathTypeSwiftDir + inferred build-tree dir: %s" ,
1174
+ swift_resource_dir_spec.GetCString ());
1175
+ return swift_resource_dir_spec.GetCString ();
1206
1176
}
1207
- #endif
1208
1177
}
1209
1178
}
1210
1179
0 commit comments