1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

24 Commits

Author SHA1 Message Date
Sam McCall
efc0ed79a2 [clangd] Implement semanticTokens modifiers
- Infrastructure to support modifiers (protocol etc)
- standard modifiers:
  - declaration (but no definition, yet)
  - deprecated
  - readonly (based on a fairly fuzzy const checking)
  - static (for class members and locals, but *not* file-scope things!)
  - abstract (for C++ classes, and pure-virtual methods)
- nonstandard modifier:
  - deduced (on "auto" whose Kind is Class etc)
    Happy to drop this if it's controversial at all.
- While here, update sample tweak to use our internal names, in
  anticipation of theia TM scopes going away.

This addresses some of the goals of D77702, but leaves some things undone.
Mostly because I think these will want some discussion.
 - no split between dependent type/name.
   (We may want to model this as a modifier, type+dependent vs ???+dependent)
 - no split between primitive/typedef.
   (Is introducing a nonstandard kind is worth this distinction?)
 - no nonstandard local attribute
   This probably makes sense, I'm wondering if we want others and how
   they fit together.

There's one minor regression in explicit template specialization declarations
due to a latent bug in findExplicitReferences, but fixing it after seems OK.

Differential Revision: https://reviews.llvm.org/D77811
2021-02-09 16:31:22 +01:00
Nathan James
0973aff95b [llvm][NFC] Remove unnecessary vector creation in Annotations 2020-11-14 15:55:09 +00:00
serge-sans-paille
82b6e6053d llvmbuildectomy - replace llvm-build by plain cmake
No longer rely on an external tool to build the llvm component layout.

Instead, leverage the existing `add_llvm_componentlibrary` cmake function and
introduce `add_llvm_component_group` to accurately describe component behavior.

These function store extra properties in the created targets. These properties
are processed once all components are defined to resolve library dependencies
and produce the header expected by llvm-config.

Differential Revision: https://reviews.llvm.org/D90848
2020-11-13 10:35:24 +01:00
Pavel Labath
e258c2d84b [cmake] Make gtest include directories a part of the library interface
This applies the same fix that D84748 did for macro definitions.
Appropriate include path is now automatically set for all libraries
which link against gtest targets, which avoids the need to set
include_directories in various parts of the project.

