Commit bdff71b6 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[torque] Add helpers for C++ code generation

Change-Id: I75a4a2af4bbe9d495d583b13fb6d885d8509c2b8
Bug: v8:7793
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1611797
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61491}
parent f6f31d15
This diff is collapsed.
......@@ -275,9 +275,9 @@ bool IsCompatibleSignature(const Signature& sig, const TypeVector& types,
class ImplementationVisitor {
public:
void GenerateBuiltinDefinitions(std::string& file_name);
void GenerateBuiltinDefinitions(const std::string& output_directory);
void GenerateClassFieldOffsets(const std::string& output_directory);
void GeneratePrintDefinitions(std::string& file_name);
void GeneratePrintDefinitions(const std::string& output_directory);
void GenerateClassVerifiers(const std::string& output_directory);
VisitResult Visit(Expression* expr);
......
......@@ -76,16 +76,9 @@ void CompileCurrentAst(TorqueCompilerOptions options) {
std::string output_directory = options.output_directory;
if (output_directory.length() != 0) {
std::string output_header_path = output_directory;
output_header_path += "/builtin-definitions-tq.h";
implementation_visitor.GenerateBuiltinDefinitions(output_header_path);
implementation_visitor.GenerateBuiltinDefinitions(output_directory);
implementation_visitor.GenerateClassFieldOffsets(output_directory);
std::string output_source_path =
output_directory + "/objects-printer-tq.cc";
implementation_visitor.GeneratePrintDefinitions(output_source_path);
implementation_visitor.GeneratePrintDefinitions(output_directory);
implementation_visitor.GenerateClassVerifiers(output_directory);
for (Namespace* n : GlobalContext::Get().GetNamespaces()) {
......
......@@ -217,6 +217,11 @@ std::string CapifyStringWithUnderscores(const std::string& camellified_string) {
if (previousWasLower && isupper(current)) {
result += "_";
}
if (current == '.' || current == '-') {
result += "_";
previousWasLower = false;
continue;
}
result += toupper(current);
previousWasLower = (islower(current));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment