CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EDMPluginDumper.cc
Go to the documentation of this file.
1 #include "EDMPluginDumper.h"
2 #include <boost/interprocess/sync/interprocess_semaphore.hpp>
3 #include <iostream>
4 #include <fstream>
5 #include <iterator>
6 #include <string>
7 #include <algorithm>
8 
9 using namespace clang;
10 using namespace clang::ento;
11 using namespace llvm;
12 
13 namespace clangcms {
14 
15 void EDMPluginDumper::checkASTDecl(const clang::ClassTemplateDecl *TD,clang::ento::AnalysisManager& mgr,
16  clang::ento::BugReporter &BR ) const {
17  const clang::SourceManager &SM = BR.getSourceManager();
18  std::string tname = TD->getTemplatedDecl()->getQualifiedNameAsString();
19  if ( tname == "edm::WorkerMaker" ) {
20  for ( auto I = TD->spec_begin(), E = TD->spec_end(); I != E; ++I)
21  {
22  for (unsigned J = 0, F = I->getTemplateArgs().size(); J!=F; ++J)
23  {
24  if (const clang::CXXRecordDecl * RD = I->getTemplateArgs().get(J).getAsType().getTypePtr()->getAsCXXRecordDecl()) {
25  const char * pPath = std::getenv("LOCALRT");
26  std::string rname = RD->getQualifiedNameAsString();
27  std::string dname("");
28  if ( pPath != NULL ) dname = std::string(pPath);
29  std::string fname("/tmp/plugins.txt.unsorted");
30  std::string tname = dname + fname;
31  std::string ostring = "edmplugin type '"+ rname +"'\n";
32  std::ofstream file(tname.c_str(),std::ios::app);
33  file<<ostring;
34  if (const ClassTemplateSpecializationDecl *SD = dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
35  for (unsigned J = 0, F = SD->getTemplateArgs().size(); J!=F; ++J) {
36  if (SD->getTemplateArgs().get(J).getKind() == clang::TemplateArgument::Type && SD->getTemplateArgs().get(J).getAsType().getTypePtr()->isRecordType() )
37  {
38  const clang::CXXRecordDecl * D = SD->getTemplateArgs().get(J).getAsType().getTypePtr()->getAsCXXRecordDecl();
39  std::string dname = D->getQualifiedNameAsString();
40  std::string ostring = "edmplugin type '"+rname+"' template arg '"+ dname +"'\n";
41  std::ofstream file(tname.c_str(),std::ios::app);
42  file<<ostring;
43 
44  }
45  }
46  }
47  }
48  }
49  }
50  }
51 } //end class
52 
53 
54 }//end namespace
55 
56 
#define NULL
Definition: scimark2.h:8
static const float SD[]
Definition: sicif.h:67
const std::complex< double > I
Definition: I.h:8
string fname
main script
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150