Differential Revision: https://reviews.llvm.org/D86616
2020-08-27 15:35:57 +02:00
Pavel Labath
336dae54b1 [cmake] Make gtest macro definitions a part the library interface
These definitions are needed by any file which uses gtest. Previously we
were adding them in the add_unittest function, but over time we've
accumulated libraries (which don't go through add_unittest) building on
gtest and this has resulted in proliferation of the definitions.

Making this a part of the library interface enables them to be managed
centrally. This follows a patch for -Wno-suggest-override (D84554) which
took a similar approach.

Differential Revision: https://reviews.llvm.org/D84748
2020-08-11 15:22:44 +02:00
Logan Smith
78dc495935 Use INTERFACE_COMPILE_OPTIONS to disable -Wsuggest-override for any target that links to gtest
This cleans up several CMakeLists.txt's where -Wno-suggest-override was manually specified. These test targets now inherit this flag from the gtest target.

Some unittests CMakeLists.txt's, in particular Flang and LLDB, are not touched by this patch. Flang manually adds the gtest sources itself in some configurations, rather than linking to LLVM's gtest target, so this fix would be insufficient to cover those cases. Similarly, LLDB has subdirectories that manually add the gtest headers to their include path without linking to the gtest target, so those subdirectories still need -Wno-suggest-override to be manually specified to compile without warnings.

Differential Revision: https://reviews.llvm.org/D84554
2020-07-27 08:37:01 -07:00
Logan Smith
c2132beee1 Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
add_compile_options is more sensitive to its location in the file than add_definitions--it only takes effect for sources that are added after it. This updated patch ensures that the add_compile_options is done before adding any source files that depend on it.

Using add_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 17:50:19 -07:00
Logan Smith
ac8397cecf Revert "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
This reverts commit 388c9fb1af48b059d8b65cb2e002e0992d147aa5.
2020-07-22 15:07:01 -07:00
Logan Smith
d8f0eb5cfe Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories.
Using add_compile_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 14:19:34 -07:00
Hans Wennborg
26292a58c9 Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.
After lots of follow-up fixes, there are still problems, such as
-Wno-suggest-override getting passed to the Windows Resource Compiler
because it was added with add_definitions in the CMake file.

Rather than piling on another fix, let's revert so this can be re-landed
when there's a proper fix.

This reverts commit 21c0b4c1e8d6a171899b31d072a47dac27258fc5.
This reverts commit 81d68ad27b29b1e6bc93807c6e42b14e9a77eade.
This reverts commit a361aa5249856e333a373df90947dabf34cd6aab.
This reverts commit fa42b7cf2949802ff0b8a63a2e111a2a68711067.
This reverts commit 955f87f947fda3072a69b0b00ca83c1f6a0566f6.
This reverts commit 8b16e45f66e24e4c10e2cea1b70d2b85a7ce64d5.
This reverts commit 308a127a38d1111f3940420b98ff45fc1c17715f.
This reverts commit 274b6b0c7a8b584662595762eaeff57d61c6807f.
This reverts commit 1c7037a2a5576d0bb083db10ad947a8308e61f65.
2020-07-22 20:23:58 +02:00
Logan Smith
038f81782a [llvm][unittest] Add -Wno-suggest-override to more infrastructure that includes googletest/googlemock headers 2020-07-20 13:59:39 -07:00
Ilya Biryukov
8c502c592b [Testing] Move clangd::Annotations to llvm testing support
Summary:
Annotations allow writing nice-looking unit test code when one needs
access to locations from the source code, e.g. running code completion
at particular offsets in a file. See comments in Annotations.cpp for
more details on the API.

Also got rid of a duplicate annotations parsing code in clang's code
complete tests.

Reviewers: gribozavr, sammccall

Reviewed By: gribozavr

Subscribers: mgorny, hiraditya, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D59814

llvm-svn: 359179
2019-04-25 10:08:31 +00:00
Chandler Carruth
ae65e281f3 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Zachary Turner
519caed47d Fix error with SmallString implicit conversion.
llvm-svn: 341597
2018-09-06 22:47:32 +00:00
Zachary Turner
9454b327ad Fix a configure issue with Visual Studio generators.
We can't put the unittest source dir map in the configuration
specific directory because VS doesn't have a configure-specific
directory, instead it only knows this at runtime.  So we have
to remove this from the path.  This in turn means that the path
will be slightly different in VS configurations vs non vs
configurations.  In the former, the source map will be in the
parent directory of the executable, and in the latter it will
be in the same directory as the executable.  So check both.

llvm-svn: 341590
2018-09-06 22:00:38 +00:00
Fangrui Song
8d4e05f4f6 Quick fix for -DBUILD_SHARED_LIBS=on build after rL341502
libLLVMTestingSupport.so references a symbol in utils/unittest/UnitTestMain/TestMain.cpp (a layering issue) and will cause a link error because of -Wl,-z,defs (cmake/modules/HandleLLVMOptions.cmake)

Waiting zturner for a better fix.

llvm-svn: 341580
2018-09-06 19:51:20 +00:00
Zachary Turner
70d3512e38 Fix some warnings.
llvm-svn: 341508
2018-09-06 00:06:20 +00:00
Zachary Turner
910d9dfcf8 Fix silly error in unittest helper.
llvm-svn: 341505
2018-09-05 23:45:48 +00:00
Zachary Turner
8f68390df4 Add support for unittest inputs.
Occasionally it is useful to have unittest which take inputs.
While we normally try to have this test be more of a lit test
we occasionally don't have tools that can exercise the code
in the right way to test certain things.  LLDB has been using
this style of unit test for a while, particularly with regards
to how it tests core dump and minidump file parsing.  Recently
i needed this as well for the case where we want to test that
some of the PDB reading code works correctly.  It needs to
exercise the code in a way that is not covered by any dumper
and would be impractical to implement in one of the dumpers,
but requires a valid PDB file.  Since this is now needed by
more than one project, it makes sense to have this be a
generally supported thing that unit tests can do, and we just
encourage people to use this sparingly.

Differential Revision: https://reviews.llvm.org/D51561

llvm-svn: 341502
2018-09-05 23:30:17 +00:00
Michal Gorny
e1be48589a [LLVMTestingSupport] Add explicit linkage to LLVMSupport
Explicitly link LLVMTestingSupport library against LLVMSupport. This
is necessary to fix linking errors when LLVMTestingSupport is built
as a shared library (with BUILD_SHARED_LIBS=ON) and -Wl,-z,defs is used.

Differential Revision: https://reviews.llvm.org/D45408

llvm-svn: 329522
2018-04-08 06:49:17 +00:00
Pavel Labath
fa2992679a [Testing/Support]: Better matching of Error failure states
Summary:
The existing Failed() matcher only allowed asserting that the operation
failed, but it was not possible to verify any details of the returned
error.

This patch adds two new matchers, which make this possible:
- Failed<InfoT>() verifies that the operation failed with a single error
  of a given type.
- Failed<InfoT>(M) additionally check that the contained error info
  object is matched by the nested matcher M.

To make these work, I've changed the implementation of the ErrorHolder
class. Now, instead of just storing the string representation of the
Error, it fetches the ErrorInfo objects and stores then as a list of
shared pointers. This way, ErrorHolder remains copyable, while still
retaining the full information contained in the Error object.

In case the Error object contains two or more errors, the new matchers
will fail to match, instead of trying to match all (or any) of the
individual ErrorInfo objects. This seemed to be the most sensible
behavior for when one wants to match exact error details, but I could be
convinced otherwise...

Reviewers: zturner, lhames

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D44925

llvm-svn: 329288
2018-04-05 14:32:10 +00:00
Zachary Turner
6c4fad5c56 Force #define GTEST_LANG_CXX11.
gtest depends on this #define to determine whether it can
use various classes like std::tuple, or whether it has to fall
back to experimental classes in the std::tr1 namespace.  The
check in the current version of gtest relies on the value of
the `__cplusplus` macro, but MSVC provides a non-conformant
value of this macro, making it effectively impossible to detect
C++11.  In short, LLVM compiled with MSVC has been silently
using the tr1 versions of several classes since the beginning of
time.

This would normally be pretty benign, except that in the latest
preview of MSVC they have marked all of the tr1 classes
deprecated, so it spews thousands of warnings.

llvm-svn: 316798
2017-10-27 21:12:28 +00:00
Zachary Turner
90731bf011 Mark LLVMTestingSupport as not installed in LLVMBuild.
This is causing downstream issues with llvm-config.

llvm-svn: 305754
2017-06-19 22:01:50 +00:00
Zachary Turner
7470585f23 [gtest] Create a shared include directory for gtest utilities.
Many times unit tests for different libraries would like to use
the same helper functions for checking common types of errors.

This patch adds a common library with helpers for testing things
in Support, and introduces helpers in here for integrating the
llvm::Error and llvm::Expected<T> classes with gtest and gmock.

Normally, we would just be able to write:

   EXPECT_THAT(someFunction(), succeeded());

but due to some quirks in llvm::Error's move semantics, gmock
doesn't make this easy, so two macros EXPECT_THAT_ERROR() and
EXPECT_THAT_EXPECTED() are introduced to gloss over the difficulties.
Consider this an exception, and possibly only temporary as we
look for ways to improve this.

Differential Revision: https://reviews.llvm.org/D33059

llvm-svn: 305395
2017-06-14 16:41:50 +00:00