[llvm] 3432f4b - [test] Split out Annotations from `TestingSupport`

Jordan Rupprecht via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 13:40:54 PST 2023


Author: Jordan Rupprecht
Date: 2023-01-12T13:40:47-08:00
New Revision: 3432f4bf86e7c77666ae9dede1610ae843dde648

URL: https://github.com/llvm/llvm-project/commit/3432f4bf86e7c77666ae9dede1610ae843dde648
DIFF: https://github.com/llvm/llvm-project/commit/3432f4bf86e7c77666ae9dede1610ae843dde648.diff

LOG: [test] Split out Annotations from `TestingSupport`

The Annotations helper class does not have a gtest or gmock dependency, but because it's bundled with the rest of TestingSupport, it gets one. By splitting it out, a target can use it without being forced to use LLVM's copy of gtest.

Reviewed By: GMNGeoffrey, sammccall, gribozavr2

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

Added: 
    llvm/include/llvm/Testing/Annotations/Annotations.h
    llvm/lib/Testing/Annotations/Annotations.cpp
    llvm/lib/Testing/Annotations/CMakeLists.txt
    llvm/unittests/Testing/Annotations/AnnotationsTest.cpp
    llvm/unittests/Testing/Annotations/CMakeLists.txt

Modified: 
    clang-tools-extra/clangd/unittests/Annotations.h
    clang-tools-extra/clangd/unittests/CMakeLists.txt
    clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
    clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
    clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h
    clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
    clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
    clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
    clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
    clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
    clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
    clang-tools-extra/pseudo/unittests/BracketTest.cpp
    clang-tools-extra/pseudo/unittests/CMakeLists.txt
    clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
    clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
    clang/docs/tools/clang-formatted-files.txt
    clang/unittests/AST/CMakeLists.txt
    clang/unittests/AST/DeclTest.cpp
    clang/unittests/AST/SourceLocationTest.cpp
    clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
    clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
    clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp
    clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
    clang/unittests/Analysis/FlowSensitive/TestingSupport.h
    clang/unittests/Analysis/FlowSensitive/TransferBranchTest.cpp
    clang/unittests/Sema/CMakeLists.txt
    clang/unittests/Sema/CodeCompleteTest.cpp
    clang/unittests/Tooling/CMakeLists.txt
    clang/unittests/Tooling/SourceCodeTest.cpp
    clang/unittests/Tooling/Syntax/CMakeLists.txt
    clang/unittests/Tooling/Syntax/TokensTest.cpp
    clang/unittests/Tooling/Syntax/TreeTestBase.cpp
    clang/unittests/Tooling/Syntax/TreeTestBase.h
    llvm/lib/Testing/CMakeLists.txt
    llvm/lib/Testing/Support/CMakeLists.txt
    llvm/unittests/Support/CMakeLists.txt
    llvm/unittests/Testing/CMakeLists.txt
    utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
    utils/bazel/llvm-project-overlay/llvm/BUILD.bazel

Removed: 
    llvm/include/llvm/Testing/Support/Annotations.h
    llvm/lib/Testing/Support/Annotations.cpp
    llvm/unittests/Support/AnnotationsTest.cpp


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/Annotations.h b/clang-tools-extra/clangd/unittests/Annotations.h
index 60a2d62dda9c3..7cf9c30d8d4bb 100644
--- a/clang-tools-extra/clangd/unittests/Annotations.h
+++ b/clang-tools-extra/clangd/unittests/Annotations.h
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// A clangd-specific version of llvm/Testing/Support/Annotations.h, replaces
+// A clangd-specific version of llvm/Testing/Annotations/Annotations.h, replaces
 // offsets and offset-based ranges with types from the LSP protocol.
 //===---------------------------------------------------------------------===//
 
@@ -13,7 +13,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_ANNOTATIONS_H
 
 #include "Protocol.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 
 namespace clang {
 namespace clangd {

diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index af94cc5b270de..7d142529c5a0c 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -5,7 +5,12 @@ set(LLVM_LINK_COMPONENTS
   )
 
 if(CLANG_BUILT_STANDALONE)
-  # LLVMTestingSupport library is needed for clangd tests.
+  # LLVMTestingSupport and LLVMTestingAnnotations are needed for clangd tests.
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations
+      AND NOT TARGET LLVMTestingAnnotations)
+    add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations
+      lib/Testing/Annotations)
+  endif()
   if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
       AND NOT TARGET LLVMTestingSupport)
     add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
