[cfe-dev] API Removal Notice (4 weeks): getStartLoc, getLocStart, getLocEnd

Stephen Kelly via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 9 16:13:14 PDT 2018


Hello,

In order to increase consistency and learnability of AST APIs, I have 
committed the following transformations on AST Node APIs:

  getLocStart -> getBeginLoc
  getStartLoc -> getBeginLoc
  getLocEnd -> getEndLoc

This is consistent with other SourceLocation accessors, which follow a 
pattern of get.*Loc.

The rationale for this change can be reviewed here:

 
http://clang-developers.42468.n3.nabble.com/getLocStart-versus-getStartLoc-td4061010.html

I have already ported the clang and clang-tools-extras code to use the 
new method names.

All third-party code must be similarly updated.

Currently, the old names remain in the code, but annotated as 
deprecated. I will remove the old names by committing

  https://reviews.llvm.org/D50353

on or after 6th September 2018. Please subscribe to that change for 
notifications. I will also ping this mailing list again 1 week prior to 
committing the removal.

Please let me know if that timeframe does not work for you or causes 
problems so that I can postpone.

On systems with git and sed, porting may be as simple as

  git grep -l getLocEnd | xargs sed -i 's/getLocEnd/getEndLoc/g'
  git grep -l getLocStart | xargs sed -i 's/getLocStart/getBeginLoc/g'
  git grep -l getStartLoc | xargs sed -i 's/getStartLoc\b/getBeginLoc/g'

The getStartLocation API is distinct and should be excluded from porting 
as above.

Because all before and after spellings are the same length, this has a 
neutral impact on the style of your code.

Thanks,

Stephen.



More information about the cfe-dev mailing list