[PATCH] D139676: [libTooling] Add flag to getRangeForEdit to ignore macro expansions

Eric Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 8 14:55:06 PST 2022


li.zhe.hua created this revision.
li.zhe.hua added a reviewer: ymandel.
Herald added a project: All.
li.zhe.hua requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This commit resolves the FIXME around the behavior of
`Lexer::makeFileCharRange` that `getRangeForEdit` inherits around
source locations in macro expansions.

We add a flag to `getRangeForEdit` that allows a caller to disable the
behavior, and instead uses the spelling location instead, with checks
to ensure that the source locations are not within a macro definition.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139676

Files:
  clang/include/clang/Tooling/Transformer/SourceCode.h
  clang/lib/Tooling/Transformer/SourceCode.cpp
  clang/unittests/Tooling/SourceCodeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139676.481454.patch
Type: text/x-patch
Size: 8387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221208/f3bef41d/attachment-0001.bin>


More information about the cfe-commits mailing list