Source locations for ? and : in ConditionalOperator.

Hello.

We would like to provide the AST node for ConditionalOperator with source location info for the ? and : tokens.

Besides matching our own needs, the addition of these locations will allow for the removal of the following FIXME in lib/Sema/TreeTransform.h:

   // FIXM: ? and : locations are broken.
   SourceLocation FakeQuestionLoc = E->getCond()->getLocEnd();
   SourceLocation FakeColonLoc = E->getFalseExpr()->getLocStart();
   return getDerived().RebuildConditionalOperator(move(Cond),
                                                  FakeQuestionLoc,
                                                  move(LHS),
                                                  FakeColonLoc,
                                                  move(RHS));

Is that OK also from the point of view of clang developers?

Cheers,
Enea Zaffanella.

Enea Zaffanella wrote:

Hello.

We would like to provide the AST node for ConditionalOperator with
source location info for the ? and : tokens.
  

Yes, please.

Sebastian

Sebastian Redl wrote:

Enea Zaffanella wrote:

Hello.

We would like to provide the AST node for ConditionalOperator with source location info for the ? and : tokens.
  

Yes, please.

Sebastian

Here it is.

Cheers,
Enea Zaffanella.

ConditionalOperatorLocs.patch (5.17 KB)

Thanks! Committed here:

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

  • Doug