Instead of using CLANG_ENABLE_STATIC_ANALYZER for use of the
static analyzer in both clang and clang-tidy, add a second
toggle CLANG_TIDY_ENABLE_STATIC_ANALYZER.
This allows enabling the static analyzer in clang-tidy while
disabling it in clang.
Differential Revison: https://reviews.llvm.org/D87118
The clang-tidy-vs visual studio plugin in clang-tools-extra contains a
security vulnerability in the YamlDotNet package [1]. I posted to cfe-dev [2],
asking if there was anyone who was interested in updating the the plugin
to address the vulnerability. Reid mentioned that Zach (the original committer),
said that there's another plugin (Clang Power Tools) that provides clang-tidy support,
with additional extra features, so it would be ok to remove clang-tidy-vs.
This commit removes the plugin to address the security vulnerability, and adds
a section to the release notes that mentions that the plugin was removed, and
suggests to use Clang Power Tools.
Fixes PR 41791.
[1]: https://nvd.nist.gov/vuln/detail/CVE-2018-1000210
[2]: http://lists.llvm.org/pipermail/cfe-dev/2019-August/063196.html
Differential Revision: https://reviews.llvm.org/D66813
llvm-svn: 370096
Summary:
Motivation:
- this layout is a pain to work with
- without a common root, it's painful to express things like "disable clangd" (D61122)
- CMake/lit configs are a maintenance hazard, and the more the one-off hacks
for various tools are entangled, the more we see apathy and non-ownership.
This attempts to use the bare-minimum configuration needed (while still
supporting the difficult cases: windows, standalone clang build, dynamic libs).
In particular the lit.cfg.py and lit.site.cfg.py.in are merged into lit.cfg.in.
The logic in these files is now minimal.
(Much of clang-tools-extra's lit configs can probably be cleaned up by reusing
lit.llvm.llvm_config.use_clang(), and every llvm project does its own version of
LDPATH mangling. I haven't attempted to fix any of those).
Docs are still in clang-tools-extra/docs, I don't have any plans to touch those.
Reviewers: gribozavr
Subscribers: mgorny, javed.absar, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits, ilya-biryukov, thakis
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61187
llvm-svn: 359424
Makes the name of this directory consistent with the names of the other
directories in clang-tools-extra.
Similar to r356254. No intended behavior change.
Differential Revision: https://reviews.llvm.org/D59750
llvm-svn: 356897
Makes the name of this directory consistent with the names of the other
directories in clang-tools-extra.
Differential Revision: https://reviews.llvm.org/D59382
llvm-svn: 356254
- New transport layer for macOS.
- XPC Framework
- Test client
Framework and client were written by Alex Lorenz.
Differential Revision: https://reviews.llvm.org/D54428
llvm-svn: 351280
Conditionally compile the parts of clang-tidy which depend on the static
analyzer.
Funnily enough, I made the patch to exclude this from the build in 2013,
and it was committed with the comment that the tool should not be fully
excluded, but only the parts of it which depend on the analyzer should
be excluded.
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130617/081797.html
This commit implements that idea.
Reviewed By: aaron.ballman
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D52334
llvm-svn: 343528
Setting up the mapper part of the frontend framework for a clang-doc
tool. It creates a series of relevant matchers for declarations, and
uses the ToolExecutor to traverse the AST and extract the matching
declarations and comments. The mapper serializes the extracted
information to individual records for reducing and eventually doc
generation.
For a more detailed overview of the tool, see the design document on the
mailing list: http://lists.llvm.org/pipermail/cfe-dev/2017-December/056203.html
Differential Revision: https://reviews.llvm.org/D41102
llvm-svn: 327102
Support running the extra clang tool tests when the static analyzer
is disabled. Disable the relevant clang-tidy tests and one include-fixer
test that require it to work.
Previously, the tests were disabled entirely with
CLANG_ENABLE_STATIC_ANALYZER being false. Now, the tests are being
enabled and the relevant tests are excluded and marked unsupported
appropriately.
In order to disable clang-tidy tests, the whole test directory is added
to the exclude lists, to avoid having to explicitly add 'REQUIRES' line
to every single test. If the other solution is preferable, I can update
the patch.
The yamldb_plugin include-fixer test is also updated to be disabled
without static analyzer. It fails in that case because clang is not
outputting a replacement suggestion -- but I don't know the exact
reason why it does not do that.
Differential Revision: https://reviews.llvm.org/D37188
llvm-svn: 311983
clangd is a language server protocol implementation based on clang. It's
supposed to provide editor integration while not suffering from the
confined ABI of libclang.
This implementation is limited to the bare minimum functionality of
doing (whole-document) formatting and rangeFormatting. The JSON parsing
is based on LLVM's YAMLParser but yet most of the code of clangd is
currently dealing with JSON serialization and deserialization.
This was only tested with VS Code so far, mileage with other LSP clients
may vary.
Differential Revision: https://reviews.llvm.org/D29451
llvm-svn: 294291
Summary:
This patch introduces a new tool which moves a specific class definition
from files (.h, .cc) to new files (.h, .cc), which mostly acts like
"Extract class defintion". In the long term, this tool should be
merged in to clang-refactoring as a subtool.
clang-move not only moves class definition, but also moves all the
forward declarations, functions defined in anonymous namespace and #include
headers to new files, to make sure the new files are compliable as much
as possible.
To move `Foo` from old.[h/cc] to new.[h/cc], use:
```
clang-move -name=Foo -old_header=old.h -old_cc=old.cc -new_header=new.h
-new_cc=new.cc old.cc
```
To move `Foo` from old.h to new.h, use:
```
clang-move -name=Foo -old_header=old.h -new_header=new.h old.cc
```
Reviewers: klimek, djasper, ioeric
Subscribers: mgorny, beanz, Eugene.Zelenko, bkramer, omtcyfz, cfe-commits
Differential Revision: https://reviews.llvm.org/D24243
llvm-svn: 282070
Summary:
A tool for changing surrouding namespaces of class/function definitions while keeping
references to types in the changed namespace correctly qualified by prepending
namespace specifiers before them.
Example: test.cc
namespace na {
class X {};
namespace nb {
class Y { X x; };
} // namespace nb
} // namespace na
To move the definition of class Y from namespace "na::nb" to "x::y", run:
clang-change-namespace --old_namespace "na::nb" \
--new_namespace "x::y" --file_pattern "test.cc" test.cc --
Output:
namespace na {
class X {};
} // namespace na
namespace x {
namespace y {
class Y { na::X x; };
} // namespace y
} // namespace x
Reviewers: alexfh, omtcyfz, hokein
Subscribers: mgorny, klimek, djasper, beanz, alexshap, Eugene.Zelenko, cfe-commits
Differential Revision: https://reviews.llvm.org/D24183
llvm-svn: 281918
For now this only adds the UI necessary to configure clang-tidy
settings graphically, and it enables reading in and saving out
of .clang-tidy files. It does not actually run clang-tidy on
any source files yet.
Differential Revision: https://reviews.llvm.org/D23848
llvm-svn: 280840
This diff adds v0 of clang-reorder-fields tool to clang/tools/extra.
The main idea behind this tool is to simplify and make less error-prone refactoring of large codebases when
someone needs to change the order fields of a struct/class (for example to remove excessive padding).
Differential revision: https://reviews.llvm.org/D23279
llvm-svn: 280456
This diff adds v0 of clang-reorder-fields tool to clang/tools/extra.
The main idea behind this tool is to simplify and make less error-prone refactoring of large codebases when
someone needs to change the order fields of a struct/class (for example to remove excess padding).
Differential revision: https://reviews.llvm.org/D23279
llvm-svn: 280431
Summary:
The goal of this tool is fairly simple, look up unknown identifiers in a
global database and add the corresponding #include line. It accomplishes
this by hooking into Sema as an ExternalSemaSource and responding to typo
correction callbacks. This means we can see the unknown identifier before
it's being munged by error recovery.
This doesn't work perfectly yet as some typo corrections don't emit
callbacks (delayed typos), but I think this is fixable. We also handle
only one include at a time as this is meant to be run directly from
the editing environment eventually. Adding multiple includes at the same
time is tricky because of error recovery.
This version only has a a dummy database, so all you can do is fixing
missing includes of <string>, but the indexer to build a database will
follow soon.
Reviewers: djasper
Subscribers: ioeric, hokein, cfe-commits
Differential Revision: http://reviews.llvm.org/D19314
llvm-svn: 266870
Summary:
clang-modernize transforms have moved to clang-tidy. Removing
the old tool now.
Reviewers: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D15606
llvm-svn: 255886
Summary:
Note that this code is still grossly under-tested - the next steps will
be to add significantly better test coverage.
Patch by Matthew Plant.
Test Plan:
Reviewers:
Subscribers:
llvm-svn: 215839
This tool is for interactive exploration of the Clang AST using AST matchers.
It currently allows the user to enter a matcher at an interactive prompt
and view the resulting bindings as diagnostics, AST pretty prints or AST
dumps. Example session:
$ cat foo.c
void foo(void) {}
$ clang-query foo.c --
clang-query> match functionDecl()
Match #1:
foo.c:1:1: note: "root" binds here
void foo(void) {}
^~~~~~~~~~~~~~~~~
1 match.
Differential Revision: http://llvm-reviews.chandlerc.com/D2098
llvm-svn: 194227
There is no reason to expect this tool to be limited to C++11, it seems
very likely to be of on-going interest. It seems likely to be useful for
modernizing even as new libraries come out in TSes and other formats
than a complete standard. Fundamentally, we need something a bit more
general. After some discussion on the list, going with
'clang-modernize'.
I've tried to do a reasonably comprehensive job of fixing up the names,
but I may still have missed some. Feel free to poke me if you spot any
fallout here. Things I've tried reasonably hard to find and fix:
- cpp11-migrate -> clang-modernize
- Migrator -> Modernizer
- Clean up the introductory documentation that was C++11 specific.
I'll also point out that this tool continues to delight me. =] Also,
a huge thanks to those who have so carefully, thoroughly documented the
tool. The docs here are simply phenomenal. Every tool should be this
well documented. I hope I have updated the documentation reasonably
well, but I'm not very good at documentation, so review much
appreciated.
llvm-svn: 189960
Made changes throughout clang-tools-extra for the renaming of
clang-replace to clang-apply-replacements as per feedback from
community.
llvm-svn: 189832
Introducing new tool 'clang-replace' that finds files containing
serialized Replacements and applies those changes after deduplication
and detecting conflicts.
Currently the tool does not apply changes. It stops just after the
deduplication and conflict report phase. Forthcoming patches will
complete functionality.
Both build systems updated for new tool.
Includes a conflict test case.
clang-replace added to Doxygen build.
Differential Revision: http://llvm-reviews.chandlerc.com/D1424
llvm-svn: 189008
This is the first version of a possible clang-tidy architecture. The
purpose of clang-tidy is to detect errors in adhering to common coding
patterns, e.g. described in the LLVM Coding Standards.
This is still heavily in flux.
Review: http://llvm-reviews.chandlerc.com/D884
llvm-svn: 187345
Added support to CMake and autoconf for unit tests in clang-tools-extra. A
dummy test exists for now until more meaningful tests can be written.
llvm-svn: 178661