[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to identify a class in a *.cpp file?

Static Analysis framework with some sample checkers, including ones that check some class properties can be checked out from CDT repository
at dev.eclipse.org:/cvsroot/tools/org.eclipse.cdt/codan
See more details in
http://wiki.eclipse.org/CDT/designs/StaticAnalysis

Qi WeiSong wrote:
*_Hello,  _all:

I am new to the CDT, and right now trying to develop a plug in to do a static analysis for our c++ source code. I want to find out the class name in the *.cpp file. However, I don't find any suitable API to do this. Can someone tell me which API i should use and how I should do it? I have made a solution in a different way as following. Please help! thank you so much!


public void analyze(AnalysisHistory history) {
CodeReviewResource resource = (CodeReviewResource)getProvider().getProperty(
history.getHistoryId(), CodeReviewProvider.RESOURCE_PROPERTY);
List<IASTNode> tUnitList = resource.getTypedNodeList(
resource.getResourceCompUnit(), CodeReviewVisitor.TYPE_IASTDeclaration);
for(IASTNode fileNode:tUnitList){
//psudo code
for each node, call the getRawSignature();
find out the class name by checking the string got from getRawSignature().
}
}*
--
Best Regards,
WeiSong



------------------------------------------------------------------------

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev