@@ -156,6 +156,13 @@ clang::SourceRange TargetCodeRegion::getRealRange() {
156
156
return CapturedStmtNode->getSourceRange ();
157
157
}
158
158
159
+ clang::SourceRange TargetCodeRegion::getSpellingRange () {
160
+ auto &SM = CapturedStmtNode->getCapturedDecl ()->getASTContext ().getSourceManager ();
161
+ auto InnerRange = getInnerRange ();
162
+ return clang::SourceRange (SM.getSpellingLoc (InnerRange.getBegin ()),
163
+ SM.getSpellingLoc (InnerRange.getEnd ()));
164
+ }
165
+
159
166
clang::SourceRange TargetCodeRegion::getInnerRange () {
160
167
auto InnerLocStart = getStartLoc ();
161
168
auto InnerLocEnd = getEndLoc ();
@@ -428,9 +435,17 @@ std::string TargetCodeRegion::PrintPretty() {
428
435
clang::SourceRange TargetCodeDecl::getRealRange () {
429
436
// return DeclNode->getSourceRange();
430
437
// return DeclNode->getSourceRange();
438
+ // auto &SM = DeclNode->getASTContext().getSourceManager();
439
+ // return clang::SourceRange(SM.getSpellingLoc(DeclNode->getBeginLoc()),
440
+ // SM.getSpellingLoc(DeclNode->getEndLoc()));
441
+ return DeclNode->getSourceRange ();
442
+ }
443
+
444
+ clang::SourceRange TargetCodeDecl::getSpellingRange () {
431
445
auto &SM = DeclNode->getASTContext ().getSourceManager ();
432
- return clang::SourceRange (SM.getSpellingLoc (DeclNode->getBeginLoc ()),
433
- SM.getSpellingLoc (DeclNode->getEndLoc ()));
446
+ auto InnerRange = getInnerRange ();
447
+ return clang::SourceRange (SM.getSpellingLoc (InnerRange.getBegin ()),
448
+ SM.getSpellingLoc (InnerRange.getEnd ()));
434
449
}
435
450
436
451
std::string TargetCodeDecl::PrintPretty () {
0 commit comments