Age | Commit message (Collapse) | Author |
|
diagnostics. NFC
Summary:
Currently ClangTidyContext::diag() sends the diagnostics to a
DiagnosticsEngine, which probably delegates to a ClangTidyDiagnosticsConsumer,
which is supposed to go back and populate ClangTidyContext::Errors.
After this patch, the diagnostics are stored in the ClangTidyDiagnosticsConsumer
itself and can be retrieved from there.
Why?
- the round-trip from context -> engine -> consumer -> context is confusing
and makes it harder to establish layering between these things.
- context does too many things, and makes it hard to use clang-tidy as a library
- everyone who actually wants the diagnostics has access to the ClangTidyDiagnosticsConsumer
The most natural implementation (ClangTidyDiagnosticsConsumer::take()
finalizes diagnostics) causes a test failure: clang-tidy-run-with-database.cpp
asserts that clang-tidy exits successfully when trying to process a file
that doesn't exist.
In clang-tidy today, this happens because finish() is never called, so the
diagnostic is never flushed. This looks like a bug to me.
For now, this patch carefully preserves that behavior, but I'll ping the
authors to see whether it's deliberate and worth preserving.
Reviewers: hokein
Subscribers: xazax.hun, cfe-commits, alexfh
Differential Revision: https://reviews.llvm.org/D53953
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@345961 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This patch moves the virtual file system form clang to llvm so it can be
used by more projects.
Concretely the patch:
- Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support.
- Moves the corresponding unit test from clang to llvm.
- Moves the vfs namespace from clang::vfs to llvm::vfs.
- Formats the lines affected by this change, mostly this is the result of
the added llvm namespace.
RFC on the mailing list:
http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html
Differential revision: https://reviews.llvm.org/D52783
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@344140 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Continuation of D46504.
Example output:
```
$ clang-tidy -enable-check-profile -store-check-profile=. -checks=-*,readability-function-size source.cpp
$ # Note that there won't be timings table printed to the console.
$ cat *.json
{
"file": "/path/to/source.cpp",
"timestamp": "2018-05-16 16:13:18.717446360",
"profile": {
"time.clang-tidy.readability-function-size.wall": 1.0421266555786133e+00,
"time.clang-tidy.readability-function-size.user": 9.2088400000005421e-01,
"time.clang-tidy.readability-function-size.sys": 1.2418899999999974e-01
}
}
```
There are two arguments that control profile storage:
* `-store-check-profile=<prefix>`
By default reports are printed in tabulated format to stderr. When this option
is passed, these per-TU profiles are instead stored as JSON.
If the prefix is not an absolute path, it is considered to be relative to the
directory from where you have run :program:`clang-tidy`. All `.` and `..`
patterns in the path are collapsed, and symlinks are resolved.
Example:
Let's suppose you have a source file named `example.cpp`, located in
`/source` directory.
* If you specify `-store-check-profile=/tmp`, then the profile will be saved
to `/tmp/<timestamp>-example.cpp.json`
* If you run :program:`clang-tidy` from within `/foo` directory, and specify
`-store-check-profile=.`, then the profile will still be saved to
`/foo/<timestamp>-example.cpp.json`
Reviewers: alexfh, sbenza, george.karpenkov, NoQ, aaron.ballman
Reviewed By: alexfh, george.karpenkov, aaron.ballman
Subscribers: Quuxplusone, JonasToth, aaron.ballman, llvm-commits, rja, Eugene.Zelenko, xazax.hun, mgrang, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D46602
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@334101 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary: The alpha checkers can already be enabled using the clang driver, this allows them to be enabled using the clang-tidy as well. This can make it easier to test the alpha checkers with projects which already support the compile_commands.json. It will also allow more people to give feedback and patches about the alpha checkers since they can run it as part of clang tidy checks.
Reviewers: aaron.ballman, hokein, ilya-biryukov, alexfh, lebedev.ri, xbolva00
Reviewed By: aaron.ballman, alexfh, lebedev.ri, xbolva00
Subscribers: xbolva00, NoQ, dcoughlin, lebedev.ri, xazax.hun, cfe-commits
Patch by Paul Fultz II!
Differential Revision: https://reviews.llvm.org/D46159
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@332609 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@331805 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
As discussed in D45931, currently, profiling output of clang-tidy is somewhat not great.
It outputs one profile at the end of the execution, and that profile contains the data
from the last TU that was processed. So if the tool run on multiple TU's, the data is
not accumulated, it is simply discarded.
It would be nice to improve this.
This differential is the first step - make this profiling info per-TU,
and output it after the tool has finished processing each TU.
In particular, when `ClangTidyASTConsumer` destructor runs.
Next step will be to add a CSV (JSON?) printer to store said profiles under user-specified directory prefix.
Reviewers: alexfh, sbenza
Reviewed By: alexfh
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, mgrang, klimek, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D46504
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@331763 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
It allows to remap and override files and directories on disk when
running clang-tidy. The intended use case for the flag is running
standalone clang-tidy binary for IDE and editor integration.
Patch by Vladimir Plyashkun.
Reviewers: alexfh, benlangmuir, ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: ilya-biryukov, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D41535
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@323196 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@299649 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Add a field indicating the associated check for every replacement to the YAML
report generated with the '-export-fixes' option. Update
clang-apply-replacements to handle the new format.
Patch by Alpha Abdoulaye!
Differential revision: https://reviews.llvm.org/D26137
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@290893 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary: I came across an outstanding FIXME to make the format style customizable. Inspired by the include fixer, I added an new option `-style` to configure the fallback style in case no clang-format configuration file is found. The default remains "llvm".
Reviewers: Prazek, aaron.ballman, hokein, alexfh
Subscribers: cfe-commits, malcolm.parsons
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D27142
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@288258 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
clang/StaticAnalyzer/Checkers/Checkers.inc
Summary: Depends on D26310.
Reviewers: zaks.anna, hokein
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D26311
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@286219 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
The misc-argument-comment check now ignores leading and trailing underscores and
case. The new `StrictMode` local/global option can be used to switch back to
strict checking.
Add getLocalOrGlobal version for integral types, minor cleanups.
Reviewers: hokein, aaron.ballman
Subscribers: aaron.ballman, Prazek, cfe-commits
Differential Revision: https://reviews.llvm.org/D23135
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@277729 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@272994 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@262787 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary: * Add a `HeaderFileExtensions` check option in misc-definitions-in-headers, google-build-namespaces and google-global-names-in-headers.
Reviewers: aaron.ballman, alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D16113
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@259879 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Similar in format to the `-checks=` argument, this new `-warnings-as-errors=`
argument upgrades any warnings emitted by the former to errors.
http://reviews.llvm.org/D15528
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@257642 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
time disable UseNullptrCheck when not compiling in C++ mode, but still allow in C++11 mode since it's likely the user wishes to modernize their code.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246298 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246224 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
compiling in C++11 mode.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246209 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Some people have reasons to compile their .c files as C++ in some configurations
(e.g. for testing purposes), so just looking at LangOptions is not enough. This
patch disables the check on all .c files (and also for the headers included from
.c files).
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@237905 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@232031 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@231938 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
The patch was generated using this command:
$ clang-tidy/tool/run-clang-tidy.py -header-filter=.*clang-tidy.* -fix \
-checks=-*,llvm-header-guard clang-tidy.*
$ svn revert --recursive clangt-tidy/llvm/
(to revert a few buggy fixes)
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@231669 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Patch by Richard Thomson!
http://reviews.llvm.org/D7604
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@230490 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Add flag --enable-check-profile to clang-tidy.
It turns on per-matcher profiles in MatchFinder and prints a report to
stderr at the end.
Reviewers: alexfh
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D5937
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@220491 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Each check can implement readOptions and storeOptions methods to read
and store custom options. Each check's options are stored in a local namespace
to avoid name collisions and provide some sort of context to the user.
Reviewers: bkramer, klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5296
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217661 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
This adds a support for the .clang-tidy file reading using
FileOptionsProvider, -dump-config option, and changes tests to not depend on
default checks set.
Reviewers: klimek, bkramer, djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5186
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217155 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Allows gathering fixes and applying them with clang-apply-fixes.
Differential Revision: http://reviews.llvm.org/D5176
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217139 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
After post-commit review and community discussion, this seems like a
reasonable direction to continue, making ownership semantics explicit in
the source using the type system.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@215324 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Rename ChecksFilter to GlobList, as there's nothing specific to checks in it.
It's a rather generic way to represent sets of strings (or patterns), so it may
be used for something else in ClangTidy. The new name would not look strange
when used to filter other entities.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4806
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@214961 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This reverts commit r213308.
Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@213324 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@213308 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
This patch makes it possible for clang-tidy clients to provide
different options for different translation units. The option, which doesn't
make sense to be file-dependent, was moved to a separate ClangTidyGlobalOptions
struct. Added parsing of ClangTidyOptions.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3979
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@210260 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@209743 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
array. This simplifies usage of ClangTidyContext a bit and seems to be more
consistent.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3685
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@208407 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Also displays a hint to use -header-filter='.*' in case any warnings
are in non-user code. This will help discoverability of this option.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3621
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@208174 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
(workaround for bug 15599).
Reviewers: alexfh
Subscribers: jordan_rose, klimek, djasper, cfe-commits
Differential Revision: http://reviews.llvm.org/D3556
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@207652 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3544
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@207532 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
This patch implements filtering of clang-tidy diagnostic messages by
the check name, so that "clang-tidy -checks=^llvm-" won't output any clang
warnings, for example. This is also helpful to run specific static-analyzer
checks: static analyzer always needs core checks to be enabled, but the user may
be interested only in the checks he asked for.
This patch also exposes warning option names for built-in diagnostics. We need
to have a namespace for these names to avoid collisions and to allow convenient
filtering, so I prefix them with "-W". I'm not sure it's the best thing to do,
and maybe "W" or "clang-diagnostic-" or something like this would be better.
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D3121
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@204321 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This removes all references to OwningPtr, which should be fairly
undisruptive to out-of-tree projects since they are unlikely to use
clang-tools-extra as a library instead of a set of tools.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@203382 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
The goal is to make it possible for checks to emit diagnostics at levels
other than 'warning'.
Differential Revision: http://llvm-reviews.chandlerc.com/D2913
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@202668 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@202632 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2894
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@202392 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
It was calling the utility wrapper that now requires a constant string
following clang r200132. The StringRef version on DiagnosticIDs appears to have
been what was intended so change to that.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@200142 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Pass check names all the way from ClangTidyModule through
ClangTidyCheck and ClangTidyContext to ClangTidyError, and output it in
handleErrors. This allows to find mis-behaving check and disable it easily.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2534
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@199094 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
always produce as pretty of results as it does in LLVM and Clang, but
I don't mind and the value of having a single canonical ordering is very
high IMO.
Let me know if you spot really serious problems here.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@198703 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Made ClangTidyAction more slim and moved its declaration to header to
allow easy creation of Clang-tidy ASTConsumer. Don't derive from
clang::ento::AnalysisAction, use clang::ento::CreateAnalysisConsumer instead
(I'll propose making this function a part of a public API in a separate patch).
Use MultiplexConsumer instead of a custom class.
Don't re-filter checkers list for each TU.
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2481
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@198402 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Allow disabling checks by regex. By default, disable alpha.* checks,
that are not particularly good tested (e.g. IdempotentOperationChecker, see
http://llvm-reviews.chandlerc.com/D2427).
Fixed a bug, that would disable all analyzer checks, when using a regex more
strict, than 'clang-analyzer-', for example --checks='clang-analyzer-deadcode-'.
Added --list-checks to list all enabled checks. This is useful to test specific
values in --checks/--disable-checks.
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2444
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@197717 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This is implemented in a way that the current static analyzer
architecture allows, in the future we might want to revisit this.
With this change static analyzer checks are available from clang-tidy
by specifying -checks=clang-analyzer-<name>.
This change also fixes the use of the compilation database to allow
clang-tidy to be used like any other clang tool.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@194707 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
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
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@187345 91177308-0d34-0410-b5e6-96231b3b80d8
|