@@ -162,6 +167,7 @@ target_link_libraries(ClangdTests
   clangDaemon
   clangdSupport
   clangTidy
+  LLVMTestingAnnotations
   LLVMTestingSupport
   )
 

diff  --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index 55695d8b94bc4..1973518984277 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -29,7 +29,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "llvm/Testing/Support/Error.h"
 #include "llvm/Testing/Support/SupportHelpers.h"
 #include "gmock/gmock.h"

diff  --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 336572aede2a4..1a9e651b285f6 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -15,7 +15,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <initializer_list>

diff  --git a/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp b/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
index 9d40702ca5cd2..08abde87df6d4 100644
--- a/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
@@ -15,7 +15,7 @@
 #include "clang/Basic/TokenKinds.h"
 #include "clang/Format/Format.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"

diff  --git a/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h b/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h
index 0afa838134d06..183f773becc71 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h
+++ b/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h
@@ -13,7 +13,7 @@
 #include "index/Index.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <memory>

diff  --git a/clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp b/clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
index 7f87a188be856..04ff428184667 100644
--- a/clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
@@ -19,7 +19,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/ScopedPrinter.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <cstddef>

diff  --git a/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt b/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
index e5a4180a53e31..bd9729f48a149 100644
--- a/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
+++ b/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
@@ -31,6 +31,7 @@ target_link_libraries(ClangIncludeCleanerTests
   PRIVATE
   clangIncludeCleaner
   clangTesting
+  LLVMTestingAnnotations
   LLVMTestingSupport
   )
 

diff  --git a/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp b/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
index ad5961699834c..55909b2e232b8 100644
--- a/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
@@ -17,7 +17,7 @@
 #include "clang/Testing/TestAST.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <memory>

diff  --git a/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp b/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
index 7d0fd1b56e096..5d2ec3e92bac0 100644
--- a/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
@@ -15,7 +15,7 @@
 #include "clang/Testing/TestAST.h"
 #include "clang/Tooling/Inclusions/StandardLibrary.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <cstddef>

diff  --git a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
index cc99146c4419d..5e068dfa15549 100644
--- a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
@@ -13,7 +13,7 @@
 #include "clang/Testing/TestAST.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 

diff  --git a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
index af7e155b58fb3..3b97cc8cdfd55 100644
--- a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
@@ -15,7 +15,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ScopedPrinter.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gtest/gtest.h"
 #include <cstddef>
 #include <unordered_map>

diff  --git a/clang-tools-extra/pseudo/unittests/BracketTest.cpp b/clang-tools-extra/pseudo/unittests/BracketTest.cpp
index 1247ddbd49a1d..2fbfc64151364 100644
--- a/clang-tools-extra/pseudo/unittests/BracketTest.cpp
+++ b/clang-tools-extra/pseudo/unittests/BracketTest.cpp
@@ -9,7 +9,7 @@
 #include "clang-pseudo/Bracket.h"
 #include "clang-pseudo/Token.h"
 #include "clang/Basic/LangOptions.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 

diff  --git a/clang-tools-extra/pseudo/unittests/CMakeLists.txt b/clang-tools-extra/pseudo/unittests/CMakeLists.txt
index 831ae3d1256a9..821ca4d0652e1 100644
--- a/clang-tools-extra/pseudo/unittests/CMakeLists.txt
+++ b/clang-tools-extra/pseudo/unittests/CMakeLists.txt
@@ -26,5 +26,6 @@ target_link_libraries(ClangPseudoTests
   clangPseudo
   clangPseudoCXX
   clangPseudoGrammar
+  LLVMTestingAnnotations
   LLVMTestingSupport
   )

diff  --git a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
index fa44e1daf1ace..336b773206832 100644
--- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
@@ -57,5 +57,6 @@ target_link_libraries(ClangTidyTests
   clangTidyObjCModule
   clangTidyReadabilityModule
   clangTidyUtils
+  LLVMTestingAnnotations
   LLVMTestingSupport
   )

