[LLVMbugs] [Bug 15125] New: FunctionDecl::getNameInfo().getEndLoc() is off-by-one for C++ destructors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 30 12:46:24 PST 2013


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

             Bug #: 15125
           Summary: FunctionDecl::getNameInfo().getEndLoc() is off-by-one
                    for C++ destructors
           Product: clang
           Version: 3.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abbeyj at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9952
  --> http://llvm.org/bugs/attachment.cgi?id=9952
Test case

I have a FunctionDecl *fd which corresponds to the source
    MyClass::~MyClass() {}

I had expected fd->getNameInfo().getBeginLoc() to point at the tilde character
and fd->getNameInfo().getEndLoc() to point at the following token ("MyClass"). 
But both return the same position, pointing at the tilde.

STR:
1) Run "make" for attached test case

Actual Results:
name:      ~MyClass
qual name: MyClass::~MyClass
begin loc: test.cpp:1:18
end loc:   test.cpp:1:18

name:      ~MyClass
qual name: MyClass::~MyClass
begin loc: test.cpp:2:10
end loc:   test.cpp:2:10

Expected Results:
end loc:   test.cpp:1:19
and
end loc:   test.cpp:2:11
or similar.


If I have misunderstood the intended semantics here and this behavior is
desired, how can one get the actual end of the destructor's name?

-- 
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