Instantiator
Generate c++ template instantiations
Loading...
Searching...
No Matches
DeleteInstantiations Class Reference

MatchCallback for template instantiation deletions. More...

#include <Callbacks/DeleteInstantiations.hpp>

Inheritance diagram for DeleteInstantiations:
[legend]
Collaboration diagram for DeleteInstantiations:
[legend]

Public Member Functions

virtual void run (const clang::ast_matchers::MatchFinder::MatchResult &Result) override
 

Public Attributes

clang::Rewriter * rewriter
 

Detailed Description

MatchCallback for template instantiation deletions.

This callback is called for the Matcher TemplInst(). It detects the point of instantiation in the source code and registers the deletion in the clang::Rewriter. For example in this piece of code:

template<typename Foo>
void doSomething(Foo& foo) {
//some code
}
template void doSomething(double&);

the callback determines the line template void doSomething(double&);.

Todo
The callback uses clang::FunctionTemplateSpecializationInfo::getPointOfInstantiation() which gives the clang::SourceLocation of the beginning of the explicit instantiation. In the example above that would be the column corresponding to the beginning of doSomething. How can one get the begin of the whole declaration and how can one get the end of the declaration?

Definition at line 32 of file DeleteInstantiations.hpp.

Member Function Documentation

◆ run()

void DeleteInstantiations::run ( const clang::ast_matchers::MatchFinder::MatchResult & Result)
overridevirtual

Definition at line 93 of file DeleteInstantiations.cpp.

Member Data Documentation

◆ rewriter

clang::Rewriter* DeleteInstantiations::rewriter

Pointer to an external clang::Rewriter object.

Definition at line 36 of file DeleteInstantiations.hpp.


The documentation for this class was generated from the following files: