Skip to content

Mangle extensions in executable paths #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions server/src/Paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ namespace Paths {
return result;
}

std::string mangleExtensions(const fs::path& path) {
if (!path.has_extension()) {
return path.string();
}
fs::path extension = path.extension();
return mangleExtensions(removeExtension(path)) + mangle(extension);
}

fs::path subtractPath(std::string path1, std::string path2) {
if (path2 == ".") {
return path1;
Expand Down
2 changes: 2 additions & 0 deletions server/src/Paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ namespace Paths {

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

std::string mangleExtensions(const fs::path& path);

static inline fs::path addOrigExtensionAsSuffixAndAddNew(const fs::path &path,
const std::string &newExt) {
std::string extensionAsSuffix = path.extension().string();
Expand Down
2 changes: 1 addition & 1 deletion server/src/clang-utils/SourceToHeaderMatchCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void SourceToHeaderMatchCallback::generateWrapper(const VarDecl *decl) const {
policy.SuppressInitializers = 1;

/*
* get_var_wrapper {
* get_pointer_to_var_wrapper {
* return &var;
* }
*/
Expand Down
4 changes: 2 additions & 2 deletions server/src/printers/NativeMakefilePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ namespace printer {
artifacts.push_back(getRelativePath(testExecutablePath));
}
fs::path NativeMakefilePrinter::getTestExecutablePath(const fs::path &sourcePath) const {
return Paths::removeExtension(
Paths::removeExtension(Paths::getRecompiledFile(testGen->projectContext, sourcePath)));
fs::path recompiledFile = Paths::getRecompiledFile(testGen->projectContext, sourcePath);
return Paths::mangleExtensions(recompiledFile);
}

NativeMakefilePrinter::NativeMakefilePrinter(const NativeMakefilePrinter &baseMakefilePrinter,
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils/PrinterUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace PrinterUtils {
}

std::string getterName(const std::string &wrapperName) {
return "get_" + wrapperName;
return "get_pointer_to_" + wrapperName;
}

std::string getterDecl(const std::string &returnTypeName,
Expand Down