-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add llvm support for meta rule 3 #1118
Conversation
llvm library for potential use on llvm side.
…e and add the attribute to pass it to Translation Engine
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 think the most important thing to do is a file that extensively tests meta-rule3. With comments that describe why a certain semantic is applied etc...
@@ -9529,6 +9529,8 @@ def err_duplicate_field : Error< | |||
"table name (table.field) to disambiguate field names that occur in more " | |||
"than one table. You can also restrict the list of tables to search by " | |||
"specifying them in the ruleset 'tables' attribute.">; | |||
def err_wrong_table_field : Error< | |||
"Field '%0' belongs to a table '%1' that does not exist in the catalog.">; |
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 think it sounds strange to say that a field belongs to a table that does not exist, because by saying "belong" it seems the table somewhat exists.
Probably @vDonGlover knows a better way to say this or, what I said above, doesn't make sense.
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.
Maybe instead of "belongs" we can say "is marked as belonging".
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.
"is defined in a table that does not exist"?
return return_value; | ||
} | ||
|
||
// Find shortest navigation path between 2 tables. If multiple shortest paths exist, return an error. |
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.
What does it mean "return an error" since this function returns true/false?
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 more comments
} | ||
|
||
// Find shortest navigation path between 2 tables. If multiple shortest paths exist, return an error. | ||
bool GaiaCatalog::findNavigationPath(StringRef src, StringRef dst, SmallVector<string, 8>& current_path, bool reportErrors) |
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.
What is current_path? And what is reportErrors? Can you add documentation for the parameters?
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 more comments
} | ||
const auto& table_data = getCatalogTableData(); | ||
|
||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); |
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.
Since you are inside "gaia code" use snake_case (or use CamelCase for Gaia stuff).
TextDiagnosticPrinter *DiagClient = new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts); | ||
|
||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); | ||
DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient); |
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.
Does this allocated memory need to be released?
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.
IntrusiveRefCntPtr is a smart pointer.
Diagnostic Engine uses smart pointers for Diagnostic Client inside. So memory is taken care of
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'd add a comment for DiagClient, to indicate this.
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 a comment
if (foundTables.size() == 1) | ||
{ | ||
fieldTableName = foundTables.begin()->first(); | ||
retVal = foundTables.begin()->second; |
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.
Instead of retVal
, you could just use result
. Same number of characters, no abbreviation.
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.
Fixed
// Find topographically shortest path between anchor table and destination table. | ||
if (gaia::catalog::GaiaCatalog::findNavigationPath(anchor_table_iterator->first(), firstComponent, path, false)) | ||
{ | ||
if(path.size() < pathLength) |
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.
Space after if
.
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.
Fixed
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.
Since @waynelwarren is busy with other matters somebody else's need to write extensive tests for this feature. Are you planning to do it as part of this PR ?
There are tests covering what was introduced in this PR (Resolving an unqualified field reference in some cases that earlier was considered ambiguous ). The more interesting part would be code generation where more tests would come in separate PR. |
Changed |
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'm assuming in another PR you'll add some tests to ensure meta-rule 3 meets our spec requirements.
The PR changes a way how type of an unqualified field is determined and attributes every declarative reference with potential anchor table reference that may be used by Translation Engine to generate the navigation code properly