Summary:
Finds OpenMP directives that are allowed to contain `default` clause,
but either don't specify it, or the clause is specified but with the kind
other than `none`, and suggests to use `default(none)` clause.
Using `default(none)` clause changes the default variable visibility from
being implicitly determined, and thus forces developer to be explicit about the
desired data scoping for each variable.
Reviewers: JonasToth, aaron.ballman, xazax.hun, hokein, gribozavr
Reviewed By: JonasToth, aaron.ballman
Subscribers: jdoerfert, openmp-commits, klimek, sbenza, arphaman, Eugene.Zelenko, ABataev, mgorny, rnkovacs, guansong, cfe-commits
Tags: #clang-tools-extra, #openmp, #clang
Differential Revision: https://reviews.llvm.org/D57113
llvm-svn: 356801
Summary:
D59466 wants to analyse the `Stmt`, and `ExceptionEscapeCheck` does not
have that as a possible entry point.
This simplifies addition of `Stmt` analysis entry point.
Reviewers: baloghadamsoftware, JonasToth, gribozavr
Reviewed By: gribozavr
Subscribers: rnkovacs, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D59650
llvm-svn: 356799
In all the other clang-foo tools, the main library file is called
Foo.cpp and the file in the tool/ folder is called ClangFoo.cpp.
Do this for clang-move too.
No intended behavior change.
Differential Revision: https://reviews.llvm.org/D59700
llvm-svn: 356780
Rename the Preprocessor field to fix the
declaration of ‘std::unique_ptr<clang::Preprocessor> clang::tooling::ExpandModularHeadersPPCallbacks::Preprocessor’ changes the meaning of ‘Preprocessor’ from ‘class clang::Preprocessor’ [-fpermissive]
warning.
llvm-svn: 356756
Summary:
Add a way to expand modular headers for PPCallbacks. Checks can opt-in for this
expansion by overriding the new registerPPCallbacks virtual method and
registering their PPCallbacks in the preprocessor created for this specific
purpose.
Use module expansion in the readability-identifier-naming check
Reviewers: gribozavr, usaxena95, sammccall
Reviewed By: gribozavr
Subscribers: nemanjai, mgorny, xazax.hun, kbarton, jdoerfert, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59528
llvm-svn: 356750
[clang-tidy] Parallelize clang-tidy-diff.py
This patch has 2 rationales:
- large patches lead to long command lines and often cause max command line length restrictions imposed by OS;
- clang-tidy runs on modified files are independent and can be done in parallel, the same as done for run-clang-tidy.
Differential Revision: https://reviews.llvm.org/D5766
llvm-svn: 356649
Summary:
In contrast to Google C++, Objective-C often uses built-in integer types
other than `int`. In fact, the Objective-C runtime itself defines the
types NSInteger¹ and NSUInteger² which are variant types depending on
the target architecture. The Objective-C style guide indicates that
usage of system types with variant sizes is appropriate when handling
values provided by system interfaces³. Objective-C++ is commonly the
result of conversion from Objective-C to Objective-C++ for the purpose
of integrating C++ functionality. The opposite of Objective-C++ being
used to expose Objective-C functionality to C++ is less common,
potentially because Objective-C has a signficantly more uneven presence
on different platforms compared to C++. This generally predisposes
Objective-C++ to commonly being more Objective-C than C++. Forcing
Objective-C++ developers to perform conversions between variant system types
and fixed size integer types depending on target architecture when
Objective-C++ commonly uses variant system types from Objective-C is
likely to lead to more bugs and overhead than benefit. For that reason,
this change proposes to disable google-runtime-int in Objective-C++.
[1] https://developer.apple.com/documentation/objectivec/nsinteger?language=objc
[2] https://developer.apple.com/documentation/objectivec/nsuinteger?language=objc
[3] "Types long, NSInteger, NSUInteger, and CGFloat vary in size between
32- and 64-bit builds. Use of these types is appropriate when handling
values exposed by system interfaces, but they should be avoided for most
other computations."
https://github.com/google/styleguide/blob/gh-pages/objcguide.md#types-with-inconsistent-sizes
Subscribers: xazax.hun, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59336
llvm-svn: 356627
[clang-tidy] Parallelize clang-tidy-diff.py
This patch has 2 rationales:
- large patches lead to long command lines and often cause max command line length restrictions imposed by OS;
- clang-tidy runs on modified files are independent and can be done in parallel, the same as done for run-clang-tidy.
Differential Revision: https://reviews.llvm.org/D57662
llvm-svn: 356565
This patch has 2 rationales:
- large patches lead to long command lines and often cause max command line length restrictions imposed by OS;
- clang-tidy runs on modified files are independent and can be done in parallel, the same as done for run-clang-tidy.
Differential Revision: https://reviews.llvm.org/D57662
llvm-svn: 356547
Summary:
-ignore specifies a list of PP callbacks to ignore. It cannot express a
whitelist, which may be more useful than a blacklist.
Add a new option -callbacks to replace it.
-ignore= (default) => -callbacks='*' (default)
-ignore=FileChanged,FileSkipped => -callbacks='*,-FileChanged,-FileSkipped'
-callbacks='Macro*' : print only MacroDefined,MacroExpands,MacroUndefined,...
Reviewers: juliehockett, aaron.ballman, alexfh, ioeric
Reviewed By: aaron.ballman
Subscribers: nemanjai, kbarton, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59296
llvm-svn: 356366
Summary:
To reduce the gap between prefix and initialism matches.
The motivation is producing better scoring in one particular example,
but the change does not seem to cause large regressions in other cases.
The examples is matching 'up' against 'unique_ptr' and 'upper_bound'.
Before the change, we had:
- "[u]nique_[p]tr" with a score of 0.3,
- "[up]per_bound" with a score of 1.0.
A 3x difference meant that symbol quality signals were almost always ignored
and 'upper_bound' was always ranked higher.
However, intuitively, the match scores should be very close for the two.
After the change we have the following scores:
- "[u]nique_[p]tr" with a score of 0.75,
- "[up]per_bound" with a score of 1.0.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59300
llvm-svn: 356261
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
__pragma(execution_character_set(push, "UTF-8")) is used in
TraceLoggingProvider.h. This commit implements a no-op handler for
compatability, similar to how the flag -fexec_charset is handled.
Patch by Matt Gardner!
Differential Revision: https://reviews.llvm.org/D58530
llvm-svn: 356185
Summary:
Using suffix path mapping relies on the STL implementations, and it is
not portable. This patch is using symbol name mapping, which should
work with different STL implementations, fixclangd/clangd#9.
To generate the symbol mapping, we parse the cppreference symbol index
page to build a lookup table.
The mapping is not completed, a few TODOs:
- support symbols from different headers (e.g. std::move)
- support STL macros
- support symbols from std's sub-namespaces (e.g. chrono)
Reviewers: ioeric, jfb, serge-sans-paille
Reviewed By: ioeric
Subscribers: sammccall, klimek, ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, kadircet, jfb, jdoerfert, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D58345
llvm-svn: 356134
Summary:
Currently after loadding all shards, we use MemIndex which has poor query
performance, we should use Dex.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59350
llvm-svn: 356126
Summary:
This introduces ~4k new symbols, and ~10k refs for LLVM. We need that
information for providing better code navigation support:
- When references for a class template is requested, we should return these specializations as well.
- When children of a specialization is requested, we should be able to query for those symbols(instead of just class template)
Number of symbols: 378574 -> 382784
Number of refs: 5098857 -> 5110689
Reviewers: hokein, gribozavr
Reviewed By: gribozavr
Subscribers: nridge, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59083
llvm-svn: 356125
Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010
Code like:
```
if(true) var++;
else {
var--;
}
```
is reformatted to be
```
if (true)
var++;
else {
var--;
}
```
Even when `AllowShortIfStatementsOnASingleLine` is true
The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine
This suppresses the clause prevents the merging of the if when there is a compound else
Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087
llvm-svn: 356029
This is an analog of the abseil-duration-comparison check, but for the
absl::Time domain. It has a similar implementation and tests.
Differential Revision: https://reviews.llvm.org/D58977
llvm-svn: 355835
Summary:
Currently createStaticIndexingAction always set Origin to Static, which
makes it hard to change it later on by different indexers(One needs to go over
each symbol making a new copy).
This patch changes that behavior to rather respect it if set by user.
Reviewers: ioeric
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59205
llvm-svn: 355820
Summary:
Currently, we only do deduplication when we flush final results. We may
have huge duplications (refs from headers) during the indexing period (running
clangd-indexer on Chromium).
With this change, clangd-indexer can index the whole chromium projects
(48 threads, 40 GB peak memory usage).
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59092
llvm-svn: 355676
Summary:
As can be seen in https://github.com/llvm-mirror/clang/blob/master/lib/Tooling/Tooling.cpp#L385
clang tool invocations adjust commands normally like this. In clangd we have
different code paths for invoking a frontend action(preamble builds, ast builds,
background index, clangd-indexer) they all work on the same GlobalCompilationDatabase
abstraction, but later on are subject to different modifications.
This patch makes sure all of the clangd actions make use of the same compile
commands before invocation.
Enables background-index to work on chromium codebase(since they had dependency
file output in their compile commands).
Reviewers: gribozavr, hokein
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59086
llvm-svn: 355669
Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].
I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.
[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html
Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille
Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits
Tags: #clang, #sanitizers, #lldb, #openmp, #llvm
Differential Revision: https://reviews.llvm.org/D58791
llvm-svn: 355340
Summary:
The usefulness of **modernize-use-override** can be reduced if you have to live in an environment where you support multiple compilers, some of which sadly are not yet fully C++11 compliant
some codebases have to use override as a macro OVERRIDE e.g.
```
// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled.
```
This allows code to be compiled with C++11 compliant compilers and get warnings and errors that clang, MSVC,gcc can give, while still allowing other legacy pre C++11 compilers to compile the code. This can be an important step towards modernizing C++ code whilst living in a legacy codebase.
When it comes to clang tidy, the use of the **modernize-use-override** is one of the most useful checks, but the messages reported are inaccurate for that codebase if the standard approach is to use the macros OVERRIDE and/or FINAL.
When combined with fix-its that introduce the C++11 override keyword, they become fatal, resulting in the modernize-use-override check being turned off to prevent the introduction of such errors.
This revision, allows the possibility for the replacement **override **to be a macro instead, Allowing the clang-tidy check to be run on both pre and post C++11 code, and allowing fix-its to be applied.
Reviewers: alexfh, JonasToth, hokein, Eugene.Zelenko, aaron.ballman
Reviewed By: alexfh, JonasToth
Subscribers: lewmpk, malcolm.parsons, jdoerfert, xazax.hun, cfe-commits, llvm-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D57087
llvm-svn: 355132
Summary: Detect a few expressions as likely character expressions, see PR27723.
Reviewers: xazax.hun, alexfh
Subscribers: rnkovacs, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58609
llvm-svn: 355089
Summary:
The text was written mostly by Sam McCall, screenshots are mostly made
by me.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58710
llvm-svn: 354992
Summary:
Suppose `clangd::` is unresolved in the following example. Currently,
we simply use "clangd::" as the query scope. We can do better by combining with
accessible scopes in the context. The query scopes can be `{clangd::, clang::clangd::}`.
```
namespace clang { clangd::^ }
```
Reviewers: ilya-biryukov, sammccall, hokein, kadircet
Reviewed By: kadircet
Subscribers: MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58448
llvm-svn: 354963
Summary:
D58340 enables indexing of USRs, this makes sure test in clangd are
aligned with the change
Reviewers: hokein
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58341
llvm-svn: 354879
Summary:
This is a further optimization of r350803, we drop docs in static index for
symbols not being indexed for completion, while keeping the docs in dynamic
index (we rely on dynamic index to get docs for class members).
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D56539
llvm-svn: 354792
Summary:
We are less certain it is the correct fix. Also, clang doesn't apply FixIt to
the source code in macro.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58525
llvm-svn: 354664
Summary:
Clangd was reporting implicit symbols, like results of implicit cast
expressions during code navigation, which is not desired. For example:
```
struct Foo{ Foo(int); };
void bar(Foo);
vod foo() {
int x;
bar(^x);
}
```
Performing a GoTo on the point specified by ^ would give two results one
pointing to line `int x` and the other for definition of `Foo(int);`
Reviewers: ilya-biryukov, sammccall
Subscribers: ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58495
llvm-svn: 354585
Summary:
Implicit functions are outside the control of source authors and should
be exempt from style restrictions.
Tested via running clang tools tests.
This is an amended followup to https://reviews.llvm.org/D57207
Reviewers: aaron.ballman
Reviewed By: aaron.ballman
Subscribers: jdoerfert, xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58095
llvm-svn: 354534
Summary:
The analsis on the throwing behvaiour on functions and statements gave only
a binary answer whether an exception could occur and if yes which types are
thrown.
This refactoring allows keeping track if there is a unknown factor, because the
code calls to some functions with unavailable source code with no `noexcept`
information.
This 'potential Unknown' information is propagated properly and can be queried
separately.
Reviewers: lebedev.ri, aaron.ballman, baloghadamsoftware, alexfh
Reviewed By: lebedev.ri, baloghadamsoftware
Subscribers: xazax.hun, rnkovacs, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57883
llvm-svn: 354517
Summary:
The assertion checking that a range of a node is a token range does
not hold in case of "split" tokens, e.g. between two closing template
argument lists (`vector<vector<int>>`).
Reviewers: kadircet, sammccall
Reviewed By: kadircet
Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58447
llvm-svn: 354507
Summary: To take up the .clangd folder for other potential uses in the future.
Reviewers: kadircet, sammccall
Reviewed By: kadircet
Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58440
llvm-svn: 354505