Skip to content

Add support for using aliases #1860

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 6 commits into from
Sep 23, 2019
Merged

Conversation

matt-gretton-dann
Copy link
Contributor

My first DB Schema change - can that be checked please.

@matt-gretton-dann matt-gretton-dann added C++ depends on internal PR This PR should only be merged in sync with an internal Semmle PR labels Sep 3, 2019
@matt-gretton-dann matt-gretton-dann requested a review from a team as a code owner September 3, 2019 12:05
Copy link
Contributor

@nickrolfe nickrolfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to beef up the new test with an alias template, e.g. something like

template<typename T>
struct S {
  using X = T*;
};

using Y = S<int>::X;

And perhaps include t.getUnderlyingType() in the query's select statement.

@matt-gretton-dann
Copy link
Contributor Author

It might be nice to beef up the new test with an alias template, e.g. something like:

Done - commit b524297

@@ -0,0 +1,2 @@
description: Differentiate between using aliases and typedefs
compatibility: partial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On upgraded dbs it will look like every typedef is C-style. What are the applications you have in mind for this feature, and how will they be affected?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there are any specific plans to use it right now, it just seemed like something the AST ought to distinguish. It seems plausible that someone might want to distinguish them in a query, for example when codifying a style guide. I don't think we need to be concerned about upgraded databases, though.

@jbj
Copy link
Contributor

jbj commented Sep 17, 2019

LGTM, except for the conflicts.

@matt-gretton-dann
Copy link
Contributor Author

The conflicts are due to @ian-semmle's DB schema upgrades - I'm rebasing to clear these out.

@matt-gretton-dann matt-gretton-dann force-pushed the add-using-aliases branch 2 times, most recently from 3e6ee07 to aabf515 Compare September 23, 2019 09:36
jbj
jbj previously approved these changes Sep 23, 2019
Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The QLDoc could be formatted better to align with our new style, but I won't let that hold up this PR. It has to be synced with the internal repo, so it's hard to get merged without conflict.

@jbj jbj merged commit 22e57a6 into github:master Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ depends on internal PR This PR should only be merged in sync with an internal Semmle PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants