[LLVMbugs] [Bug 15146] New: VarDecl::getSourceRange() returns invalid end location for CallInit style initializers.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 3 14:34:41 PST 2013


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

             Bug #: 15146
           Summary: VarDecl::getSourceRange() returns invalid end location
                    for CallInit style initializers.
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: lantictac at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The source locations for the parentheses in a call-style initializer are not
currently preserved in the AST representation. This leads to
VarDecl::getSourceRange() incorrectly returning the end location for the
initializer expression rather than the last parenthesis. This makes reliably
rewriting such expressions very problematic.

Example:

 // getSourceRange().getEndLoc() == <location of '1'>
 int g_foo(1);

There has been discussion on solving this problem on cfe-dev by using a new
form of initializer expression "CXXDirectInitExpr" that would preserve the
parentheses locations:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120709/060465.html

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