Summary:
When calling TUScehduler::runWithPreamble (e.g. in code compleiton), allow
entering a fallback mode when compile command or preamble is not ready, instead of
waiting. This allows clangd to perform naive code completion e.g. using identifiers
in the current file or symbols in the index.
This patch simply returns empty result for code completion in fallback mode. Identifier-based
plus more advanced index-based completion will be added in followup patches.
Reviewers: ilya-biryukov, sammccall
Reviewed By: sammccall
Subscribers: sammccall, javed.absar, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59811
llvm-svn: 357916
Requires making the llvm::MemoryBuffer* stored by SourceManager const,
which in turn requires making the accessors for that return const
llvm::MemoryBuffer*s and updating all call sites.
The original motivation for this was to use it and fix the TODO in
CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag
version of createFileID, and since llvm::SourceMgr* hands out a const
llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO
this way actually works, but this seems like a good change on its own
anyways.
No intended behavior change.
Differential Revision: https://reviews.llvm.org/D60247
llvm-svn: 357724
The CMake variable controlling if XPC code is built is called
CLANGD_BUILD_XPC but three places unintentionally checked the
non-existent variable CLANGD_BUILD_XPC_SUPPORT instead, which (due to
being nonexistent, and due to cmake) always silently evaluated to false.
Luckily the test still seems to pass, despite never running after being
added almost 3 months ago in r351280.
Differential Revision: https://reviews.llvm.org/D60120
llvm-svn: 357719
r357102 made clangd-fuzzer no longer compile, but before
r357654 / r357694 we didn't notice. Fix the compile.
Also add a dep on FuzzMutate which I forgot to do in r357654.
llvm-svn: 357696
This allows building it even if no fuzzer is enabled. (Sadly, it only
builds on Linux at the moment.)
Differential Revision: https://reviews.llvm.org/D60201
llvm-svn: 357654
Summary:
All in-tree clang-tidy checks have been migrated to the new
ClangTidyCheck::registerPPCallbacks method. Time to drop the old one.
Reviewers: sammccall, hokein
Reviewed By: hokein
Subscribers: xazax.hun, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60197
llvm-svn: 357582
This is a bit of a larger change since this is the first (and as far as
I can tell only) place where the LLVM build produces macOS framework
bundles.
GN has some built-in support for this, so use that.
`gn help create_bundle` has a terse description (but it's a bit
outdated: `deps` must be `public_deps` and the conditionals in the
example in the help aren't quite right on non-iOS).
We need a new 'copy_bundle_data' tool, and since we copy the clangd.xpc
bundle as bundle_data into ClangdXPC.framework it needs to be able to
handle directories in addition to files.
GN also insists we have a compile_xcassets tool even though it's not
used. I just made that run `false`.
Despite GN's support for bundles, we still need to manually create the
expected symlink structure in the .framework bundle. Since this code
never runs on Windows, it's safe to create the symlinks before the
symlink targets exist, so we can just make the bundle depend on the
steps that create the symlinks. For this to work, change the symlink
script to create the symlink's containing directory if it doesn't yet
exist.
I locally verified that CMake and GN build create the same bundle
structure. (I noticed that both builds set LC_ID_DYLIB to the pre-copy
libClangdXPCLib.dylib name, but that seems to not cause any issues and
it happens in the CMake build too.)
(Also add an error message to clangd-xpc-test-client for when loading
the dylib fails – this was useful while locally debugging this.)
Differential Revision: https://reviews.llvm.org/D60130
llvm-svn: 357574
Summary:
Instead of tooling::Replacement. To avoid the need to have contents of
the file at the caller site. This also aligns better with other methods
in ClangdServer, majority of those already return LSP-specific data
types.
Reviewers: hokein, ioeric, sammccall
Reviewed By: sammccall
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60179
llvm-svn: 357561
Summary: There's a typo in the docs, as mentioned in the title. Please see the diff.
Reviewers: JonasToth
Subscribers: sylvestre.ledru, nemanjai, kbarton, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D60050
llvm-svn: 357371
Fix the crash resulting from a careless use of getLocWithOffset. At the
beginning of a macro expansion it produces an invalid SourceLocation that causes
an assertion failure later on.
llvm-svn: 357312
Only runs the clang-tools-extra lit tests; not yet the unit tests.
Add a build file for clangd-indexer too, since it's needed for
the tests.
Differential Revision: https://reviews.llvm.org/D59955
llvm-svn: 357232
Summary:
- we don't record the warnings at all
- we don't want to stop indexing if we hit error-limit due to warnings
- this allows some analyses to be skipped which can save some CPU
https://github.com/clangd/clangd/issues/24
Reviewers: hokein
Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59935
llvm-svn: 357186
Enough to build the clangd binaries, but this is still missing build
files for:
- fuzzer
- indexer
- index/dex/dexp
- benchmarks
- xpc
Differential Revision: https://reviews.llvm.org/D59899
llvm-svn: 357182
Summary:
(Changes to UTF-8/UTF-16 here are NFC, moving things around to make the
cases more symmetrical)
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59927
llvm-svn: 357173
The Yaml module is missing on some systems and on many of clang buildbots.
But the test for run-clang-tidy.py doesn't fail due to 'NOT' statement masking a python runtime error.
This patch conditionally imports and enables the yaml module only if it's present in the system.
If not, then '-export-fixes' is disabled.
Differential Revision: https://reviews.llvm.org/D59734
llvm-svn: 357114
Summary:
Still some pieces to go here: unit tests for new SourceCode functionality and
a command-line flag to force utf-8 mode. But wanted to get early feedback.
Reviewers: hokein
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58275
llvm-svn: 357102
CHANGELOG:
- add an explicit command to activate the extension.
- support .cu files (the extension is not activated for .cu files by default,
you need to manually activate the extension).
llvm-svn: 357082
Summary:
This would help minizime the annoying part of not activating the extension
for .cu file.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59817
llvm-svn: 357075
FileManager constructs a VFS in its constructor if it isn't passed one,
and there's no way to reset it. Make that contract clear by returning a
reference from its accessor.
https://reviews.llvm.org/D59388
llvm-svn: 357038
Remove CompilerInstance::VirtualFileSystem and
CompilerInstance::setVirtualFileSystem, instead relying on the VFS in
the FileManager. CompilerInstance and its clients already went to some
trouble to make these match. Now they are guaranteed to match.
As part of this, I added a VFS parameter (defaults to nullptr) to
CompilerInstance::createFileManager, to avoid repeating construction
logic in clients that just wanted to customize the VFS.
https://reviews.llvm.org/D59377
llvm-svn: 357037
Summary:
clangd should be able to handle those with a proper compilation
database. However, users using 'nvcc' might start seeing spurious errors
in '.cu' files after this change.
My plan is to land and release this, but be ready to revert in
case of negative user feedback.
Reviewers: hokein
Reviewed By: hokein
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59759
llvm-svn: 356916
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
Summary:
This patch partially reverts the commit rL356849.
Unfortunately, tooling::createExecutorFromCommandLineArgs doesn't
corperate well with our internal infrastructure, which leads failing
lit tests. We use ClangTool at the moment, until we find a better
solution to smooth it.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59764
llvm-svn: 356893
Summary:
The LSP clients cannot know clangd will not send diagnostic updates
for closed files, so we send them an empty list of diagnostics to
avoid showing stale diagnostics for closed files in the UI, e.g. in the
"Problems" pane of VSCode.
Fixes PR41217.
Reviewers: hokein
Reviewed By: hokein
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59757
llvm-svn: 356880
Use InitLLVM and WithColor
Delete PPTraceConsumer, add the callback in PPTraceAction
Migrae to tooling::createExecutorFromCommandLineArgs
Don't specialize empty OutputFileName
llvm-svn: 356849
Summary:
Finally, we are here!
Analyzes OpenMP Structured Blocks and checks that no exception escapes
out of the Structured Block it was thrown in.
As per the OpenMP specification, structured block is an executable statement,
possibly compound, with a single entry at the top and a single exit at the
bottom. Which means, ``throw`` may not be used to to 'exit' out of the
structured block. If an exception is not caught in the same structured block
it was thrown in, the behaviour is undefined / implementation defined,
the program will likely terminate.
Reviewers: JonasToth, aaron.ballman, baloghadamsoftware, gribozavr
Reviewed By: aaron.ballman, gribozavr
Subscribers: mgorny, xazax.hun, rnkovacs, guansong, jdoerfert, cfe-commits, ABataev
Tags: #clang-tools-extra, #openmp, #clang
Differential Revision: https://reviews.llvm.org/D59466
llvm-svn: 356802