================
@@ -21,171 +21,146 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
-#ifndef _WIN32
-#include <unistd.h>
-#endif
+
+#include <functional>
+#include <string>
+
+namespace clang::ssaf {
 
 // ============================================================================
 // Test Fixture
 // ============================================================================
 
-class JSONFormatTest : public clang::ssaf::TestFixture {
+class JSONFormatTest : public TestFixture {
 public:
   using PathString = llvm::SmallString<128>;
 
 protected:
   llvm::SmallString<128> TestDir;
 
-  void SetUp() override {
-    std::error_code EC =
-        llvm::sys::fs::createUniqueDirectory("json-format-test", TestDir);
-    ASSERT_FALSE(EC) << "Failed to create temp directory: " << EC.message();
-  }
+  void SetUp() override;
 
-  void TearDown() override { llvm::sys::fs::remove_directories(TestDir); }
+  void TearDown() override;
 
-  PathString makePath(llvm::StringRef FileOrDirectoryName) const {
-    PathString FullPath = TestDir;
-    llvm::sys::path::append(FullPath, FileOrDirectoryName);
+  PathString makePath(llvm::StringRef FileOrDirectoryName) const;
 
-    return FullPath;
-  }
+  PathString makePath(llvm::StringRef Dir, llvm::StringRef FileName) const;
 
-  PathString makePath(llvm::StringRef Dir, llvm::StringRef FileName) const {
-    PathString FullPath = TestDir;
-    llvm::sys::path::append(FullPath, Dir, FileName);
+  llvm::Expected<PathString> makeDirectory(llvm::StringRef DirectoryName) 
const;
 
-    return FullPath;
-  }
+  llvm::Expected<PathString> makeSymlink(llvm::StringRef TargetFileName,
+                                         llvm::StringRef SymlinkFileName) 
const;
+
+  llvm::Error setPermission(llvm::StringRef FileName,
+                            llvm::sys::fs::perms Perms) const;
 
-  llvm::Expected<PathString>
-  makeDirectory(llvm::StringRef DirectoryName) const {
-    PathString DirPath = makePath(DirectoryName);
+  // Returns true if Unix file permission checks are enforced in this
+  // environment. Returns false if running as root (uid 0), or if a probe
+  // file with read permission removed can still be opened, indicating that
+  // permission checks are not enforced (e.g. certain container setups).
+  // Tests that rely on permission-based failure conditions should skip
+  // themselves when this returns false.
+  bool permissionsAreEnforced() const;
 
-    std::error_code EC = llvm::sys::fs::create_directory(DirPath);
-    if (EC) {
-      return llvm::createStringError(EC, "Failed to create directory '%s': %s",
-                                     DirPath.c_str(), EC.message().c_str());
-    }
+  llvm::Expected<llvm::json::Value>
+  readJSONFromFile(llvm::StringRef FileName) const;
 
-    return DirPath;
-  }
+  llvm::Expected<PathString> writeJSON(llvm::StringRef JSON,
+                                       llvm::StringRef FileName) const;
+};
+
+// ============================================================================
+// SummaryOps - Parameterization struct for TUSummary/LUSummary test suites
+// ============================================================================
+
+struct SummaryOps {
+  std::string Name;
+  std::string SummaryTypeName;
----------------
steakhal wrote:

Reading Name and SummaryTypeName it's not clear to me what these represent and 
why are they here. Could you be more specific in their names or put some 
comments on these?

https://github.com/llvm/llvm-project/pull/184037
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to