Parcourir la source

[spirv] Use proper file names and delete unused tests

Ehsan Nasiri il y a 6 ans
Parent
commit
adf2332a37

+ 1 - 1
tools/clang/lib/SPIRV/SpirvContext.cpp

@@ -1,4 +1,4 @@
-//===--- SPIRVContext.cpp - SPIR-V SPIRVContext implementation-------------===//
+//===--- SpirvContext.cpp - SPIR-V SpirvContext implementation-------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //

+ 4 - 4
tools/clang/unittests/SPIRV/CMakeLists.txt

@@ -7,14 +7,14 @@ set(LLVM_LINK_COMPONENTS
   )
 
 add_clang_unittest(clang-spirv-tests
-  CodeGenSPIRVTest.cpp
+  CodeGenSpirvTest.cpp
   FileTestFixture.cpp
   FileTestUtils.cpp
-  SPIRVContextTest.cpp
-  SPIRVTestOptions.cpp
-  TestMain.cpp
+  SpirvContextTest.cpp
+  SpirvTestOptions.cpp
   SpirvConstantTest.cpp
   StringTest.cpp
+  TestMain.cpp
   WholeFileTestFixture.cpp
   )
 

+ 1 - 1
tools/clang/unittests/SPIRV/FileTestUtils.cpp

@@ -14,7 +14,7 @@
 
 #include "dxc/Support/HLSLOptions.h"
 
-#include "SPIRVTestOptions.h"
+#include "SpirvTestOptions.h"
 #include "gtest/gtest.h"
 
 namespace clang {

+ 0 - 83
tools/clang/unittests/SPIRV/SPIRVTestUtils.h

@@ -1,83 +0,0 @@
-//===- unittests/SPIRV/SPIRVTestUtils.h - Common utilities for tests ------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines utility functions for writing SPIR-V tests. They are
-// not supposed to be included in source files other than tests.
-//
-//===----------------------------------------------------------------------===//
-
-#include <initializer_list>
-#include <vector>
-
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-#include "spirv/unified1/spirv.hpp11"
-#include "clang/SPIRV/InstBuilder.h"
-#include "llvm/ADT/ArrayRef.h"
-
-namespace clang {
-namespace spirv {
-
-/// Creates an InstBuilder which pushes all constructed SPIR-V instructions
-/// into the given binary.
-inline InstBuilder constructInstBuilder(std::vector<uint32_t> &binary) {
-  return InstBuilder([&binary](std::vector<uint32_t> &&words) {
-    binary.insert(binary.end(), words.begin(), words.end());
-  });
-}
-
-/// Returns the words in SPIR-V module header with the given id bound.
-inline std::vector<uint32_t> getModuleHeader(uint32_t bound) {
-  return {spv::MagicNumber, 0x00010000, 14u << 16, bound, 0};
-}
-
-/// Creates a SPIR-V instruction.
-inline std::vector<uint32_t> constructInst(spv::Op opcode,
-                                           llvm::ArrayRef<uint32_t> params) {
-  std::vector<uint32_t> words;
-
-  words.push_back(static_cast<uint32_t>(opcode));
-  for (auto w : params) {
-    words.push_back(w);
-  }
-  words.front() |= static_cast<uint32_t>(words.size()) << 16;
-
-  return words;
-}
-
-/// A simple instruction builder for testing purpose.
-class SimpleInstBuilder {
-public:
-  /// Constructs a simple instruction builder with no module header.
-  SimpleInstBuilder() {}
-
-  /// Constructs a simple instruction builder with module header having the
-  /// given id bound.
-  explicit SimpleInstBuilder(uint32_t bound) : words(getModuleHeader(bound)) {}
-
-  /// Adds an instruction.
-  void inst(spv::Op opcode, llvm::ArrayRef<uint32_t> params) {
-    auto inst = constructInst(opcode, params);
-    words.insert(words.end(), inst.begin(), inst.end());
-  }
-
-  const std::vector<uint32_t> &get() const { return words; }
-
-private:
-  std::vector<uint32_t> words;
-};
-
-/// Expects the given status is success.
-inline void expectBuildSuccess(InstBuilder::Status status) {
-  EXPECT_EQ(InstBuilder::Status::Success, status);
-}
-
-} // end namespace spirv
-} // end namespace clang

+ 1 - 1
tools/clang/unittests/SPIRV/SPIRVContextTest.cpp → tools/clang/unittests/SPIRV/SpirvContextTest.cpp

@@ -1,4 +1,4 @@
-//===- unittests/SPIRV/SPIRVContextTest.cpp ----- SPIRVContext tests ------===//
+//===- unittests/SPIRV/SpirvContextTest.cpp ----- SpirvContext tests ------===//
 //
 //                     The LLVM Compiler Infrastructure
 //

+ 1 - 1
tools/clang/unittests/SPIRV/SPIRVTestOptions.cpp → tools/clang/unittests/SPIRV/SpirvTestOptions.cpp

@@ -12,7 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "SPIRVTestOptions.h"
+#include "SpirvTestOptions.h"
 
 namespace clang {
 namespace spirv {

+ 1 - 1
tools/clang/unittests/SPIRV/TestMain.cpp

@@ -12,7 +12,7 @@
 
 #include "llvm/Support/Signals.h"
 
-#include "SPIRVTestOptions.h"
+#include "SpirvTestOptions.h"
 
 #if defined(_WIN32)
 #include <windows.h>