[LLVMbugs] [Bug 14217] New: Rewriter RemoveText(SrouceRange&) method not working on FunctionDecl

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 30 11:20:52 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=14217

             Bug #: 14217
           Summary: Rewriter RemoveText(SrouceRange&) method not working
                    on FunctionDecl
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: cocco at di.unipi.it
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Calling RemoveText on an instance of Rewriter, passing a FunctionDecl source
range makes no changes to the rewriter buffer.
I tried to remove a function declaration (+ definition) from within an
ASTConsumer derived class (HandleTranslationUnit method).

Various tries:

FunctionDecl* function;
...
rewriter.RemoveText(function->getLocation()); // removes the function name
rewriter.RemoveText(function->getSourceRange()); // doesn't remove anything

const char* start_location =
Context.getSourceManager().getCharacterData(function->getLocation());
const char* end_location =
Context.getSourceManager().getCharacterData(function->getBodyRBrace());
rewriter.RemoveText(function->getLocation(), (int)(end_location -
start_location)); // removes the name, the parameters and the body, but not the
return type

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list