Skip to content
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

C++ Fixes #125

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

C++ Fixes #125

wants to merge 8 commits into from

Conversation

giulianobelinassi
Copy link
Collaborator

@giulianobelinassi giulianobelinassi commented Aug 27, 2024

Improve analysis on C++ code.

  1. C++ UsingType.
  2. C++ TemplateSpecializationType 's TemplateType and UsingShadowDecl.

@giulianobelinassi giulianobelinassi marked this pull request as draft August 27, 2024 18:37
@marcosps
Copy link
Collaborator

marcosps commented Sep 3, 2024

@giulianobelinassi can you rebase?

@giulianobelinassi
Copy link
Collaborator Author

I am still working on it.

@marcosps
Copy link
Collaborator

marcosps commented Sep 4, 2024

I am still working on it.

Ok!

C++ have `UsingType` which is not traversed by TraverseType, so do it in
the Visitor.

Signed-off-by: Giuliano Belinassi <[email protected]>
TraverseTemplateName does not handle TemplateDecl nor UsingShadowDecl.
Do it on the visitor.

Signed-off-by: Giuliano Belinassi <[email protected]>
C++ can specify partial template declarations which can implement
additional things that the original declaration doesn't have.  Here
we try to match if a certain declaration comes from a specific
specification by matching the Identifier on a DependentNameType, but
that is not always possible so we also add all
ClassTemplatePartialSpecializationDecl for a ClassTemplateDecl to the
closure until we do not find a better way of doing this.

Signed-off-by: Giuliano Belinassi <[email protected]>
VarTemplateSpecializations should not be treated as VarDecls, otherwise
we lose the template<> argument.

Signed-off-by: Giuliano Belinassi <[email protected]>
C++ have the `using` keyword which can act like typedefs.  Visit those
as well.

Signed-off-by: Giuliano Belinassi <[email protected]>
Constructions such as `extern "C"` are modeled as LinkageSpecDecl,
which we need to analyze as well.

Signed-off-by: Giuliano Belinassi <[email protected]>
PrettyPrint::Contains_From_LineCol had a bug in which Decls that do not
contain themselves were marked as such because two files ended up having
the same FileID because of preprocessed notation (example: # 1 "file").
Fix this by dropping this function in favor of
Range_Fully_Contains_Range, which uses the expanded location.

Signed-off-by: Giuliano Belinassi <[email protected]>
Due to the recursive nature of C++, we must make sure we added all
Decls up to the root (TranslationUnitDecl) of the AST to the output,
else we might miss important decls.

Signed-off-by: Giuliano Belinassi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants