|
31 | 31 | #include "tsar/Frontend/Clang/TransformationContext.h"
|
32 | 32 | #include "tsar/Support/Clang/Diagnostic.h"
|
33 | 33 | #include "tsar/Support/Clang/Utils.h"
|
| 34 | + |
| 35 | +#include "tsar/Analysis/Clang/GlobalInfoExtractor.h" |
| 36 | + |
34 | 37 | #include <clang/AST/TypeLoc.h>
|
35 | 38 | #include <clang/AST/Decl.h>
|
36 | 39 | #include <clang/AST/Type.h>
|
|
41 | 44 | #include <llvm/ADT/SmallString.h>
|
42 | 45 | #include <clang/Basic/SourceLocation.h>
|
43 | 46 | #include <llvm/ADT/StringSet.h>
|
44 |
| -#include "llvm/IR/DebugInfoMetadata.h" |
| 47 | +//#include <llvm/IR/GlobalVariable.h> |
| 48 | +#include <llvm/IR/DebugInfoMetadata.h> |
45 | 49 | #include <llvm/IR/Function.h>
|
46 | 50 | #include <llvm/IR/Module.h>
|
47 | 51 | #include <llvm/Support/Debug.h>
|
@@ -190,6 +194,7 @@ class ClangSplitter : public RecursiveASTVisitor<ClangSplitter> {
|
190 | 194 | ExternalRewriter Canvas(toInsert, mSrcMgr, mLangOpts);
|
191 | 195 |
|
192 | 196 | SourceRange Range(S->getLocation());
|
| 197 | + std::cout << "Range: " << Canvas.getRewrittenText(Range).str() << std::endl; |
193 | 198 | varDeclsStarts.push_front(S->getBeginLoc());
|
194 | 199 | varDeclsEnds.push_front(S->getEndLoc());
|
195 | 200 | SourceRange varDeclRange(S->getBeginLoc(), S->getEndLoc());
|
@@ -234,6 +239,13 @@ class ClangSplitter : public RecursiveASTVisitor<ClangSplitter> {
|
234 | 239 | return true;
|
235 | 240 | }
|
236 | 241 |
|
| 242 | + bool VisitParmVarDecl(ParmVarDecl *S) { |
| 243 | + std::cout << "is ParmVarDecl" << std::endl; |
| 244 | + isNotSingleFlag = false; |
| 245 | + return true; |
| 246 | + } |
| 247 | + |
| 248 | + |
237 | 249 | bool VisitStmt(Stmt *S) {
|
238 | 250 | if (!mClauses.empty()) {
|
239 | 251 | mClauses.clear();
|
@@ -264,18 +276,25 @@ class ClangSplitter : public RecursiveASTVisitor<ClangSplitter> {
|
264 | 276 | DenseSet<DeclStmt*> mMultipleDecls;
|
265 | 277 | std::deque<SourceLocation> varDeclsStarts;
|
266 | 278 | std::deque<SourceLocation> varDeclsEnds;
|
| 279 | + std::deque<SourceLocation> starts; |
| 280 | + std::deque<SourceLocation> ends; |
267 | 281 | std::deque<SourceRange> Ranges;
|
268 | 282 | std::deque<std::string> varDeclsNames;
|
| 283 | + std::deque<std::string> names; |
269 | 284 | int varDeclsNum = 0;
|
| 285 | + int varsNum = 0; |
270 | 286 | SourceLocation notSingleDeclStart;
|
271 | 287 | SourceLocation notSingleDeclEnd;
|
| 288 | + SourceLocation DeclStart; |
| 289 | + SourceLocation DeclEnd; |
272 | 290 | SourceRange TypeRange;
|
273 | 291 | bool SplitDeclarationFlag = false;
|
274 | 292 | bool isNotSingleFlag = false;
|
275 | 293 | bool isAfterNotSingleFlag = false;
|
276 | 294 | bool isFirstVar = true;
|
277 | 295 | std::string txtStr;
|
278 | 296 | std::string varDeclType;
|
| 297 | + std::string DeclType; |
279 | 298 | SourceLocation start;
|
280 | 299 | };
|
281 | 300 | }
|
|
0 commit comments