Skip to content

Commit 26dd5d9

Browse files
authored
Mangle extensions in executable paths (#625)
* Mangle extensions in executable path * Mangle getter name differently
1 parent 38d4cfb commit 26dd5d9

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

server/src/Paths.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ namespace Paths {
9898
return result;
9999
}
100100

101+
std::string mangleExtensions(const fs::path& path) {
102+
if (!path.has_extension()) {
103+
return path.string();
104+
}
105+
fs::path extension = path.extension();
106+
return mangleExtensions(removeExtension(path)) + mangle(extension);
107+
}
108+
101109
fs::path subtractPath(std::string path1, std::string path2) {
102110
if (path2 == ".") {
103111
return path1;

server/src/Paths.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ namespace Paths {
124124

125125
std::string mangle(const fs::path& path);
126126

127+
std::string mangleExtensions(const fs::path& path);
128+
127129
static inline fs::path addOrigExtensionAsSuffixAndAddNew(const fs::path &path,
128130
const std::string &newExt) {
129131
std::string extensionAsSuffix = path.extension().string();

server/src/clang-utils/SourceToHeaderMatchCallback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void SourceToHeaderMatchCallback::generateWrapper(const VarDecl *decl) const {
305305
policy.SuppressInitializers = 1;
306306

307307
/*
308-
* get_var_wrapper {
308+
* get_pointer_to_var_wrapper {
309309
* return &var;
310310
* }
311311
*/

server/src/printers/NativeMakefilePrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ namespace printer {
415415
artifacts.push_back(getRelativePath(testExecutablePath));
416416
}
417417
fs::path NativeMakefilePrinter::getTestExecutablePath(const fs::path &sourcePath) const {
418-
return Paths::removeExtension(
419-
Paths::removeExtension(Paths::getRecompiledFile(testGen->projectContext, sourcePath)));
418+
fs::path recompiledFile = Paths::getRecompiledFile(testGen->projectContext, sourcePath);
419+
return Paths::mangleExtensions(recompiledFile);
420420
}
421421

422422
NativeMakefilePrinter::NativeMakefilePrinter(const NativeMakefilePrinter &baseMakefilePrinter,

server/src/utils/PrinterUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace PrinterUtils {
2323
}
2424

2525
std::string getterName(const std::string &wrapperName) {
26-
return "get_" + wrapperName;
26+
return "get_pointer_to_" + wrapperName;
2727
}
2828

2929
std::string getterDecl(const std::string &returnTypeName,

0 commit comments

Comments
 (0)