xref: /openbsd-src/gnu/llvm/lldb/tools/lldb-fuzzer/utils/TempFile.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1 //===-- TempFile.h ----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/ADT/SmallString.h"
10 #include "llvm/ADT/StringRef.h"
11 #include "llvm/Support/Error.h"
12 
13 namespace lldb_fuzzer {
14 
15 class TempFile {
16 public:
17   TempFile() = default;
18   ~TempFile();
19 
20   static std::unique_ptr<TempFile> Create(uint8_t *data, size_t size);
GetPath()21   llvm::StringRef GetPath() { return m_path.str(); }
22 
23 private:
24   llvm::SmallString<128> m_path;
25 };
26 
27 } // namespace lldb_fuzzer
28