History log of /llvm-project/clang/lib/Tooling/Transformer/SourceCode.cpp (Results 1 – 17 of 17)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4
# 345c4822 05-Apr-2024 Eric Li <li.zhe.hua@gmail.com>

[libTooling] Fix `getFileRangeForEdit` for inner nested template types (#87673)

When there is `>>` in source from the right brackets of a nested
template, the end location of the inner template poi

[libTooling] Fix `getFileRangeForEdit` for inner nested template types (#87673)

When there is `>>` in source from the right brackets of a nested
template, the end location of the inner template points into a scratch
space with a single `>` token. This prevents the lexer from seeing the
`>>` token in the original source.

However, this causes the range to appear to be partially in a macro, and
is problematic if we are trying to avoid ranges with any macro
expansions.

This change detects these split tokens in token ranges, converting it to the
corresponding character range without the expansion.

show more ...


Revision tags: llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# f3dcc235 13-Dec-2023 Kazu Hirata <kazu@google.com>

[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}:

[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1
# 75b76c4b 18-Sep-2023 Clement Courbet <courbet@google.com>

[clang-transformer] Allow stencils to read from system headers. (#66480)

We were previously checking that stencil input ranges were writable. It
suffices for them to be readable.


Revision tags: llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init
# 2307029b 12-Jan-2023 Eric Li <li.zhe.hua@gmail.com>

[libTooling] Rename `getRangeForEdit` as `getFileRangeForEdit`

With the addition of `getFileRange`, we rename `getRangeForEdit` as
`getFileRangeForEdit` for consistency in the API.

Depends on D1416

[libTooling] Rename `getRangeForEdit` as `getFileRangeForEdit`

With the addition of `getFileRange`, we rename `getRangeForEdit` as
`getFileRangeForEdit` for consistency in the API.

Depends on D141634

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

show more ...


# 7d0cdbf6 12-Jan-2023 Eric Li <li.zhe.hua@gmail.com>

[libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`

Add a `getFileRange` function alongside the existing `getRangeForEdit`
as a way to get a contiguous range within a single file

[libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`

Add a `getFileRange` function alongside the existing `getRangeForEdit`
as a way to get a contiguous range within a single file (similar to
`getRangeForEdit`) but without the restriction that it cannot be in a
system header.

This can be used where a tool may want to use the range to extract the
source text. In such cases, we don't want to restrict this from
pulling from system headers.

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

show more ...


Revision tags: llvmorg-15.0.7
# b0de3630 14-Dec-2022 Fangrui Song <i@maskray.me>

[clang] Remove uses of ::testing::Matcher<const Optional<T> &>

Change a few functions (getCheckTraversalKind, some clang/Tooling/ API, etc)
from llvm::Optional to std::optional.


# a78d4b5b 08-Dec-2022 Eric Li <li.zhe.hua@gmail.com>

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

[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

show more ...


# 5891420e 03-Dec-2022 Kazu Hirata <kazu@google.com>

[clang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of m

[clang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

show more ...


Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3
# ecfa0b24 01-Jul-2020 Gabriel Matute <gmatute@google.com>

[libTooling] Fix `maybeExtendRange` to support `CharRange`s.

Currently, `maybeExtendRange` takes a `CharSourceRange`, but only works
correctly for the `TokenRange` case. This change adds proper supp

[libTooling] Fix `maybeExtendRange` to support `CharRange`s.

Currently, `maybeExtendRange` takes a `CharSourceRange`, but only works
correctly for the `TokenRange` case. This change adds proper support for the
`CharRange` case.

Reviewed By: gribozavr2

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

show more ...


Revision tags: llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1
# 76221c73 06-Apr-2020 Reid Kleckner <rnk@google.com>

Remove llvm::Error include form Diagnostic.h

Saves ~400 related LLVM ADT. llvm/ADT/Error.h takes 90ms to parse.

$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
| grep '^[-+] '

Remove llvm::Error include form Diagnostic.h

Saves ~400 related LLVM ADT. llvm/ADT/Error.h takes 90ms to parse.

$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
| grep '^[-+] ' | sort | uniq -c | sort -nr
403 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Error.h
403 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm-c/Error.h
397 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Format.h
397 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Debug.h
377 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/StringExtras.h
158 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm-c/ExternC.h
138 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/ErrorOr.h
13 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/raw_ostream.h
13 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/SmallString.h
5 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/Twine.h

show more ...


# ba1ffd25 03-Apr-2020 Reid Kleckner <rnk@google.com>

[OpenMP][NFC] Remove the need to include `OpenMPClause.h`

See rational here: https://reviews.llvm.org/D76173#1922916
Time to compile Attr.h in isolation goes from 2.6s to 1.8s.

Original patch by Jo

[OpenMP][NFC] Remove the need to include `OpenMPClause.h`

See rational here: https://reviews.llvm.org/D76173#1922916
Time to compile Attr.h in isolation goes from 2.6s to 1.8s.

Original patch by Johannes, plus some additions from Reid to fix some
clang tooling targets.

Effect on transitive includes is marginal, though:

$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
| grep '^[-+] ' | sort | uniq -c | sort -nr
104 - /usr/local/google/home/rnk/llvm-project/clang/include/clang/AST/OpenMPClause.h
87 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
19 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/SmallSet.h
19 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/SetVector.h
14 - /usr/include/c++/9/set
...

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

show more ...


Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3
# 86565c13 27-Feb-2020 Reid Kleckner <rnk@google.com>

Avoid SourceManager.h include in RawCommentList.h, add missing incs

SourceManager.h includes FileManager.h, which is expensive due to
dependencies on LLVM FS headers.

Remove dead BeforeThanCompare

Avoid SourceManager.h include in RawCommentList.h, add missing incs

SourceManager.h includes FileManager.h, which is expensive due to
dependencies on LLVM FS headers.

Remove dead BeforeThanCompare specialization.

Sink ASTContext::addComment to cpp file.

This reduces the time to compile a file that does nothing but include
ASTContext.h from ~3.4s to ~2.8s for me.

Saves these includes:
219 - ../clang/include/clang/Basic/SourceManager.h
204 - ../clang/include/clang/Basic/FileSystemOptions.h
204 - ../clang/include/clang/Basic/FileManager.h
165 - ../llvm/include/llvm/Support/VirtualFileSystem.h
164 - ../llvm/include/llvm/Support/SourceMgr.h
164 - ../llvm/include/llvm/Support/SMLoc.h
161 - ../llvm/include/llvm/Support/Path.h
141 - ../llvm/include/llvm/ADT/BitVector.h
128 - ../llvm/include/llvm/Support/MemoryBuffer.h
124 - ../llvm/include/llvm/Support/FileSystem.h
124 - ../llvm/include/llvm/Support/Chrono.h
124 - .../MSVCSTL/include/stack
122 - ../llvm/include/llvm-c/Types.h
122 - ../llvm/include/llvm/Support/NativeFormatting.h
122 - ../llvm/include/llvm/Support/FormatProviders.h
122 - ../llvm/include/llvm/Support/CBindingWrapping.h
122 - .../MSVCSTL/include/xtimec.h
122 - .../MSVCSTL/include/ratio
122 - .../MSVCSTL/include/chrono
121 - ../llvm/include/llvm/Support/FormatVariadicDetails.h
118 - ../llvm/include/llvm/Support/MD5.h
109 - .../MSVCSTL/include/deque
105 - ../llvm/include/llvm/Support/Host.h
105 - ../llvm/include/llvm/Support/Endian.h

Reviewed By: aaron.ballman, hans

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

show more ...


# 38b4516d 26-Feb-2020 Yitzhak Mandelbaum <yitzhakm@google.com>

[libTooling] Add function to determine associated text of a declaration.

Summary:
Second attempt -- the first was reverted in commit 0e480b39c66143ad142f9a30d8d40e49d7d7b0ce, because of test breakag

[libTooling] Add function to determine associated text of a declaration.

Summary:
Second attempt -- the first was reverted in commit 0e480b39c66143ad142f9a30d8d40e49d7d7b0ce, because of test breakages. This revision fixes the cause of the test breakages.

Original description follows:
This patch adds `getAssociatedRange` which, for a given decl, computes preceding
and trailing text that would conceptually be associated with the decl by the
reader. This includes comments, whitespace, and separators like ';'.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

show more ...


# 0e480b39 26-Feb-2020 Nico Weber <thakis@chromium.org>

Revert "[libTooling] Add function to determine associated text of a declaration."

This reverts commit 9c54f6154f748e707ad2385ddf6d66e812890c6a.
Breaks two tests on Windows, see e.g.
http://lab.llvm.

Revert "[libTooling] Add function to determine associated text of a declaration."

This reverts commit 9c54f6154f748e707ad2385ddf6d66e812890c6a.
Breaks two tests on Windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/14505/steps/stage%201%20check/logs/stdio

show more ...


Revision tags: llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init
# 9c54f615 03-Jan-2020 Yitzhak Mandelbaum <yitzhakm@google.com>

[libTooling] Add function to determine associated text of a declaration.

Summary:
This patch adds `getAssociatedRange` which, for a given decl, computes preceding
and trailing text that would concep

[libTooling] Add function to determine associated text of a declaration.

Summary:
This patch adds `getAssociatedRange` which, for a given decl, computes preceding
and trailing text that would conceptually be associated with the decl by the
reader. This includes comments, whitespace, and separators like ';'.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

show more ...


# b9d2bf38 06-Jan-2020 Yitzhak Mandelbaum <yitzhakm@google.com>

[libTooling] Fix bug in Stencil handling of macro ranges

Summary: Currently, an attempt to rewrite source code inside a macro expansion succeeds, but results in empty text, rather than failing with

[libTooling] Fix bug in Stencil handling of macro ranges

Summary: Currently, an attempt to rewrite source code inside a macro expansion succeeds, but results in empty text, rather than failing with an error. This patch restructures to the code to explicitly validate ranges before attempting to edit them.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

show more ...


Revision tags: llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1
# fbdf8352 10-Oct-2019 Yitzhak Mandelbaum <yitzhakm@google.com>

[libTooling] Move Transformer files to their own directory/library.

Summary:
The Transformer library has been growing inside of
lib/Tooling/Refactoring. However, it's not really related to anything

[libTooling] Move Transformer files to their own directory/library.

Summary:
The Transformer library has been growing inside of
lib/Tooling/Refactoring. However, it's not really related to anything else in
that directory. This revision moves all Transformer-related files into their own
include & lib directories. A followup revision will (temporarily) add
forwarding headers to help any users migrate their code to the new location.

Reviewers: gribozavr

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 374271

show more ...