2012-12-04 02:12:45 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
2013-12-10 20:40:37 +08:00
|
|
|
Support
|
2012-12-04 02:12:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_clang_unittest(FormatTests
|
2016-04-25 23:09:22 +08:00
|
|
|
CleanupTest.cpp
|
2012-12-04 02:12:45 +08:00
|
|
|
FormatTest.cpp
|
2017-02-08 20:53:18 +08:00
|
|
|
FormatTestComments.cpp
|
[clang-format] Add basic support for formatting C# files
Summary:
This revision adds basic support for formatting C# files with clang-format, I know the barrier to entry is high here so I'm sending this revision in to test the water as to whether this might be something we'd consider landing.
Tracking in Bugzilla as:
https://bugs.llvm.org/show_bug.cgi?id=40850
Justification:
C# code just looks ugly in comparison to the C++ code in our source tree which is clang-formatted.
I've struggled with Visual Studio reformatting to get a clean and consistent style, I want to format our C# code on saving like I do now for C++ and i want it to have the same style as defined in our .clang-format file, so it consistent as it can be with C++. (Braces/Breaking/Spaces/Indent etc..)
Using clang format without this patch leaves the code in a bad state, sometimes when the BreakStringLiterals is set, it fails to compile.
Mostly the C# is similar to Java, except instead of JavaAnnotations I try to reuse the TT_AttributeSquare.
Almost the most valuable portion is to have a new Language in order to partition the configuration for C# within a common .clang-format file, with the auto detection on the .cs extension. But there are other C# specific styles that could be added later if this is accepted. in particular how `{ set;get }` is formatted.
Reviewers: djasper, klimek, krasimir, benhamilton, JonasToth
Reviewed By: klimek
Subscribers: llvm-commits, mgorny, jdoerfert, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D58404
llvm-svn: 356662
2019-03-21 21:09:22 +08:00
|
|
|
FormatTestCSharp.cpp
|
2013-12-03 18:50:16 +08:00
|
|
|
FormatTestJS.cpp
|
2017-02-27 21:28:36 +08:00
|
|
|
FormatTestJava.cpp
|
2016-12-12 20:42:29 +08:00
|
|
|
FormatTestObjC.cpp
|
2014-01-19 17:04:08 +08:00
|
|
|
FormatTestProto.cpp
|
2017-10-30 22:01:50 +08:00
|
|
|
FormatTestRawStrings.cpp
|
2015-06-15 23:25:11 +08:00
|
|
|
FormatTestSelective.cpp
|
2018-11-13 02:15:04 +08:00
|
|
|
FormatTestTableGen.cpp
|
2017-07-03 23:05:14 +08:00
|
|
|
FormatTestTextProto.cpp
|
2017-02-27 21:28:36 +08:00
|
|
|
NamespaceEndCommentsFixerTest.cpp
|
2016-05-20 19:24:24 +08:00
|
|
|
SortImportsTestJS.cpp
|
2018-10-06 01:19:26 +08:00
|
|
|
SortImportsTestJava.cpp
|
2015-09-23 16:30:47 +08:00
|
|
|
SortIncludesTest.cpp
|
2017-06-21 20:03:12 +08:00
|
|
|
UsingDeclarationsSorterTest.cpp
|
2012-12-04 02:12:45 +08:00
|
|
|
)
|
|
|
|
|
2019-07-04 06:45:55 +08:00
|
|
|
clang_target_link_libraries(FormatTests
|
[CMake] Use PRIVATE in target_link_libraries for executables
We currently use target_link_libraries without an explicit scope
specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables.
Dependencies added in this way apply to both the target and its
dependencies, i.e. they become part of the executable's link interface
and are transitive.
Transitive dependencies generally don't make sense for executables,
since you wouldn't normally be linking against an executable. This also
causes issues for generating install export files when using
LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM
library dependencies, which are currently added as interface
dependencies. If clang is in the distribution components but the LLVM
libraries it depends on aren't (which is a perfectly legitimate use case
if the LLVM libraries are being built static and there are therefore no
run-time dependencies on them), CMake will complain about the LLVM
libraries not being in export set when attempting to generate the
install export file for clang. This is reasonable behavior on CMake's
part, and the right thing is for LLVM's build system to explicitly use
PRIVATE dependencies for executables.
Unfortunately, CMake doesn't allow you to mix and match the keyword and
non-keyword target_link_libraries signatures for a single target; i.e.,
if a single call to target_link_libraries for a particular target uses
one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must
also be updated to use those keywords. This means we must do this change
in a single shot. I also fully expect to have missed some instances; I
tested by enabling all the projects in the monorepo (except dragonegg),
and configuring both with and without shared libraries, on both Darwin
and Linux, but I'm planning to rely on the buildbots for other
configurations (since it should be pretty easy to fix those).
Even after this change, we still have a lot of target_link_libraries
calls that don't specify a scope keyword, mostly for shared libraries.
I'm thinking about addressing those in a follow-up, but that's a
separate change IMO.
Differential Revision: https://reviews.llvm.org/D40823
llvm-svn: 319840
2017-12-06 05:49:56 +08:00
|
|
|
PRIVATE
|
2016-03-01 20:47:30 +08:00
|
|
|
clangBasic
|
2012-12-04 02:12:45 +08:00
|
|
|
clangFormat
|
2016-03-01 20:37:30 +08:00
|
|
|
clangFrontend
|
2016-03-01 21:11:36 +08:00
|
|
|
clangRewrite
|
2014-10-30 02:55:09 +08:00
|
|
|
clangToolingCore
|
2012-12-04 02:12:45 +08:00
|
|
|
)
|