This patch fixes:
clang-tools-extra/include-cleaner/lib/HTMLReport.cpp:240:51: error:
missing field 'Locations' initializer
[-Werror,-Wmissing-field-initializers]
The check has produced false positives when checking the default implementation of the spaceship operator.
The default implementation should be skipped by the check.
Modified the existing test so that the check runs into the bug without this fix and add another test case.
Fixes#53961.
Patch by Jens Massberg.
Reviewed By: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D138701
This change is focussed on simplifying `Support/Host.h` to only do
target detection. In this case, this function is close in usage to
existing functions in `Support/Threading.h`, so I moved it into there.
The function is also renamed to `llvm::get_physical_cores()` to match
the style of threading's functions.
Differential Revision: https://reviews.llvm.org/D137836
Targets and Refs are 1:1, so merge them.
Don't sort Refs array we keep indices into. (Currently we're done using
those indices by the time we sort, but this is fragile)
Demo: 7911d8251c/PathMapping.cpp.html
Header insertion doesn't actually work that well (not this patch's fault):
- we don't have ranking of locations/headers yet, so inserted header is pretty
random
- on my system, we get a lot of absolute "/usr/bin/../include/..." paths.
This is a HeaderSearch bug introduced in D60873 that I'll send a fix for
Differential Revision: https://reviews.llvm.org/D138676
For now, we decided not to add operator< or handle other variants.
(If we do so in future we may want to extract a base class).
Differential Revision: https://reviews.llvm.org/D138648
This patch replaces those occurrences of NoneType that would trigger
an error if the definition of NoneType were missing in None.h.
To keep this patch focused, I am deliberately not replacing None with
std::nullopt in this patch or updating comments. They will be
addressed in subsequent patches.
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
Differential Revision: https://reviews.llvm.org/D138539
Previously file naming and directory layout was handled on a per Info
object basis by ClangDocMain and the generators blindly wrote to the
files given. This means all generators must use the same file layout and
caused problems where multiple objects mapped to the same file. The
object collision problem happens most easily with template
specializations because the template parameters are not part of the
"name".
This patch moves the responsibility for output file organization to the
generators. Currently HTML and MD use the same structure as before. But
they now collect all objects that map to a given file and combine them,
avoiding the corruption problems.
Converts the YAML generator to naming files based on USR in one
directory. This is easier for downstream tools to manage and avoids
the naming problems with template specializations. Since this change
requires backward-incompatible output changes to referenced files anyway
(since each one is now an array), this is a good time to introduce this
change.
Differential Revision: https://reviews.llvm.org/D138073
... in semantic highlighting.
These specifiers cannot be identified by simple lexing (since e.g.
variables with these names can legally be declared), which means they
should be semantic tokens.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D137943
This is less plumbing and clutter in ClangdMain.cpp.
Having --check-lines imply completion was just about minimizing plumbing
I think, so make that explicit.
misc-const-correctness is so catastrophically slow that we need to block it
from running. But we need a way to detect this without breaking users first.
This is part of a plan to run only fast checks by default.
More details in https://github.com/clangd/clangd/issues/1337
Differential Revision: https://reviews.llvm.org/D136082
This is useful where tests previously encoded information in the name
names of ranges and points. Currently, this is pretty limited because
names consist of only alphanumeric characters and '_'.
With this patch, we can keep the names simple and attach optional
payloads to ranges and points instead.
The new syntax should be fully backwards compatible (if I haven't missed
anything). I tested this against clangd unit tests and everything still passes.
Differential Revision: https://reviews.llvm.org/D137909
And use it findHeaders. findHeaders now finds all header candidates
given a symbol location (these headers will be attached with proper
signals, in a followup patch).
Differential Revision: https://reviews.llvm.org/D137698
Make sure to use clang_target_link_libraries, which skips linking
against libraries and links against libclang-cpp instead, if
LLVM_LINK_LLVM_DYLIB is enabled.
This fixes errors like these:
ld.lld: error: duplicate symbol: clang::PPCallbacks::~PPCallbacks()
>>> defined at libclangLex.a(PPCallbacks.cpp.obj)
>>> defined at libclang-cpp.dll
Current version complains unused using-declaration even if the target
user-defined literal is used.
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D138204
We preserve decls for stdlib symbols after this patch in symbol. That
way we have a more unified view of stdlib and regular decls and can provide
reacher information in applications.
Differential Revision: https://reviews.llvm.org/D138134
Overrides are constrained by the signature of the overridden method, so a
warning on an override is frequently unactionable.
Differential Revision: https://reviews.llvm.org/D137968
We plan to reuse it in the include-cleaner library, this patch moves
this functionality from clangd to libtooling, so that this piece of code can be
shared among all clang tools.
Differential Revision: https://reviews.llvm.org/D137697
- replace SymbolLocation std::variant with enum-exposing version similar to
those in types.cpp. There's no appropriate implementation file, added
LocateSymbol.cpp in anticipation of locateDecl/locateMacro.
- FindHeaders is not part of the public Analysis interface, so should not
be implemented/tested there (just code organization)
- rename findIncludeHeaders->findHeaders to avoid confusion with Include concept
Differential Revision: https://reviews.llvm.org/D137825
This patch implements the initial version of "Location => Header" step:
- define the interface;
- integrate into the existing workflow, and use the PragmaIncludes;
Differential Revision: https://reviews.llvm.org/D137320
- add support to PragmaIncludes to handle IWYU export/begin_exports/end_exports
pragma;
- implement an API to retrieve the direct exporter headers;
Differential Revision: https://reviews.llvm.org/D137319