[all-commits] [llvm/llvm-project] a78d4b: [libTooling] Add flag to getRangeForEdit to ignore...

Eric Li via All-commits all-commits at lists.llvm.org
Thu Dec 8 19:41:12 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a78d4b5ba716d88a90b905c261f53e74e67a7367
      https://github.com/llvm/llvm-project/commit/a78d4b5ba716d88a90b905c261f53e74e67a7367
  Author: Eric Li <li.zhe.hua at gmail.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M clang/include/clang/Tooling/Transformer/SourceCode.h
    M clang/lib/Tooling/Transformer/SourceCode.cpp
    M clang/unittests/Tooling/SourceCodeTest.cpp

  Log Message:
  -----------
  [libTooling] Add flag to getRangeForEdit to ignore macro expansions

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.

Differential Revision: https://reviews.llvm.org/D139676




More information about the All-commits mailing list