Skip to content

Commit dbaa740

Browse files
committed
without processing ParmVarDecl
1 parent 4883ce9 commit dbaa740

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

lib/Transform/Clang/SplitDecls.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#include "tsar/Frontend/Clang/TransformationContext.h"
3232
#include "tsar/Support/Clang/Diagnostic.h"
3333
#include "tsar/Support/Clang/Utils.h"
34+
35+
#include "tsar/Analysis/Clang/GlobalInfoExtractor.h"
36+
3437
#include <clang/AST/TypeLoc.h>
3538
#include <clang/AST/Decl.h>
3639
#include <clang/AST/Type.h>
@@ -41,7 +44,8 @@
4144
#include <llvm/ADT/SmallString.h>
4245
#include <clang/Basic/SourceLocation.h>
4346
#include <llvm/ADT/StringSet.h>
44-
#include "llvm/IR/DebugInfoMetadata.h"
47+
//#include <llvm/IR/GlobalVariable.h>
48+
#include <llvm/IR/DebugInfoMetadata.h>
4549
#include <llvm/IR/Function.h>
4650
#include <llvm/IR/Module.h>
4751
#include <llvm/Support/Debug.h>
@@ -190,6 +194,7 @@ class ClangSplitter : public RecursiveASTVisitor<ClangSplitter> {
190194
ExternalRewriter Canvas(toInsert, mSrcMgr, mLangOpts);
191195

192196
SourceRange Range(S->getLocation());
197+
std::cout << "Range: " << Canvas.getRewrittenText(Range).str() << std::endl;
193198
varDeclsStarts.push_front(S->getBeginLoc());
194199
varDeclsEnds.push_front(S->getEndLoc());
195200
SourceRange varDeclRange(S->getBeginLoc(), S->getEndLoc());
@@ -234,6 +239,13 @@ class ClangSplitter : public RecursiveASTVisitor<ClangSplitter> {
234239
return true;
235240
}
236241

242+
bool VisitParmVarDecl(ParmVarDecl *S) {
243+
std::cout << "is ParmVarDecl" << std::endl;
244+
isNotSingleFlag = false;
245+
return true;
246+
}
247+
248+
237249
bool VisitStmt(Stmt *S) {
238250
if (!mClauses.empty()) {
239251
mClauses.clear();
@@ -264,18 +276,25 @@ class ClangSplitter : public RecursiveASTVisitor<ClangSplitter> {
264276
DenseSet<DeclStmt*> mMultipleDecls;
265277
std::deque<SourceLocation> varDeclsStarts;
266278
std::deque<SourceLocation> varDeclsEnds;
279+
std::deque<SourceLocation> starts;
280+
std::deque<SourceLocation> ends;
267281
std::deque<SourceRange> Ranges;
268282
std::deque<std::string> varDeclsNames;
283+
std::deque<std::string> names;
269284
int varDeclsNum = 0;
285+
int varsNum = 0;
270286
SourceLocation notSingleDeclStart;
271287
SourceLocation notSingleDeclEnd;
288+
SourceLocation DeclStart;
289+
SourceLocation DeclEnd;
272290
SourceRange TypeRange;
273291
bool SplitDeclarationFlag = false;
274292
bool isNotSingleFlag = false;
275293
bool isAfterNotSingleFlag = false;
276294
bool isFirstVar = true;
277295
std::string txtStr;
278296
std::string varDeclType;
297+
std::string DeclType;
279298
SourceLocation start;
280299
};
281300
}

0 commit comments

Comments
 (0)