diff  --git a/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp b/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
index 04835d2a91470..4b8810237c28c 100644
--- a/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
+++ b/clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
@@ -3,7 +3,7 @@
 #include "ClangTidyDiagnosticConsumer.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/ScopedPrinter.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <optional>

diff  --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt
index 3babeeeab03f5..3bad9a2008159 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -5536,7 +5536,7 @@ llvm/include/llvm/TableGen/Parser.h
 llvm/include/llvm/TableGen/StringToOffsetTable.h
 llvm/include/llvm/Target/CGPassBuilderOption.h
 llvm/include/llvm/Target/CodeGenCWrappers.h
-llvm/include/llvm/Testing/Support/Annotations.h
+llvm/include/llvm/Testing/Annotations/Annotations.h
 llvm/include/llvm/Testing/Support/SupportHelpers.h
 llvm/include/llvm/TextAPI/Architecture.h
 llvm/include/llvm/TextAPI/ArchitectureSet.h
@@ -6839,7 +6839,7 @@ llvm/lib/Target/XCore/MCTargetDesc/XCoreMCAsmInfo.h
 llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp
 llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.h
 llvm/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp
-llvm/lib/Testing/Support/Annotations.cpp
+llvm/lib/Testing/Annotations/Annotations.cpp
 llvm/lib/Testing/Support/Error.cpp
 llvm/lib/Testing/Support/SupportHelpers.cpp
 llvm/lib/TextAPI/ArchitectureSet.cpp

