-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fixed a crash and other updates to bring hyde up to date with llvm 13 #72
Conversation
matchers/utilities.cpp
Outdated
@@ -234,7 +234,7 @@ std::string GetSignature(const ASTContext* n, | |||
return signature.str(); | |||
} | |||
|
|||
if (!isTrailing) { | |||
if (!isTrailing && functionT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a runtime crash we were hitting.
sources/main.cpp
Outdated
@@ -257,6 +263,14 @@ std::pair<filesystem::path, hyde::json> load_hyde_config( | |||
directory_walk(src_file); | |||
} | |||
|
|||
if (IsVerbose()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some diagnostics in the verbose case.
sources/main.cpp
Outdated
std::vector<std::string> _clang; | ||
}; | ||
|
||
command_line_args integrate_hyde_config(int argc, const char** argv) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split the command line arguments into two sets: those used for hyde, and those to be forwarded to the clang driver. This makes things a little bit cleaner below as the tool is setting up both itself and clang-tooling.
sources/main.cpp
Outdated
|
||
/**************************************************************************************************/ | ||
|
||
CommonOptionsParser MakeOptionsParser(int argc, const char** argv) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface to CommonOptionsParser
has changed since clang 9 - this updates to the newer interface.
sources/main.cpp
Outdated
std::cerr << "Fatal error: " << error.what() << '\n'; | ||
return EXIT_FAILURE; | ||
} catch (const Error& error) { | ||
std::string description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an exception output for cases when llvm::Error
is thrown by the engine (e.g., when failing to construct the command options parser).
sources/main.cpp
Outdated
// Spin up the tool and run it. | ||
// | ||
|
||
ClangTool Tool(OptionsParser.getCompilations(), sourcePaths); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a tweak to how the clang-specific command line arguments are sent into the driver.
We have a major problem here, where the driver will try to helpfully auto-detect the type of file being compiled by the driver, and this setting cannot be overridden. For example, in Photoshop we have a number of header files that end in .h
, even though they contain C++ code within them. The driver will auto detect them as a C header file, and thus throw errors when c++ flags are passed (e.g., -std=c++14
). Even trying to force the compilation type to C++ via -x c++
doesn't work, as it's later overridden in the driver command line arguments by the auto-detect function. (You can see this happening if you run hyde in very verbose mode.)
Hyde was originally built against version 9 of clang tooling. Now that we're at version 13, I figure it's time to update things.
I'll go through the PR and add comments as necessary to detail the changes.