diff  --git a/clang/unittests/AST/CMakeLists.txt b/clang/unittests/AST/CMakeLists.txt
index 9e91c951b9aaa..13b945df3b589 100644
--- a/clang/unittests/AST/CMakeLists.txt
+++ b/clang/unittests/AST/CMakeLists.txt
@@ -50,5 +50,6 @@ clang_target_link_libraries(ASTTests
 target_link_libraries(ASTTests
   PRIVATE
   clangTesting
+  LLVMTestingAnnotations
   LLVMTestingSupport
 )

diff  --git a/clang/unittests/AST/DeclTest.cpp b/clang/unittests/AST/DeclTest.cpp
index 940ff17f8c80f..518f71ea4fea7 100644
--- a/clang/unittests/AST/DeclTest.cpp
+++ b/clang/unittests/AST/DeclTest.cpp
@@ -20,7 +20,7 @@
 #include "clang/Lex/Lexer.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/IR/DataLayout.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gtest/gtest.h"
 
 using namespace clang::ast_matchers;

diff  --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index 18054d3916c36..43b7149bd1183 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -20,7 +20,7 @@
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/Tooling.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gtest/gtest.h"
 
 using namespace clang;

diff  --git a/clang/unittests/Analysis/FlowSensitive/CMakeLists.txt b/clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
index a5ad105242bbb..ed38a515be270 100644
--- a/clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
+++ b/clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
@@ -41,5 +41,6 @@ clang_target_link_libraries(ClangAnalysisFlowSensitiveTests
 target_link_libraries(ClangAnalysisFlowSensitiveTests
   PRIVATE
   clangTesting
+  LLVMTestingAnnotations
   LLVMTestingSupport
   )

diff  --git a/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp b/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
index d803becd4db09..7f58d5f2f2599 100644
--- a/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
@@ -21,7 +21,7 @@
 #include "clang/Analysis/FlowSensitive/DataflowAnalysis.h"
 #include "clang/Analysis/FlowSensitive/NoopLattice.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 #include <memory>

diff  --git a/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp b/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp
index 98863e4b43ded..de99f01119012 100644
--- a/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp
@@ -28,7 +28,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Testing/ADT/StringMapEntry.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"

diff  --git a/clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp b/clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
index f73933f3db3d4..8541ac336b6eb 100644
--- a/clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
@@ -13,7 +13,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include <cassert>
 #include <functional>
 #include <memory>

diff  --git a/clang/unittests/Analysis/FlowSensitive/TestingSupport.h b/clang/unittests/Analysis/FlowSensitive/TestingSupport.h
index 522d626a9c5c9..47fa108286907 100644
--- a/clang/unittests/Analysis/FlowSensitive/TestingSupport.h
+++ b/clang/unittests/Analysis/FlowSensitive/TestingSupport.h
@@ -43,7 +43,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 
 namespace clang {
 namespace dataflow {

diff  --git a/clang/unittests/Analysis/FlowSensitive/TransferBranchTest.cpp b/clang/unittests/Analysis/FlowSensitive/TransferBranchTest.cpp
index d546559cd0117..9f3228d54ce11 100644
--- a/clang/unittests/Analysis/FlowSensitive/TransferBranchTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/TransferBranchTest.cpp
@@ -16,7 +16,7 @@
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 

diff  --git a/clang/unittests/Sema/CMakeLists.txt b/clang/unittests/Sema/CMakeLists.txt
index 0ba2e1c314551..eb6d93aa197b2 100644
--- a/clang/unittests/Sema/CMakeLists.txt
+++ b/clang/unittests/Sema/CMakeLists.txt
@@ -25,5 +25,6 @@ clang_target_link_libraries(SemaTests
 target_link_libraries(SemaTests
   PRIVATE
   clangTesting
+  LLVMTestingAnnotations
   LLVMTestingSupport
 )

diff  --git a/clang/unittests/Sema/CodeCompleteTest.cpp b/clang/unittests/Sema/CodeCompleteTest.cpp
index 1d453f6cb4430..51986319f6d67 100644
--- a/clang/unittests/Sema/CodeCompleteTest.cpp
+++ b/clang/unittests/Sema/CodeCompleteTest.cpp
@@ -13,7 +13,7 @@
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaDiagnostic.h"
 #include "clang/Tooling/Tooling.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <cstddef>

diff  --git a/clang/unittests/Tooling/CMakeLists.txt b/clang/unittests/Tooling/CMakeLists.txt
index 4893c564422d2..2fbe78e3fab75 100644
--- a/clang/unittests/Tooling/CMakeLists.txt
+++ b/clang/unittests/Tooling/CMakeLists.txt
@@ -90,6 +90,7 @@ clang_target_link_libraries(ToolingTests
 
 target_link_libraries(ToolingTests
   PRIVATE
+  LLVMTestingAnnotations
   LLVMTestingSupport
   clangTesting
 )

diff  --git a/clang/unittests/Tooling/SourceCodeTest.cpp b/clang/unittests/Tooling/SourceCodeTest.cpp
index 90d0654bd5f7a..7a9bd329e8d46 100644
--- a/clang/unittests/Tooling/SourceCodeTest.cpp
+++ b/clang/unittests/Tooling/SourceCodeTest.cpp
@@ -11,7 +11,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/Lexer.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "llvm/Testing/Support/Error.h"
 #include "llvm/Testing/Support/SupportHelpers.h"
 #include <gmock/gmock.h>

diff  --git a/clang/unittests/Tooling/Syntax/CMakeLists.txt b/clang/unittests/Tooling/Syntax/CMakeLists.txt
index 33b06a05891cb..ff3b6176f879f 100644
--- a/clang/unittests/Tooling/Syntax/CMakeLists.txt
+++ b/clang/unittests/Tooling/Syntax/CMakeLists.txt
@@ -26,5 +26,6 @@ clang_target_link_libraries(SyntaxTests
 target_link_libraries(SyntaxTests
   PRIVATE
   clangTesting
+  LLVMTestingAnnotations
   LLVMTestingSupport
 )

diff  --git a/clang/unittests/Tooling/Syntax/TokensTest.cpp b/clang/unittests/Tooling/Syntax/TokensTest.cpp
index e034250d9e480..1c9cec86eb9c5 100644
--- a/clang/unittests/Tooling/Syntax/TokensTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TokensTest.cpp
@@ -37,7 +37,7 @@
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_os_ostream.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "llvm/Testing/Support/SupportHelpers.h"
 #include <cassert>
 #include <cstdlib>

diff  --git a/clang/unittests/Tooling/Syntax/TreeTestBase.cpp b/clang/unittests/Tooling/Syntax/TreeTestBase.cpp
index 4da4d6ce171c4..f387b503f3368 100644
--- a/clang/unittests/Tooling/Syntax/TreeTestBase.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTestBase.cpp
@@ -28,7 +28,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gtest/gtest.h"
 
 using namespace clang;

diff  --git a/clang/unittests/Tooling/Syntax/TreeTestBase.h b/clang/unittests/Tooling/Syntax/TreeTestBase.h
index 48756f8b09500..1176f457cf8b3 100644
--- a/clang/unittests/Tooling/Syntax/TreeTestBase.h
+++ b/clang/unittests/Tooling/Syntax/TreeTestBase.h
@@ -22,7 +22,7 @@
 #include "clang/Tooling/Syntax/Tree.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ScopedPrinter.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 

diff  --git a/llvm/include/llvm/Testing/Support/Annotations.h b/llvm/include/llvm/Testing/Annotations/Annotations.h
similarity index 100%
rename from llvm/include/llvm/Testing/Support/Annotations.h
rename to llvm/include/llvm/Testing/Annotations/Annotations.h

diff  --git a/llvm/lib/Testing/Support/Annotations.cpp b/llvm/lib/Testing/Annotations/Annotations.cpp
similarity index 99%
rename from llvm/lib/Testing/Support/Annotations.cpp
rename to llvm/lib/Testing/Annotations/Annotations.cpp
index 16b57cbcd9ed2..1e6852619a874 100644
--- a/llvm/lib/Testing/Support/Annotations.cpp
+++ b/llvm/lib/Testing/Annotations/Annotations.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/FormatVariadic.h"

diff  --git a/llvm/lib/Testing/Annotations/CMakeLists.txt b/llvm/lib/Testing/Annotations/CMakeLists.txt
new file mode 100644
index 0000000000000..75e006207edbd
--- /dev/null
+++ b/llvm/lib/Testing/Annotations/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Do not build unittest libraries automatically, they will be pulled in
+# by unittests if these are built.
+set(EXCLUDE_FROM_ALL ON)
+
+add_llvm_library(LLVMTestingAnnotations
+  Annotations.cpp
+
+  BUILDTREE_ONLY
+
+  ADDITIONAL_HEADER_DIRS
+  ${LLVM_MAIN_INCLUDE_DIR}/llvm/Testing/Support
+
+  LINK_COMPONENTS
+  Support
+  )

diff  --git a/llvm/lib/Testing/CMakeLists.txt b/llvm/lib/Testing/CMakeLists.txt
index fc23e64eeb7a4..6ca6c4ea2f315 100644
--- a/llvm/lib/Testing/CMakeLists.txt
+++ b/llvm/lib/Testing/CMakeLists.txt
@@ -1 +1,2 @@
+add_subdirectory(Annotations)
 add_subdirectory(Support)

diff  --git a/llvm/lib/Testing/Support/CMakeLists.txt b/llvm/lib/Testing/Support/CMakeLists.txt
index 385d8eca2daa7..766c64b6fdd6e 100644
--- a/llvm/lib/Testing/Support/CMakeLists.txt
+++ b/llvm/lib/Testing/Support/CMakeLists.txt
@@ -3,7 +3,6 @@
 set(EXCLUDE_FROM_ALL ON)
 
 add_llvm_library(LLVMTestingSupport
-  Annotations.cpp
   Error.cpp
   SupportHelpers.cpp
 

diff  --git a/llvm/unittests/Support/CMakeLists.txt b/llvm/unittests/Support/CMakeLists.txt
index d987d65db13ea..459b8978ae323 100644
--- a/llvm/unittests/Support/CMakeLists.txt
+++ b/llvm/unittests/Support/CMakeLists.txt
@@ -8,7 +8,6 @@ add_llvm_unittest(SupportTests
   AlignmentTest.cpp
   AlignOfTest.cpp
   AllocatorTest.cpp
-  AnnotationsTest.cpp
   ARMAttributeParser.cpp
   ArrayRecyclerTest.cpp
   Base64Test.cpp

diff  --git a/llvm/unittests/Support/AnnotationsTest.cpp b/llvm/unittests/Testing/Annotations/AnnotationsTest.cpp
similarity index 99%
rename from llvm/unittests/Support/AnnotationsTest.cpp
rename to llvm/unittests/Testing/Annotations/AnnotationsTest.cpp
index 96b564d82b5cb..d8c42888e5547 100644
--- a/llvm/unittests/Support/AnnotationsTest.cpp
+++ b/llvm/unittests/Testing/Annotations/AnnotationsTest.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 

diff  --git a/llvm/unittests/Testing/Annotations/CMakeLists.txt b/llvm/unittests/Testing/Annotations/CMakeLists.txt
new file mode 100644
index 0000000000000..d82693691b904
--- /dev/null
+++ b/llvm/unittests/Testing/Annotations/CMakeLists.txt
@@ -0,0 +1,10 @@
+set(LLVM_LINK_COMPONENTS
+  Support
+  TestingAnnotations
+  )
+
+add_llvm_unittest(TestingAnnotationTests
+  AnnotationsTest.cpp
+  )
+
+target_link_libraries(TestingAnnotationTests PRIVATE LLVMTestingAnnotations)

diff  --git a/llvm/unittests/Testing/CMakeLists.txt b/llvm/unittests/Testing/CMakeLists.txt
index b2d65e887caf1..f3f89fa3dc0f8 100644
--- a/llvm/unittests/Testing/CMakeLists.txt
+++ b/llvm/unittests/Testing/CMakeLists.txt
@@ -1,2 +1,3 @@
 add_subdirectory(ADT)
+add_subdirectory(Annotations)
 add_subdirectory(Support)

diff  --git a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
index 4dfdab840db0c..78df6d1f9eaa7 100644
--- a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
@@ -29,6 +29,7 @@ cc_test(
         "//clang:tooling",
         "//llvm:Core",
         "//llvm:Support",
+        "//llvm:TestingAnnotations",
         "//llvm:TestingSupport",
         "//third-party/unittest:gmock",
         "//third-party/unittest:gtest",
@@ -136,6 +137,7 @@ cc_test(
         "//clang:tooling",
         "//llvm:Support",
         "//llvm:TestingADT",
+        "//llvm:TestingAnnotations",
         "//llvm:TestingSupport",
         "//third-party/unittest:gmock",
         "//third-party/unittest:gtest",
@@ -342,6 +344,7 @@ cc_test(
         "//clang:parse",
         "//clang:sema",
         "//clang:tooling",
+        "//llvm:TestingAnnotations",
         "//llvm:TestingSupport",
         "//third-party/unittest:gmock",
         "//third-party/unittest:gtest",
@@ -420,6 +423,7 @@ cc_test(
         "//clang:tooling_refactoring",
         "//clang:transformer",
         "//llvm:Support",
+        "//llvm:TestingAnnotations",
         "//llvm:TestingSupport",
         "//third-party/unittest:gmock",
         "//third-party/unittest:gtest",
@@ -495,6 +499,7 @@ cc_test(
         "//clang:tooling_core",
         "//clang:tooling_syntax",
         "//llvm:Support",
+        "//llvm:TestingAnnotations",
         "//llvm:TestingSupport",
         "//third-party/unittest:gmock",
         "//third-party/unittest:gtest",

diff  --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index 6d9b88ccd0f21..d745b6e30a25b 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4516,9 +4516,7 @@ cc_library(
         "lib/Testing/Support/*.cpp",
         "lib/Testing/Support/*.h",
     ]),
-    hdrs = glob([
-        "include/llvm/Testing/Support/*.h",
-    ]),
+    hdrs = glob(["include/llvm/Testing/Support/*.h"]),
     copts = llvm_copts,
     deps = [
         ":Support",
@@ -4528,6 +4526,15 @@ cc_library(
     ],
 )
 
+cc_library(
+    name = "TestingAnnotations",
+    testonly = True,
+    srcs = ["lib/Testing/Annotations/Annotations.cpp"],
+    hdrs = ["include/llvm/Testing/Annotations/Annotations.h"],
+    copts = llvm_copts,
+    deps = [":Support"],
+)
+
 ################################################################################
 # Begin testonly binary utilities
 


        


More information about the llvm-commits mailing list