mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 06:40:01 +08:00
[YAML] Convert Optional to std::optional
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
|
||||
namespace clang {
|
||||
namespace doc {
|
||||
@@ -81,7 +82,7 @@ llvm::Error decodeRecord(const Record &R, TagTypeKind &Field,
|
||||
}
|
||||
}
|
||||
|
||||
llvm::Error decodeRecord(const Record &R, llvm::Optional<Location> &Field,
|
||||
llvm::Error decodeRecord(const Record &R, std::optional<Location> &Field,
|
||||
llvm::StringRef Blob) {
|
||||
if (R[0] > INT_MAX)
|
||||
return llvm::createStringError(llvm::inconvertibleErrorCode(),
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include <array>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace clang {
|
||||
@@ -295,7 +296,7 @@ struct SymbolInfo : public Info {
|
||||
|
||||
void merge(SymbolInfo &&I);
|
||||
|
||||
llvm::Optional<Location> DefLoc; // Location where this decl is defined.
|
||||
std::optional<Location> DefLoc; // Location where this decl is defined.
|
||||
llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
|
||||
};
|
||||
|
||||
@@ -421,7 +422,7 @@ struct EnumInfo : public SymbolInfo {
|
||||
// Set to nonempty to the type when this is an explicitly typed enum. For
|
||||
// enum Foo : short { ... };
|
||||
// this will be "short".
|
||||
llvm::Optional<TypeInfo> BaseType;
|
||||
std::optional<TypeInfo> BaseType;
|
||||
|
||||
llvm::SmallVector<EnumValueInfo, 4> Members; // List of enum members.
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Generators.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace clang::doc;
|
||||
|
||||
@@ -125,7 +126,7 @@ static void InfoMapping(IO &IO, Info &I) {
|
||||
|
||||
static void SymbolInfoMapping(IO &IO, SymbolInfo &I) {
|
||||
InfoMapping(IO, I);
|
||||
IO.mapOptional("DefLocation", I.DefLoc, Optional<Location>());
|
||||
IO.mapOptional("DefLocation", I.DefLoc, std::optional<Location>());
|
||||
IO.mapOptional("Location", I.Loc, llvm::SmallVector<Location, 2>());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "llvm/Support/MemoryBufferRef.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#define DEBUG_TYPE "clang-tidy-options"
|
||||
@@ -155,7 +156,7 @@ ClangTidyOptions ClangTidyOptions::getDefaults() {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void mergeVectors(Optional<T> &Dest, const Optional<T> &Src) {
|
||||
static void mergeVectors(std::optional<T> &Dest, const std::optional<T> &Src) {
|
||||
if (Src) {
|
||||
if (Dest)
|
||||
Dest->insert(Dest->end(), Src->begin(), Src->end());
|
||||
@@ -164,14 +165,14 @@ static void mergeVectors(Optional<T> &Dest, const Optional<T> &Src) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mergeCommaSeparatedLists(Optional<std::string> &Dest,
|
||||
const Optional<std::string> &Src) {
|
||||
static void mergeCommaSeparatedLists(std::optional<std::string> &Dest,
|
||||
const std::optional<std::string> &Src) {
|
||||
if (Src)
|
||||
Dest = (Dest && !Dest->empty() ? *Dest + "," : "") + *Src;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void overrideValue(Optional<T> &Dest, const Optional<T> &Src) {
|
||||
static void overrideValue(std::optional<T> &Dest, const std::optional<T> &Src) {
|
||||
if (Src)
|
||||
Dest = Src;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "llvm/Support/MemoryBufferRef.h"
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <utility>
|
||||
@@ -67,17 +68,17 @@ struct ClangTidyOptions {
|
||||
unsigned Order) const;
|
||||
|
||||
/// Checks filter.
|
||||
llvm::Optional<std::string> Checks;
|
||||
std::optional<std::string> Checks;
|
||||
|
||||
/// WarningsAsErrors filter.
|
||||
llvm::Optional<std::string> WarningsAsErrors;
|
||||
std::optional<std::string> WarningsAsErrors;
|
||||
|
||||
/// Output warnings from headers matching this filter. Warnings from
|
||||
/// main files will always be displayed.
|
||||
llvm::Optional<std::string> HeaderFilterRegex;
|
||||
std::optional<std::string> HeaderFilterRegex;
|
||||
|
||||
/// Output warnings from system headers matching \c HeaderFilterRegex.
|
||||
llvm::Optional<bool> SystemHeaders;
|
||||
std::optional<bool> SystemHeaders;
|
||||
|
||||
/// Format code around applied fixes with clang-format using this
|
||||
/// style.
|
||||
@@ -91,13 +92,13 @@ struct ClangTidyOptions {
|
||||
/// * '{inline-formatting-style-in-yaml-format}'.
|
||||
///
|
||||
/// See clang-format documentation for more about configuring format style.
|
||||
llvm::Optional<std::string> FormatStyle;
|
||||
std::optional<std::string> FormatStyle;
|
||||
|
||||
/// Specifies the name or e-mail of the user running clang-tidy.
|
||||
///
|
||||
/// This option is used, for example, to place the correct user name in TODO()
|
||||
/// comments in the relevant check.
|
||||
llvm::Optional<std::string> User;
|
||||
std::optional<std::string> User;
|
||||
|
||||
/// Helper structure for storing option value with priority of the value.
|
||||
struct ClangTidyValue {
|
||||
@@ -120,10 +121,10 @@ struct ClangTidyOptions {
|
||||
typedef std::vector<std::string> ArgList;
|
||||
|
||||
/// Add extra compilation arguments to the end of the list.
|
||||
llvm::Optional<ArgList> ExtraArgs;
|
||||
std::optional<ArgList> ExtraArgs;
|
||||
|
||||
/// Add extra compilation arguments to the start of the list.
|
||||
llvm::Optional<ArgList> ExtraArgsBefore;
|
||||
std::optional<ArgList> ExtraArgsBefore;
|
||||
|
||||
/// Only used in the FileOptionsProvider and ConfigOptionsProvider. If true
|
||||
/// and using a FileOptionsProvider, it will take a configuration file in the
|
||||
@@ -132,10 +133,10 @@ struct ClangTidyOptions {
|
||||
/// config on top of any configuration file it finds in the directory using
|
||||
/// the same logic as FileOptionsProvider. If false or missing, only this
|
||||
/// configuration file will be used.
|
||||
llvm::Optional<bool> InheritParentConfig;
|
||||
std::optional<bool> InheritParentConfig;
|
||||
|
||||
/// Use colors in diagnostics. If missing, it will be auto detected.
|
||||
llvm::Optional<bool> UseColor;
|
||||
std::optional<bool> UseColor;
|
||||
};
|
||||
|
||||
/// Abstract interface for retrieving various ClangTidy options.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "TodoCommentCheck.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include <optional>
|
||||
|
||||
namespace clang {
|
||||
namespace tidy {
|
||||
@@ -17,7 +18,7 @@ namespace readability {
|
||||
|
||||
class TodoCommentCheck::TodoCommentHandler : public CommentHandler {
|
||||
public:
|
||||
TodoCommentHandler(TodoCommentCheck &Check, llvm::Optional<std::string> User)
|
||||
TodoCommentHandler(TodoCommentCheck &Check, std::optional<std::string> User)
|
||||
: Check(Check), User(User ? *User : "unknown"),
|
||||
TodoMatch("^// *TODO *(\\(.*\\))?:?( )?(.*)$") {}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "llvm/Support/ConvertUTF.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace clang;
|
||||
using namespace clang::tidy::misc;
|
||||
@@ -90,7 +91,7 @@ class MisleadingBidirectionalCheck::MisleadingBidirectionalHandler
|
||||
: public CommentHandler {
|
||||
public:
|
||||
MisleadingBidirectionalHandler(MisleadingBidirectionalCheck &Check,
|
||||
llvm::Optional<std::string> User)
|
||||
std::optional<std::string> User)
|
||||
: Check(Check) {}
|
||||
|
||||
bool HandleComment(Preprocessor &PP, SourceRange Range) override {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "llvm/Support/Signals.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace clang::tooling;
|
||||
using namespace llvm;
|
||||
@@ -308,19 +309,10 @@ static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider(
|
||||
DefaultOptions.HeaderFilterRegex = HeaderFilter;
|
||||
DefaultOptions.SystemHeaders = SystemHeaders;
|
||||
DefaultOptions.FormatStyle = FormatStyle;
|
||||
if (auto User = llvm::sys::Process::GetEnv("USER")) // FIXME(kparzysz-quic)
|
||||
DefaultOptions.User = *User;
|
||||
else
|
||||
DefaultOptions.User = std::nullopt;
|
||||
DefaultOptions.User = llvm::sys::Process::GetEnv("USER");
|
||||
// USERNAME is used on Windows.
|
||||
// if (!DefaultOptions.User)
|
||||
// DefaultOptions.User = llvm::sys::Process::GetEnv("USERNAME");
|
||||
if (!DefaultOptions.User) { // FIXME(kparzysz-quic)
|
||||
if (auto Username = llvm::sys::Process::GetEnv("USERNAME"))
|
||||
DefaultOptions.User = *Username;
|
||||
else
|
||||
DefaultOptions.User = std::nullopt;
|
||||
}
|
||||
if (!DefaultOptions.User)
|
||||
DefaultOptions.User = llvm::sys::Process::GetEnv("USERNAME");
|
||||
|
||||
ClangTidyOptions OverrideOptions;
|
||||
if (Checks.getNumOccurrences() > 0)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "llvm/Support/Process.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace clang {
|
||||
namespace clangd {
|
||||
@@ -136,7 +137,7 @@ public:
|
||||
|
||||
} // namespace
|
||||
|
||||
static void mergeCheckList(llvm::Optional<std::string> &Checks,
|
||||
static void mergeCheckList(std::optional<std::string> &Checks,
|
||||
llvm::StringRef List) {
|
||||
if (List.empty())
|
||||
return;
|
||||
@@ -148,14 +149,13 @@ static void mergeCheckList(llvm::Optional<std::string> &Checks,
|
||||
}
|
||||
|
||||
TidyProviderRef provideEnvironment() {
|
||||
static const llvm::Optional<std::string> User = [] {
|
||||
static const std::optional<std::string> User = [] {
|
||||
std::optional<std::string> Ret = llvm::sys::Process::GetEnv("USER");
|
||||
#ifdef _WIN32
|
||||
if (!Ret)
|
||||
Ret = llvm::sys::Process::GetEnv("USERNAME");
|
||||
return llvm::sys::Process::GetEnv("USERNAME");
|
||||
#endif
|
||||
return Ret ? llvm::Optional<std::string>(*Ret)
|
||||
: llvm::Optional<std::string>();
|
||||
return Ret;
|
||||
}();
|
||||
|
||||
if (User)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "llvm/Support/VersionTuple.h"
|
||||
#include "llvm/Support/YAMLParser.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
using namespace clang;
|
||||
using namespace api_notes;
|
||||
@@ -70,9 +71,9 @@ template <> struct ScalarEnumerationTraits<MethodKind> {
|
||||
namespace {
|
||||
struct Param {
|
||||
unsigned Position;
|
||||
Optional<bool> NoEscape = false;
|
||||
Optional<NullabilityKind> Nullability;
|
||||
Optional<RetainCountConventionKind> RetainCountConvention;
|
||||
std::optional<bool> NoEscape = false;
|
||||
std::optional<NullabilityKind> Nullability;
|
||||
std::optional<RetainCountConventionKind> RetainCountConvention;
|
||||
StringRef Type;
|
||||
};
|
||||
|
||||
@@ -151,10 +152,10 @@ struct Method {
|
||||
MethodKind Kind;
|
||||
ParamsSeq Params;
|
||||
NullabilitySeq Nullability;
|
||||
Optional<NullabilityKind> NullabilityOfRet;
|
||||
Optional<RetainCountConventionKind> RetainCountConvention;
|
||||
std::optional<NullabilityKind> NullabilityOfRet;
|
||||
std::optional<RetainCountConventionKind> RetainCountConvention;
|
||||
AvailabilityItem Availability;
|
||||
Optional<bool> SwiftPrivate;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
StringRef SwiftName;
|
||||
FactoryAsInitKind FactoryAsInit = FactoryAsInitKind::Infer;
|
||||
bool DesignatedInit = false;
|
||||
@@ -202,12 +203,12 @@ template <> struct MappingTraits<Method> {
|
||||
namespace {
|
||||
struct Property {
|
||||
StringRef Name;
|
||||
llvm::Optional<MethodKind> Kind;
|
||||
llvm::Optional<NullabilityKind> Nullability;
|
||||
std::optional<MethodKind> Kind;
|
||||
std::optional<NullabilityKind> Nullability;
|
||||
AvailabilityItem Availability;
|
||||
Optional<bool> SwiftPrivate;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
StringRef SwiftName;
|
||||
Optional<bool> SwiftImportAsAccessors;
|
||||
std::optional<bool> SwiftImportAsAccessors;
|
||||
StringRef Type;
|
||||
};
|
||||
|
||||
@@ -240,12 +241,12 @@ struct Class {
|
||||
StringRef Name;
|
||||
bool AuditedForNullability = false;
|
||||
AvailabilityItem Availability;
|
||||
Optional<bool> SwiftPrivate;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
StringRef SwiftName;
|
||||
Optional<StringRef> SwiftBridge;
|
||||
Optional<StringRef> NSErrorDomain;
|
||||
Optional<bool> SwiftImportAsNonGeneric;
|
||||
Optional<bool> SwiftObjCMembers;
|
||||
std::optional<StringRef> SwiftBridge;
|
||||
std::optional<StringRef> NSErrorDomain;
|
||||
std::optional<bool> SwiftImportAsNonGeneric;
|
||||
std::optional<bool> SwiftObjCMembers;
|
||||
MethodsSeq Methods;
|
||||
PropertiesSeq Properties;
|
||||
};
|
||||
@@ -282,10 +283,10 @@ struct Function {
|
||||
StringRef Name;
|
||||
ParamsSeq Params;
|
||||
NullabilitySeq Nullability;
|
||||
Optional<NullabilityKind> NullabilityOfRet;
|
||||
Optional<api_notes::RetainCountConventionKind> RetainCountConvention;
|
||||
std::optional<NullabilityKind> NullabilityOfRet;
|
||||
std::optional<api_notes::RetainCountConventionKind> RetainCountConvention;
|
||||
AvailabilityItem Availability;
|
||||
Optional<bool> SwiftPrivate;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
StringRef SwiftName;
|
||||
StringRef Type;
|
||||
StringRef ResultType;
|
||||
@@ -319,9 +320,9 @@ template <> struct MappingTraits<Function> {
|
||||
namespace {
|
||||
struct GlobalVariable {
|
||||
StringRef Name;
|
||||
llvm::Optional<NullabilityKind> Nullability;
|
||||
std::optional<NullabilityKind> Nullability;
|
||||
AvailabilityItem Availability;
|
||||
Optional<bool> SwiftPrivate;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
StringRef SwiftName;
|
||||
StringRef Type;
|
||||
};
|
||||
@@ -352,7 +353,7 @@ namespace {
|
||||
struct EnumConstant {
|
||||
StringRef Name;
|
||||
AvailabilityItem Availability;
|
||||
Optional<bool> SwiftPrivate;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
StringRef SwiftName;
|
||||
};
|
||||
|
||||
@@ -411,12 +412,12 @@ struct Tag {
|
||||
StringRef Name;
|
||||
AvailabilityItem Availability;
|
||||
StringRef SwiftName;
|
||||
Optional<bool> SwiftPrivate;
|
||||
Optional<StringRef> SwiftBridge;
|
||||
Optional<StringRef> NSErrorDomain;
|
||||
Optional<EnumExtensibilityKind> EnumExtensibility;
|
||||
Optional<bool> FlagEnum;
|
||||
Optional<EnumConvenienceAliasKind> EnumConvenienceKind;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
std::optional<StringRef> SwiftBridge;
|
||||
std::optional<StringRef> NSErrorDomain;
|
||||
std::optional<EnumExtensibilityKind> EnumExtensibility;
|
||||
std::optional<bool> FlagEnum;
|
||||
std::optional<EnumConvenienceAliasKind> EnumConvenienceKind;
|
||||
};
|
||||
|
||||
typedef std::vector<Tag> TagsSeq;
|
||||
@@ -457,10 +458,10 @@ struct Typedef {
|
||||
StringRef Name;
|
||||
AvailabilityItem Availability;
|
||||
StringRef SwiftName;
|
||||
Optional<bool> SwiftPrivate;
|
||||
Optional<StringRef> SwiftBridge;
|
||||
Optional<StringRef> NSErrorDomain;
|
||||
Optional<SwiftNewTypeKind> SwiftType;
|
||||
std::optional<bool> SwiftPrivate;
|
||||
std::optional<StringRef> SwiftBridge;
|
||||
std::optional<StringRef> NSErrorDomain;
|
||||
std::optional<SwiftNewTypeKind> SwiftType;
|
||||
};
|
||||
|
||||
typedef std::vector<Typedef> TypedefsSeq;
|
||||
@@ -549,7 +550,7 @@ struct Module {
|
||||
TopLevelItems TopLevel;
|
||||
VersionedSeq SwiftVersions;
|
||||
|
||||
llvm::Optional<bool> SwiftInferImportAsMember = {std::nullopt};
|
||||
std::optional<bool> SwiftInferImportAsMember = std::nullopt;
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
LLVM_DUMP_METHOD void dump() /*const*/;
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
#ifndef LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
|
||||
#define LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/BlockFrequency.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -67,13 +67,13 @@ public:
|
||||
/// Returns the estimated profile count of \p BB.
|
||||
/// This computes the relative block frequency of \p BB and multiplies it by
|
||||
/// the enclosing function's count (if available) and returns the value.
|
||||
Optional<uint64_t> getBlockProfileCount(const BasicBlock *BB,
|
||||
bool AllowSynthetic = false) const;
|
||||
std::optional<uint64_t>
|
||||
getBlockProfileCount(const BasicBlock *BB, bool AllowSynthetic = false) const;
|
||||
|
||||
/// Returns the estimated profile count of \p Freq.
|
||||
/// This uses the frequency \p Freq and multiplies it by
|
||||
/// the enclosing function's count (if available) and returns the value.
|
||||
Optional<uint64_t> getProfileCountFromFreq(uint64_t Freq) const;
|
||||
std::optional<uint64_t> getProfileCountFromFreq(uint64_t Freq) const;
|
||||
|
||||
/// Returns true if \p BB is an irreducible loop header
|
||||
/// block. Otherwise false.
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/PostOrderIterator.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
@@ -523,12 +522,12 @@ public:
|
||||
Scaled64 getFloatingBlockFreq(const BlockNode &Node) const;
|
||||
|
||||
BlockFrequency getBlockFreq(const BlockNode &Node) const;
|
||||
Optional<uint64_t> getBlockProfileCount(const Function &F,
|
||||
const BlockNode &Node,
|
||||
bool AllowSynthetic = false) const;
|
||||
Optional<uint64_t> getProfileCountFromFreq(const Function &F,
|
||||
uint64_t Freq,
|
||||
bool AllowSynthetic = false) const;
|
||||
std::optional<uint64_t>
|
||||
getBlockProfileCount(const Function &F, const BlockNode &Node,
|
||||
bool AllowSynthetic = false) const;
|
||||
std::optional<uint64_t>
|
||||
getProfileCountFromFreq(const Function &F, uint64_t Freq,
|
||||
bool AllowSynthetic = false) const;
|
||||
bool isIrrLoopHeader(const BlockNode &Node);
|
||||
|
||||
void setBlockFreq(const BlockNode &Node, uint64_t Freq);
|
||||
@@ -1021,16 +1020,16 @@ public:
|
||||
return BlockFrequencyInfoImplBase::getBlockFreq(getNode(BB));
|
||||
}
|
||||
|
||||
Optional<uint64_t> getBlockProfileCount(const Function &F,
|
||||
const BlockT *BB,
|
||||
bool AllowSynthetic = false) const {
|
||||
std::optional<uint64_t>
|
||||
getBlockProfileCount(const Function &F, const BlockT *BB,
|
||||
bool AllowSynthetic = false) const {
|
||||
return BlockFrequencyInfoImplBase::getBlockProfileCount(F, getNode(BB),
|
||||
AllowSynthetic);
|
||||
}
|
||||
|
||||
Optional<uint64_t> getProfileCountFromFreq(const Function &F,
|
||||
uint64_t Freq,
|
||||
bool AllowSynthetic = false) const {
|
||||
std::optional<uint64_t>
|
||||
getProfileCountFromFreq(const Function &F, uint64_t Freq,
|
||||
bool AllowSynthetic = false) const {
|
||||
return BlockFrequencyInfoImplBase::getProfileCountFromFreq(F, Freq,
|
||||
AllowSynthetic);
|
||||
}
|
||||
@@ -1730,7 +1729,7 @@ raw_ostream &BlockFrequencyInfoImpl<BT>::print(raw_ostream &OS) const {
|
||||
OS << " - " << bfi_detail::getBlockName(&BB) << ": float = ";
|
||||
getFloatingBlockFreq(&BB).print(OS, 5)
|
||||
<< ", int = " << getBlockFreq(&BB).getFrequency();
|
||||
if (Optional<uint64_t> ProfileCount =
|
||||
if (std::optional<uint64_t> ProfileCount =
|
||||
BlockFrequencyInfoImplBase::getBlockProfileCount(
|
||||
F->getFunction(), getNode(&BB)))
|
||||
OS << ", count = " << ProfileCount.value();
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
#ifndef LLVM_ANALYSIS_OPTIMIZATIONREMARKEMITTER_H
|
||||
#define LLVM_ANALYSIS_OPTIMIZATIONREMARKEMITTER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Analysis/BlockFrequencyInfo.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
class Function;
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
|
||||
/// Compute hotness from IR value (currently assumed to be a block) if PGO is
|
||||
/// available.
|
||||
Optional<uint64_t> computeHotness(const Value *V);
|
||||
std::optional<uint64_t> computeHotness(const Value *V);
|
||||
|
||||
/// Similar but use value from \p OptDiag and update hotness there.
|
||||
void computeHotness(DiagnosticInfoIROptimization &OptDiag);
|
||||
|
||||
@@ -98,9 +98,9 @@ public:
|
||||
}
|
||||
|
||||
/// Returns the profile count for \p CallInst.
|
||||
Optional<uint64_t> getProfileCount(const CallBase &CallInst,
|
||||
BlockFrequencyInfo *BFI,
|
||||
bool AllowSynthetic = false) const;
|
||||
std::optional<uint64_t> getProfileCount(const CallBase &CallInst,
|
||||
BlockFrequencyInfo *BFI,
|
||||
bool AllowSynthetic = false) const;
|
||||
/// Returns true if module \c M has partial-profile sample profile.
|
||||
bool hasPartialSampleProfile() const;
|
||||
/// Returns true if the working set size of the code is considered huge.
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#define LLVM_CODEGEN_MBFIWRAPPER_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Support/BlockFrequency.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -30,7 +30,8 @@ class MBFIWrapper {
|
||||
|
||||
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const;
|
||||
void setBlockFreq(const MachineBasicBlock *MBB, BlockFrequency F);
|
||||
Optional<uint64_t> getBlockProfileCount(const MachineBasicBlock *MBB) const;
|
||||
std::optional<uint64_t>
|
||||
getBlockProfileCount(const MachineBasicBlock *MBB) const;
|
||||
|
||||
raw_ostream &printBlockFreq(raw_ostream &OS,
|
||||
const MachineBasicBlock *MBB) const;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#ifndef LLVM_CODEGEN_MIRYAMLMAPPING_H
|
||||
#define LLVM_CODEGEN_MIRYAMLMAPPING_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||
#include "llvm/CodeGen/TargetFrameLowering.h"
|
||||
@@ -23,6 +22,7 @@
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -249,7 +249,7 @@ struct MachineStackObject {
|
||||
TargetStackID::Value StackID;
|
||||
StringValue CalleeSavedRegister;
|
||||
bool CalleeSavedRestored = true;
|
||||
Optional<int64_t> LocalOffset;
|
||||
std::optional<int64_t> LocalOffset;
|
||||
StringValue DebugVar;
|
||||
StringValue DebugExpr;
|
||||
StringValue DebugLoc;
|
||||
@@ -291,7 +291,8 @@ template <> struct MappingTraits<MachineStackObject> {
|
||||
StringValue()); // Don't print it out when it's empty.
|
||||
YamlIO.mapOptional("callee-saved-restored", Object.CalleeSavedRestored,
|
||||
true);
|
||||
YamlIO.mapOptional("local-offset", Object.LocalOffset, Optional<int64_t>());
|
||||
YamlIO.mapOptional("local-offset", Object.LocalOffset,
|
||||
std::optional<int64_t>());
|
||||
YamlIO.mapOptional("debug-info-variable", Object.DebugVar,
|
||||
StringValue()); // Don't print it out when it's empty.
|
||||
YamlIO.mapOptional("debug-info-expression", Object.DebugExpr,
|
||||
@@ -708,7 +709,7 @@ struct MachineFunction {
|
||||
bool TracksDebugUserValues = false;
|
||||
std::vector<VirtualRegisterDefinition> VirtualRegisters;
|
||||
std::vector<MachineFunctionLiveIn> LiveIns;
|
||||
Optional<std::vector<FlowStringValue>> CalleeSavedRegisters;
|
||||
std::optional<std::vector<FlowStringValue>> CalleeSavedRegisters;
|
||||
// TODO: Serialize the various register masks.
|
||||
// Frame information
|
||||
MachineFrameInfo FrameInfo;
|
||||
@@ -749,7 +750,7 @@ template <> struct MappingTraits<MachineFunction> {
|
||||
YamlIO.mapOptional("liveins", MF.LiveIns,
|
||||
std::vector<MachineFunctionLiveIn>());
|
||||
YamlIO.mapOptional("calleeSavedRegisters", MF.CalleeSavedRegisters,
|
||||
Optional<std::vector<FlowStringValue>>());
|
||||
std::optional<std::vector<FlowStringValue>>());
|
||||
YamlIO.mapOptional("frameInfo", MF.FrameInfo, MachineFrameInfo());
|
||||
YamlIO.mapOptional("fixedStack", MF.FixedStackObjects,
|
||||
std::vector<FixedMachineStackObject>());
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
|
||||
#define LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/Support/BlockFrequency.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -69,8 +69,9 @@ public:
|
||||
return getBlockFreq(MBB).getFrequency() * (1.0f / getEntryFreq());
|
||||
}
|
||||
|
||||
Optional<uint64_t> getBlockProfileCount(const MachineBasicBlock *MBB) const;
|
||||
Optional<uint64_t> getProfileCountFromFreq(uint64_t Freq) const;
|
||||
std::optional<uint64_t>
|
||||
getBlockProfileCount(const MachineBasicBlock *MBB) const;
|
||||
std::optional<uint64_t> getProfileCountFromFreq(uint64_t Freq) const;
|
||||
|
||||
bool isIrrLoopHeader(const MachineBasicBlock *MBB) const;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
class MachineBasicBlock;
|
||||
@@ -201,7 +202,7 @@ private:
|
||||
|
||||
/// Compute hotness from IR value (currently assumed to be a block) if PGO is
|
||||
/// available.
|
||||
Optional<uint64_t> computeHotness(const MachineBasicBlock &MBB);
|
||||
std::optional<uint64_t> computeHotness(const MachineBasicBlock &MBB);
|
||||
|
||||
/// Similar but use value from \p OptDiag and update hotness there.
|
||||
void computeHotness(DiagnosticInfoMIROptimization &Remark);
|
||||
|
||||
@@ -347,7 +347,7 @@ public:
|
||||
|
||||
TypeIndex ReferentType;
|
||||
uint32_t Attrs = 0;
|
||||
Optional<MemberPointerInfo> MemberInfo;
|
||||
std::optional<MemberPointerInfo> MemberInfo;
|
||||
|
||||
void setAttrs(PointerKind PK, PointerMode PM, PointerOptions PO,
|
||||
uint8_t Size) {
|
||||
|
||||
@@ -479,8 +479,8 @@ public:
|
||||
StringRef getPassName() const { return PassName; }
|
||||
StringRef getRemarkName() const { return RemarkName; }
|
||||
std::string getMsg() const;
|
||||
Optional<uint64_t> getHotness() const { return Hotness; }
|
||||
void setHotness(Optional<uint64_t> H) { Hotness = H; }
|
||||
std::optional<uint64_t> getHotness() const { return Hotness; }
|
||||
void setHotness(std::optional<uint64_t> H) { Hotness = H; }
|
||||
|
||||
bool isVerbose() const { return IsVerbose; }
|
||||
|
||||
@@ -521,7 +521,7 @@ protected:
|
||||
|
||||
/// If profile information is available, this is the number of times the
|
||||
/// corresponding code was executed in a profile instrumentation run.
|
||||
Optional<uint64_t> Hotness;
|
||||
std::optional<uint64_t> Hotness;
|
||||
|
||||
/// Arguments collected via the streaming interface.
|
||||
SmallVector<Argument, 4> Args;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/VersionTuple.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -41,10 +42,10 @@ Expected<std::unique_ptr<IFSStub>> readIFSFromBuffer(StringRef Buf);
|
||||
Error writeIFSToOutputStream(raw_ostream &OS, const IFSStub &Stub);
|
||||
|
||||
/// Override the target platform inforation in the text stub.
|
||||
Error overrideIFSTarget(IFSStub &Stub, Optional<IFSArch> OverrideArch,
|
||||
Optional<IFSEndiannessType> OverrideEndianness,
|
||||
Optional<IFSBitWidthType> OverrideBitWidth,
|
||||
Optional<std::string> OverrideTriple);
|
||||
Error overrideIFSTarget(IFSStub &Stub, std::optional<IFSArch> OverrideArch,
|
||||
std::optional<IFSEndiannessType> OverrideEndianness,
|
||||
std::optional<IFSBitWidthType> OverrideBitWidth,
|
||||
std::optional<std::string> OverrideTriple);
|
||||
|
||||
/// Validate the target platform inforation in the text stub.
|
||||
Error validateIFSTarget(IFSStub &Stub, bool ParseTriple);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#ifndef LLVM_INTERFACESTUB_IFSSTUB_H
|
||||
#define LLVM_INTERFACESTUB_IFSSTUB_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Support/VersionTuple.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@@ -53,21 +53,21 @@ struct IFSSymbol {
|
||||
IFSSymbol() = default;
|
||||
explicit IFSSymbol(std::string SymbolName) : Name(std::move(SymbolName)) {}
|
||||
std::string Name;
|
||||
Optional<uint64_t> Size;
|
||||
std::optional<uint64_t> Size;
|
||||
IFSSymbolType Type;
|
||||
bool Undefined;
|
||||
bool Weak;
|
||||
Optional<std::string> Warning;
|
||||
std::optional<std::string> Warning;
|
||||
bool operator<(const IFSSymbol &RHS) const { return Name < RHS.Name; }
|
||||
};
|
||||
|
||||
struct IFSTarget {
|
||||
Optional<std::string> Triple;
|
||||
Optional<std::string> ObjectFormat;
|
||||
Optional<IFSArch> Arch;
|
||||
Optional<std::string> ArchString;
|
||||
Optional<IFSEndiannessType> Endianness;
|
||||
Optional<IFSBitWidthType> BitWidth;
|
||||
std::optional<std::string> Triple;
|
||||
std::optional<std::string> ObjectFormat;
|
||||
std::optional<IFSArch> Arch;
|
||||
std::optional<std::string> ArchString;
|
||||
std::optional<IFSEndiannessType> Endianness;
|
||||
std::optional<IFSBitWidthType> BitWidth;
|
||||
|
||||
bool empty();
|
||||
};
|
||||
@@ -89,7 +89,7 @@ inline bool operator!=(const IFSTarget &Lhs, const IFSTarget &Rhs) {
|
||||
struct IFSStub {
|
||||
// TODO: Add support for symbol versioning.
|
||||
VersionTuple IfsVersion;
|
||||
Optional<std::string> SoName;
|
||||
std::optional<std::string> SoName;
|
||||
IFSTarget Target;
|
||||
std::vector<std::string> NeededLibs;
|
||||
std::vector<IFSSymbol> Symbols;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "llvm/ObjectYAML/YAML.h"
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
namespace ArchYAML {
|
||||
@@ -44,13 +45,13 @@ struct Archive {
|
||||
|
||||
MapVector<StringRef, Field> Fields;
|
||||
|
||||
Optional<yaml::BinaryRef> Content;
|
||||
Optional<llvm::yaml::Hex8> PaddingByte;
|
||||
std::optional<yaml::BinaryRef> Content;
|
||||
std::optional<llvm::yaml::Hex8> PaddingByte;
|
||||
};
|
||||
|
||||
StringRef Magic;
|
||||
Optional<std::vector<Child>> Members;
|
||||
Optional<yaml::BinaryRef> Content;
|
||||
std::optional<std::vector<Child>> Members;
|
||||
std::optional<yaml::BinaryRef> Content;
|
||||
};
|
||||
|
||||
} // end namespace ArchYAML
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "llvm/ObjectYAML/CodeViewYAMLTypes.h"
|
||||
#include "llvm/ObjectYAML/YAML.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@@ -63,7 +64,7 @@ struct Relocation {
|
||||
// specified), allowing disambiguating between multiple symbols with the
|
||||
// same name or crafting intentionally broken files for testing.
|
||||
StringRef SymbolName;
|
||||
Optional<uint32_t> SymbolTableIndex;
|
||||
std::optional<uint32_t> SymbolTableIndex;
|
||||
};
|
||||
|
||||
struct Section {
|
||||
@@ -73,7 +74,7 @@ struct Section {
|
||||
std::vector<CodeViewYAML::YAMLDebugSubsection> DebugS;
|
||||
std::vector<CodeViewYAML::LeafRecord> DebugT;
|
||||
std::vector<CodeViewYAML::LeafRecord> DebugP;
|
||||
Optional<CodeViewYAML::DebugHSection> DebugH;
|
||||
std::optional<CodeViewYAML::DebugHSection> DebugH;
|
||||
std::vector<Relocation> Relocations;
|
||||
StringRef Name;
|
||||
|
||||
@@ -84,12 +85,12 @@ struct Symbol {
|
||||
COFF::symbol Header;
|
||||
COFF::SymbolBaseType SimpleType = COFF::IMAGE_SYM_TYPE_NULL;
|
||||
COFF::SymbolComplexType ComplexType = COFF::IMAGE_SYM_DTYPE_NULL;
|
||||
Optional<COFF::AuxiliaryFunctionDefinition> FunctionDefinition;
|
||||
Optional<COFF::AuxiliarybfAndefSymbol> bfAndefSymbol;
|
||||
Optional<COFF::AuxiliaryWeakExternal> WeakExternal;
|
||||
std::optional<COFF::AuxiliaryFunctionDefinition> FunctionDefinition;
|
||||
std::optional<COFF::AuxiliarybfAndefSymbol> bfAndefSymbol;
|
||||
std::optional<COFF::AuxiliaryWeakExternal> WeakExternal;
|
||||
StringRef File;
|
||||
Optional<COFF::AuxiliarySectionDefinition> SectionDefinition;
|
||||
Optional<COFF::AuxiliaryCLRToken> CLRToken;
|
||||
std::optional<COFF::AuxiliarySectionDefinition> SectionDefinition;
|
||||
std::optional<COFF::AuxiliaryCLRToken> CLRToken;
|
||||
StringRef Name;
|
||||
|
||||
Symbol();
|
||||
@@ -97,11 +98,12 @@ struct Symbol {
|
||||
|
||||
struct PEHeader {
|
||||
COFF::PE32Header Header;
|
||||
Optional<COFF::DataDirectory> DataDirectories[COFF::NUM_DATA_DIRECTORIES];
|
||||
std::optional<COFF::DataDirectory>
|
||||
DataDirectories[COFF::NUM_DATA_DIRECTORIES];
|
||||
};
|
||||
|
||||
struct Object {
|
||||
Optional<PEHeader> OptionalHeader;
|
||||
std::optional<PEHeader> OptionalHeader;
|
||||
COFF::header Header;
|
||||
std::vector<Section> Sections;
|
||||
std::vector<Symbol> Symbols;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "llvm/ObjectYAML/YAML.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
@@ -34,14 +35,14 @@ struct AttributeAbbrev {
|
||||
};
|
||||
|
||||
struct Abbrev {
|
||||
Optional<yaml::Hex64> Code;
|
||||
std::optional<yaml::Hex64> Code;
|
||||
llvm::dwarf::Tag Tag;
|
||||
llvm::dwarf::Constants Children;
|
||||
std::vector<AttributeAbbrev> Attributes;
|
||||
};
|
||||
|
||||
struct AbbrevTable {
|
||||
Optional<uint64_t> ID;
|
||||
std::optional<uint64_t> ID;
|
||||
std::vector<Abbrev> Table;
|
||||
};
|
||||
|
||||
@@ -52,10 +53,10 @@ struct ARangeDescriptor {
|
||||
|
||||
struct ARange {
|
||||
dwarf::DwarfFormat Format;
|
||||
Optional<yaml::Hex64> Length;
|
||||
std::optional<yaml::Hex64> Length;
|
||||
uint16_t Version;
|
||||
yaml::Hex64 CuOffset;
|
||||
Optional<yaml::Hex8> AddrSize;
|
||||
std::optional<yaml::Hex8> AddrSize;
|
||||
yaml::Hex8 SegSize;
|
||||
std::vector<ARangeDescriptor> Descriptors;
|
||||
};
|
||||
@@ -69,8 +70,8 @@ struct RangeEntry {
|
||||
|
||||
/// Class that describes a single range list inside the .debug_ranges section.
|
||||
struct Ranges {
|
||||
Optional<llvm::yaml::Hex64> Offset;
|
||||
Optional<llvm::yaml::Hex8> AddrSize;
|
||||
std::optional<llvm::yaml::Hex64> Offset;
|
||||
std::optional<llvm::yaml::Hex8> AddrSize;
|
||||
std::vector<RangeEntry> Entries;
|
||||
};
|
||||
|
||||
@@ -108,12 +109,12 @@ struct DWARFContext {
|
||||
|
||||
struct Unit {
|
||||
dwarf::DwarfFormat Format;
|
||||
Optional<yaml::Hex64> Length;
|
||||
std::optional<yaml::Hex64> Length;
|
||||
uint16_t Version;
|
||||
Optional<uint8_t> AddrSize;
|
||||
std::optional<uint8_t> AddrSize;
|
||||
llvm::dwarf::UnitType Type; // Added in DWARF 5
|
||||
Optional<uint64_t> AbbrevTableID;
|
||||
Optional<yaml::Hex64> AbbrOffset;
|
||||
std::optional<uint64_t> AbbrevTableID;
|
||||
std::optional<yaml::Hex64> AbbrOffset;
|
||||
std::vector<Entry> Entries;
|
||||
};
|
||||
|
||||
@@ -126,7 +127,7 @@ struct File {
|
||||
|
||||
struct LineTableOpcode {
|
||||
dwarf::LineNumberOps Opcode;
|
||||
Optional<uint64_t> ExtLen;
|
||||
std::optional<uint64_t> ExtLen;
|
||||
dwarf::LineNumberExtendedOps SubOpcode;
|
||||
uint64_t Data;
|
||||
int64_t SData;
|
||||
@@ -137,16 +138,16 @@ struct LineTableOpcode {
|
||||
|
||||
struct LineTable {
|
||||
dwarf::DwarfFormat Format;
|
||||
Optional<uint64_t> Length;
|
||||
std::optional<uint64_t> Length;
|
||||
uint16_t Version;
|
||||
Optional<uint64_t> PrologueLength;
|
||||
std::optional<uint64_t> PrologueLength;
|
||||
uint8_t MinInstLength;
|
||||
uint8_t MaxOpsPerInst;
|
||||
uint8_t DefaultIsStmt;
|
||||
uint8_t LineBase;
|
||||
uint8_t LineRange;
|
||||
Optional<uint8_t> OpcodeBase;
|
||||
Optional<std::vector<uint8_t>> StandardOpcodeLengths;
|
||||
std::optional<uint8_t> OpcodeBase;
|
||||
std::optional<std::vector<uint8_t>> StandardOpcodeLengths;
|
||||
std::vector<StringRef> IncludeDirs;
|
||||
std::vector<File> Files;
|
||||
std::vector<LineTableOpcode> Opcodes;
|
||||
@@ -159,16 +160,16 @@ struct SegAddrPair {
|
||||
|
||||
struct AddrTableEntry {
|
||||
dwarf::DwarfFormat Format;
|
||||
Optional<yaml::Hex64> Length;
|
||||
std::optional<yaml::Hex64> Length;
|
||||
yaml::Hex16 Version;
|
||||
Optional<yaml::Hex8> AddrSize;
|
||||
std::optional<yaml::Hex8> AddrSize;
|
||||
yaml::Hex8 SegSelectorSize;
|
||||
std::vector<SegAddrPair> SegAddrPairs;
|
||||
};
|
||||
|
||||
struct StringOffsetsTable {
|
||||
dwarf::DwarfFormat Format;
|
||||
Optional<yaml::Hex64> Length;
|
||||
std::optional<yaml::Hex64> Length;
|
||||
yaml::Hex16 Version;
|
||||
yaml::Hex16 Padding;
|
||||
std::vector<yaml::Hex64> Offsets;
|
||||
@@ -187,23 +188,23 @@ struct RnglistEntry {
|
||||
struct LoclistEntry {
|
||||
dwarf::LoclistEntries Operator;
|
||||
std::vector<yaml::Hex64> Values;
|
||||
Optional<yaml::Hex64> DescriptionsLength;
|
||||
std::optional<yaml::Hex64> DescriptionsLength;
|
||||
std::vector<DWARFOperation> Descriptions;
|
||||
};
|
||||
|
||||
template <typename EntryType> struct ListEntries {
|
||||
Optional<std::vector<EntryType>> Entries;
|
||||
Optional<yaml::BinaryRef> Content;
|
||||
std::optional<std::vector<EntryType>> Entries;
|
||||
std::optional<yaml::BinaryRef> Content;
|
||||
};
|
||||
|
||||
template <typename EntryType> struct ListTable {
|
||||
dwarf::DwarfFormat Format;
|
||||
Optional<yaml::Hex64> Length;
|
||||
std::optional<yaml::Hex64> Length;
|
||||
yaml::Hex16 Version;
|
||||
Optional<yaml::Hex8> AddrSize;
|
||||
std::optional<yaml::Hex8> AddrSize;
|
||||
yaml::Hex8 SegSelectorSize;
|
||||
Optional<uint32_t> OffsetEntryCount;
|
||||
Optional<std::vector<yaml::Hex64>> Offsets;
|
||||
std::optional<uint32_t> OffsetEntryCount;
|
||||
std::optional<std::vector<yaml::Hex64>> Offsets;
|
||||
std::vector<ListEntries<EntryType>> Lists;
|
||||
};
|
||||
|
||||
@@ -211,22 +212,22 @@ struct Data {
|
||||
bool IsLittleEndian;
|
||||
bool Is64BitAddrSize;
|
||||
std::vector<AbbrevTable> DebugAbbrev;
|
||||
Optional<std::vector<StringRef>> DebugStrings;
|
||||
Optional<std::vector<StringOffsetsTable>> DebugStrOffsets;
|
||||
Optional<std::vector<ARange>> DebugAranges;
|
||||
Optional<std::vector<Ranges>> DebugRanges;
|
||||
Optional<std::vector<AddrTableEntry>> DebugAddr;
|
||||
Optional<PubSection> PubNames;
|
||||
Optional<PubSection> PubTypes;
|
||||
std::optional<std::vector<StringRef>> DebugStrings;
|
||||
std::optional<std::vector<StringOffsetsTable>> DebugStrOffsets;
|
||||
std::optional<std::vector<ARange>> DebugAranges;
|
||||
std::optional<std::vector<Ranges>> DebugRanges;
|
||||
std::optional<std::vector<AddrTableEntry>> DebugAddr;
|
||||
std::optional<PubSection> PubNames;
|
||||
std::optional<PubSection> PubTypes;
|
||||
|
||||
Optional<PubSection> GNUPubNames;
|
||||
Optional<PubSection> GNUPubTypes;
|
||||
std::optional<PubSection> GNUPubNames;
|
||||
std::optional<PubSection> GNUPubTypes;
|
||||
|
||||
std::vector<Unit> CompileUnits;
|
||||
|
||||
std::vector<LineTable> DebugLines;
|
||||
Optional<std::vector<ListTable<RnglistEntry>>> DebugRnglists;
|
||||
Optional<std::vector<ListTable<LoclistEntry>>> DebugLoclists;
|
||||
std::optional<std::vector<ListTable<RnglistEntry>>> DebugRnglists;
|
||||
std::optional<std::vector<ListTable<LoclistEntry>>> DebugLoclists;
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "llvm/ObjectYAML/YAML.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -37,21 +38,21 @@ struct VersionTuple {
|
||||
struct FileHeader {
|
||||
std::vector<llvm::yaml::Hex8> Hash;
|
||||
VersionTuple Version;
|
||||
Optional<uint32_t> FileSize;
|
||||
std::optional<uint32_t> FileSize;
|
||||
uint32_t PartCount;
|
||||
Optional<std::vector<uint32_t>> PartOffsets;
|
||||
std::optional<std::vector<uint32_t>> PartOffsets;
|
||||
};
|
||||
|
||||
struct DXILProgram {
|
||||
uint8_t MajorVersion;
|
||||
uint8_t MinorVersion;
|
||||
uint16_t ShaderKind;
|
||||
Optional<uint32_t> Size;
|
||||
std::optional<uint32_t> Size;
|
||||
uint16_t DXILMajorVersion;
|
||||
uint16_t DXILMinorVersion;
|
||||
Optional<uint32_t> DXILOffset;
|
||||
Optional<uint32_t> DXILSize;
|
||||
Optional<std::vector<llvm::yaml::Hex8>> DXIL;
|
||||
std::optional<uint32_t> DXILOffset;
|
||||
std::optional<uint32_t> DXILSize;
|
||||
std::optional<std::vector<llvm::yaml::Hex8>> DXIL;
|
||||
};
|
||||
|
||||
#define SHADER_FLAG(Num, Val, Str) bool Val = false;
|
||||
@@ -75,9 +76,9 @@ struct Part {
|
||||
Part(std::string N, uint32_t S) : Name(N), Size(S) {}
|
||||
std::string Name;
|
||||
uint32_t Size;
|
||||
Optional<DXILProgram> Program;
|
||||
Optional<ShaderFlags> Flags;
|
||||
Optional<ShaderHash> Hash;
|
||||
std::optional<DXILProgram> Program;
|
||||
std::optional<ShaderFlags> Flags;
|
||||
std::optional<ShaderHash> Hash;
|
||||
};
|
||||
|
||||
struct Object {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@@ -115,18 +116,18 @@ struct FileHeader {
|
||||
ELF_ELFOSABI OSABI;
|
||||
llvm::yaml::Hex8 ABIVersion;
|
||||
ELF_ET Type;
|
||||
Optional<ELF_EM> Machine;
|
||||
std::optional<ELF_EM> Machine;
|
||||
ELF_EF Flags;
|
||||
llvm::yaml::Hex64 Entry;
|
||||
Optional<StringRef> SectionHeaderStringTable;
|
||||
std::optional<StringRef> SectionHeaderStringTable;
|
||||
|
||||
Optional<llvm::yaml::Hex64> EPhOff;
|
||||
Optional<llvm::yaml::Hex16> EPhEntSize;
|
||||
Optional<llvm::yaml::Hex16> EPhNum;
|
||||
Optional<llvm::yaml::Hex16> EShEntSize;
|
||||
Optional<llvm::yaml::Hex64> EShOff;
|
||||
Optional<llvm::yaml::Hex16> EShNum;
|
||||
Optional<llvm::yaml::Hex16> EShStrNdx;
|
||||
std::optional<llvm::yaml::Hex64> EPhOff;
|
||||
std::optional<llvm::yaml::Hex16> EPhEntSize;
|
||||
std::optional<llvm::yaml::Hex16> EPhNum;
|
||||
std::optional<llvm::yaml::Hex16> EShEntSize;
|
||||
std::optional<llvm::yaml::Hex64> EShOff;
|
||||
std::optional<llvm::yaml::Hex16> EShNum;
|
||||
std::optional<llvm::yaml::Hex16> EShStrNdx;
|
||||
};
|
||||
|
||||
struct SectionHeader {
|
||||
@@ -136,14 +137,14 @@ struct SectionHeader {
|
||||
struct Symbol {
|
||||
StringRef Name;
|
||||
ELF_STT Type;
|
||||
Optional<StringRef> Section;
|
||||
Optional<ELF_SHN> Index;
|
||||
std::optional<StringRef> Section;
|
||||
std::optional<ELF_SHN> Index;
|
||||
ELF_STB Binding;
|
||||
Optional<llvm::yaml::Hex64> Value;
|
||||
Optional<llvm::yaml::Hex64> Size;
|
||||
Optional<uint8_t> Other;
|
||||
std::optional<llvm::yaml::Hex64> Value;
|
||||
std::optional<llvm::yaml::Hex64> Size;
|
||||
std::optional<uint8_t> Other;
|
||||
|
||||
Optional<uint32_t> StName;
|
||||
std::optional<uint32_t> StName;
|
||||
};
|
||||
|
||||
struct SectionOrType {
|
||||
@@ -164,8 +165,8 @@ struct BBAddrMapEntry {
|
||||
uint8_t Version;
|
||||
llvm::yaml::Hex8 Feature;
|
||||
llvm::yaml::Hex64 Address;
|
||||
Optional<uint64_t> NumBlocks;
|
||||
Optional<std::vector<BBEntry>> BBEntries;
|
||||
std::optional<uint64_t> NumBlocks;
|
||||
std::optional<std::vector<BBEntry>> BBEntries;
|
||||
};
|
||||
|
||||
struct StackSizeEntry {
|
||||
@@ -211,7 +212,7 @@ struct Chunk {
|
||||
|
||||
ChunkKind Kind;
|
||||
StringRef Name;
|
||||
Optional<llvm::yaml::Hex64> Offset;
|
||||
std::optional<llvm::yaml::Hex64> Offset;
|
||||
|
||||
// Usually chunks are not created implicitly, but rather loaded from YAML.
|
||||
// This flag is used to signal whether this is the case or not.
|
||||
@@ -223,14 +224,14 @@ struct Chunk {
|
||||
|
||||
struct Section : public Chunk {
|
||||
ELF_SHT Type;
|
||||
Optional<ELF_SHF> Flags;
|
||||
Optional<llvm::yaml::Hex64> Address;
|
||||
Optional<StringRef> Link;
|
||||
std::optional<ELF_SHF> Flags;
|
||||
std::optional<llvm::yaml::Hex64> Address;
|
||||
std::optional<StringRef> Link;
|
||||
llvm::yaml::Hex64 AddressAlign;
|
||||
Optional<llvm::yaml::Hex64> EntSize;
|
||||
std::optional<llvm::yaml::Hex64> EntSize;
|
||||
|
||||
Optional<yaml::BinaryRef> Content;
|
||||
Optional<llvm::yaml::Hex64> Size;
|
||||
std::optional<yaml::BinaryRef> Content;
|
||||
std::optional<llvm::yaml::Hex64> Size;
|
||||
|
||||
// Holds the original section index.
|
||||
unsigned OriginalSecNdx;
|
||||
@@ -252,35 +253,35 @@ struct Section : public Chunk {
|
||||
// useful for creating invalid objects.
|
||||
|
||||
// This can be used to override the sh_addralign field.
|
||||
Optional<llvm::yaml::Hex64> ShAddrAlign;
|
||||
std::optional<llvm::yaml::Hex64> ShAddrAlign;
|
||||
|
||||
// This can be used to override the offset stored in the sh_name field.
|
||||
// It does not affect the name stored in the string table.
|
||||
Optional<llvm::yaml::Hex64> ShName;
|
||||
std::optional<llvm::yaml::Hex64> ShName;
|
||||
|
||||
// This can be used to override the sh_offset field. It does not place the
|
||||
// section data at the offset specified.
|
||||
Optional<llvm::yaml::Hex64> ShOffset;
|
||||
std::optional<llvm::yaml::Hex64> ShOffset;
|
||||
|
||||
// This can be used to override the sh_size field. It does not affect the
|
||||
// content written.
|
||||
Optional<llvm::yaml::Hex64> ShSize;
|
||||
std::optional<llvm::yaml::Hex64> ShSize;
|
||||
|
||||
// This can be used to override the sh_flags field.
|
||||
Optional<llvm::yaml::Hex64> ShFlags;
|
||||
std::optional<llvm::yaml::Hex64> ShFlags;
|
||||
|
||||
// This can be used to override the sh_type field. It is useful when we
|
||||
// want to use specific YAML keys for a section of a particular type to
|
||||
// describe the content, but still want to have a different final type
|
||||
// for the section.
|
||||
Optional<ELF_SHT> ShType;
|
||||
std::optional<ELF_SHT> ShType;
|
||||
};
|
||||
|
||||
// Fill is a block of data which is placed outside of sections. It is
|
||||
// not present in the sections header table, but it might affect the output file
|
||||
// size and program headers produced.
|
||||
struct Fill : Chunk {
|
||||
Optional<yaml::BinaryRef> Pattern;
|
||||
std::optional<yaml::BinaryRef> Pattern;
|
||||
llvm::yaml::Hex64 Size;
|
||||
|
||||
Fill() : Chunk(ChunkKind::Fill, /*Implicit=*/false) {}
|
||||
@@ -296,9 +297,9 @@ struct SectionHeaderTable : Chunk {
|
||||
return S->Kind == ChunkKind::SectionHeaderTable;
|
||||
}
|
||||
|
||||
Optional<std::vector<SectionHeader>> Sections;
|
||||
Optional<std::vector<SectionHeader>> Excluded;
|
||||
Optional<bool> NoHeaders;
|
||||
std::optional<std::vector<SectionHeader>> Sections;
|
||||
std::optional<std::vector<SectionHeader>> Excluded;
|
||||
std::optional<bool> NoHeaders;
|
||||
|
||||
size_t getNumHeaders(size_t SectionsNum) const {
|
||||
if (IsImplicit || isDefault())
|
||||
@@ -314,7 +315,7 @@ struct SectionHeaderTable : Chunk {
|
||||
};
|
||||
|
||||
struct BBAddrMapSection : Section {
|
||||
Optional<std::vector<BBAddrMapEntry>> Entries;
|
||||
std::optional<std::vector<BBAddrMapEntry>> Entries;
|
||||
|
||||
BBAddrMapSection() : Section(ChunkKind::BBAddrMap) {}
|
||||
|
||||
@@ -328,7 +329,7 @@ struct BBAddrMapSection : Section {
|
||||
};
|
||||
|
||||
struct StackSizesSection : Section {
|
||||
Optional<std::vector<StackSizeEntry>> Entries;
|
||||
std::optional<std::vector<StackSizeEntry>> Entries;
|
||||
|
||||
StackSizesSection() : Section(ChunkKind::StackSizes) {}
|
||||
|
||||
@@ -346,7 +347,7 @@ struct StackSizesSection : Section {
|
||||
};
|
||||
|
||||
struct DynamicSection : Section {
|
||||
Optional<std::vector<DynamicEntry>> Entries;
|
||||
std::optional<std::vector<DynamicEntry>> Entries;
|
||||
|
||||
DynamicSection() : Section(ChunkKind::Dynamic) {}
|
||||
|
||||
@@ -358,7 +359,7 @@ struct DynamicSection : Section {
|
||||
};
|
||||
|
||||
struct RawContentSection : Section {
|
||||
Optional<llvm::yaml::Hex64> Info;
|
||||
std::optional<llvm::yaml::Hex64> Info;
|
||||
|
||||
RawContentSection() : Section(ChunkKind::RawContent) {}
|
||||
|
||||
@@ -367,7 +368,7 @@ struct RawContentSection : Section {
|
||||
}
|
||||
|
||||
// Is used when a content is read as an array of bytes.
|
||||
Optional<std::vector<uint8_t>> ContentBuf;
|
||||
std::optional<std::vector<uint8_t>> ContentBuf;
|
||||
};
|
||||
|
||||
struct NoBitsSection : Section {
|
||||
@@ -377,7 +378,7 @@ struct NoBitsSection : Section {
|
||||
};
|
||||
|
||||
struct NoteSection : Section {
|
||||
Optional<std::vector<ELFYAML::NoteEntry>> Notes;
|
||||
std::optional<std::vector<ELFYAML::NoteEntry>> Notes;
|
||||
|
||||
NoteSection() : Section(ChunkKind::Note) {}
|
||||
|
||||
@@ -389,8 +390,8 @@ struct NoteSection : Section {
|
||||
};
|
||||
|
||||
struct HashSection : Section {
|
||||
Optional<std::vector<uint32_t>> Bucket;
|
||||
Optional<std::vector<uint32_t>> Chain;
|
||||
std::optional<std::vector<uint32_t>> Bucket;
|
||||
std::optional<std::vector<uint32_t>> Chain;
|
||||
|
||||
std::vector<std::pair<StringRef, bool>> getEntries() const override {
|
||||
return {{"Bucket", Bucket.has_value()}, {"Chain", Chain.has_value()}};
|
||||
@@ -398,8 +399,8 @@ struct HashSection : Section {
|
||||
|
||||
// The following members are used to override section fields.
|
||||
// This is useful for creating invalid objects.
|
||||
Optional<llvm::yaml::Hex64> NBucket;
|
||||
Optional<llvm::yaml::Hex64> NChain;
|
||||
std::optional<llvm::yaml::Hex64> NBucket;
|
||||
std::optional<llvm::yaml::Hex64> NChain;
|
||||
|
||||
HashSection() : Section(ChunkKind::Hash) {}
|
||||
|
||||
@@ -410,7 +411,7 @@ struct GnuHashHeader {
|
||||
// The number of hash buckets.
|
||||
// Not used when dumping the object, but can be used to override
|
||||
// the real number of buckets when emiting an object from a YAML document.
|
||||
Optional<llvm::yaml::Hex32> NBuckets;
|
||||
std::optional<llvm::yaml::Hex32> NBuckets;
|
||||
|
||||
// Index of the first symbol in the dynamic symbol table
|
||||
// included in the hash table.
|
||||
@@ -420,17 +421,17 @@ struct GnuHashHeader {
|
||||
// Not used when dumping the object, but can be used to override the real
|
||||
// number of words in the Bloom filter when emiting an object from a YAML
|
||||
// document.
|
||||
Optional<llvm::yaml::Hex32> MaskWords;
|
||||
std::optional<llvm::yaml::Hex32> MaskWords;
|
||||
|
||||
// A shift constant used by the Bloom filter.
|
||||
llvm::yaml::Hex32 Shift2;
|
||||
};
|
||||
|
||||
struct GnuHashSection : Section {
|
||||
Optional<GnuHashHeader> Header;
|
||||
Optional<std::vector<llvm::yaml::Hex64>> BloomFilter;
|
||||
Optional<std::vector<llvm::yaml::Hex32>> HashBuckets;
|
||||
Optional<std::vector<llvm::yaml::Hex32>> HashValues;
|
||||
std::optional<GnuHashHeader> Header;
|
||||
std::optional<std::vector<llvm::yaml::Hex64>> BloomFilter;
|
||||
std::optional<std::vector<llvm::yaml::Hex32>> HashBuckets;
|
||||
std::optional<std::vector<llvm::yaml::Hex32>> HashValues;
|
||||
|
||||
GnuHashSection() : Section(ChunkKind::GnuHash) {}
|
||||
|
||||
@@ -458,8 +459,8 @@ struct VerneedEntry {
|
||||
};
|
||||
|
||||
struct VerneedSection : Section {
|
||||
Optional<std::vector<VerneedEntry>> VerneedV;
|
||||
Optional<llvm::yaml::Hex64> Info;
|
||||
std::optional<std::vector<VerneedEntry>> VerneedV;
|
||||
std::optional<llvm::yaml::Hex64> Info;
|
||||
|
||||
VerneedSection() : Section(ChunkKind::Verneed) {}
|
||||
|
||||
@@ -473,7 +474,7 @@ struct VerneedSection : Section {
|
||||
};
|
||||
|
||||
struct AddrsigSection : Section {
|
||||
Optional<std::vector<YAMLFlowString>> Symbols;
|
||||
std::optional<std::vector<YAMLFlowString>> Symbols;
|
||||
|
||||
AddrsigSection() : Section(ChunkKind::Addrsig) {}
|
||||
|
||||
@@ -490,7 +491,7 @@ struct LinkerOption {
|
||||
};
|
||||
|
||||
struct LinkerOptionsSection : Section {
|
||||
Optional<std::vector<LinkerOption>> Options;
|
||||
std::optional<std::vector<LinkerOption>> Options;
|
||||
|
||||
LinkerOptionsSection() : Section(ChunkKind::LinkerOptions) {}
|
||||
|
||||
@@ -504,7 +505,7 @@ struct LinkerOptionsSection : Section {
|
||||
};
|
||||
|
||||
struct DependentLibrariesSection : Section {
|
||||
Optional<std::vector<YAMLFlowString>> Libs;
|
||||
std::optional<std::vector<YAMLFlowString>> Libs;
|
||||
|
||||
DependentLibrariesSection() : Section(ChunkKind::DependentLibraries) {}
|
||||
|
||||
@@ -524,7 +525,7 @@ struct CallGraphEntryWeight {
|
||||
};
|
||||
|
||||
struct CallGraphProfileSection : Section {
|
||||
Optional<std::vector<CallGraphEntryWeight>> Entries;
|
||||
std::optional<std::vector<CallGraphEntryWeight>> Entries;
|
||||
|
||||
CallGraphProfileSection() : Section(ChunkKind::CallGraphProfile) {}
|
||||
|
||||
@@ -538,7 +539,7 @@ struct CallGraphProfileSection : Section {
|
||||
};
|
||||
|
||||
struct SymverSection : Section {
|
||||
Optional<std::vector<uint16_t>> Entries;
|
||||
std::optional<std::vector<uint16_t>> Entries;
|
||||
|
||||
SymverSection() : Section(ChunkKind::Symver) {}
|
||||
|
||||
@@ -550,16 +551,16 @@ struct SymverSection : Section {
|
||||
};
|
||||
|
||||
struct VerdefEntry {
|
||||
Optional<uint16_t> Version;
|
||||
Optional<uint16_t> Flags;
|
||||
Optional<uint16_t> VersionNdx;
|
||||
Optional<uint32_t> Hash;
|
||||
std::optional<uint16_t> Version;
|
||||
std::optional<uint16_t> Flags;
|
||||
std::optional<uint16_t> VersionNdx;
|
||||
std::optional<uint32_t> Hash;
|
||||
std::vector<StringRef> VerNames;
|
||||
};
|
||||
|
||||
struct VerdefSection : Section {
|
||||
Optional<std::vector<VerdefEntry>> Entries;
|
||||
Optional<llvm::yaml::Hex64> Info;
|
||||
std::optional<std::vector<VerdefEntry>> Entries;
|
||||
std::optional<llvm::yaml::Hex64> Info;
|
||||
|
||||
VerdefSection() : Section(ChunkKind::Verdef) {}
|
||||
|
||||
@@ -573,8 +574,8 @@ struct VerdefSection : Section {
|
||||
struct GroupSection : Section {
|
||||
// Members of a group contain a flag and a list of section indices
|
||||
// that are part of the group.
|
||||
Optional<std::vector<SectionOrType>> Members;
|
||||
Optional<StringRef> Signature; /* Info */
|
||||
std::optional<std::vector<SectionOrType>> Members;
|
||||
std::optional<StringRef> Signature; /* Info */
|
||||
|
||||
GroupSection() : Section(ChunkKind::Group) {}
|
||||
|
||||
@@ -589,11 +590,11 @@ struct Relocation {
|
||||
llvm::yaml::Hex64 Offset;
|
||||
YAMLIntUInt Addend;
|
||||
ELF_REL Type;
|
||||
Optional<StringRef> Symbol;
|
||||
std::optional<StringRef> Symbol;
|
||||
};
|
||||
|
||||
struct RelocationSection : Section {
|
||||
Optional<std::vector<Relocation>> Relocations;
|
||||
std::optional<std::vector<Relocation>> Relocations;
|
||||
StringRef RelocatableSec; /* Info */
|
||||
|
||||
RelocationSection() : Section(ChunkKind::Relocation) {}
|
||||
@@ -608,7 +609,7 @@ struct RelocationSection : Section {
|
||||
};
|
||||
|
||||
struct RelrSection : Section {
|
||||
Optional<std::vector<llvm::yaml::Hex64>> Entries;
|
||||
std::optional<std::vector<llvm::yaml::Hex64>> Entries;
|
||||
|
||||
RelrSection() : Section(ChunkKind::Relr) {}
|
||||
|
||||
@@ -622,7 +623,7 @@ struct RelrSection : Section {
|
||||
};
|
||||
|
||||
struct SymtabShndxSection : Section {
|
||||
Optional<std::vector<uint32_t>> Entries;
|
||||
std::optional<std::vector<uint32_t>> Entries;
|
||||
|
||||
SymtabShndxSection() : Section(ChunkKind::SymtabShndxSection) {}
|
||||
|
||||
@@ -641,7 +642,7 @@ struct ARMIndexTableEntry {
|
||||
};
|
||||
|
||||
struct ARMIndexTableSection : Section {
|
||||
Optional<std::vector<ARMIndexTableEntry>> Entries;
|
||||
std::optional<std::vector<ARMIndexTableEntry>> Entries;
|
||||
|
||||
ARMIndexTableSection() : Section(ChunkKind::ARMIndexTable) {}
|
||||
|
||||
@@ -680,12 +681,12 @@ struct ProgramHeader {
|
||||
ELF_PF Flags;
|
||||
llvm::yaml::Hex64 VAddr;
|
||||
llvm::yaml::Hex64 PAddr;
|
||||
Optional<llvm::yaml::Hex64> Align;
|
||||
Optional<llvm::yaml::Hex64> FileSize;
|
||||
Optional<llvm::yaml::Hex64> MemSize;
|
||||
Optional<llvm::yaml::Hex64> Offset;
|
||||
Optional<StringRef> FirstSec;
|
||||
Optional<StringRef> LastSec;
|
||||
std::optional<llvm::yaml::Hex64> Align;
|
||||
std::optional<llvm::yaml::Hex64> FileSize;
|
||||
std::optional<llvm::yaml::Hex64> MemSize;
|
||||
std::optional<llvm::yaml::Hex64> Offset;
|
||||
std::optional<StringRef> FirstSec;
|
||||
std::optional<StringRef> LastSec;
|
||||
|
||||
// This vector contains all chunks from [FirstSec, LastSec].
|
||||
std::vector<Chunk *> Chunks;
|
||||
@@ -703,9 +704,9 @@ struct Object {
|
||||
// cleaner and nicer if we read them from the YAML as a separate
|
||||
// top-level key, which automatically ensures that invariants like there
|
||||
// being a single SHT_SYMTAB section are upheld.
|
||||
Optional<std::vector<Symbol>> Symbols;
|
||||
Optional<std::vector<Symbol>> DynamicSymbols;
|
||||
Optional<DWARFYAML::Data> DWARF;
|
||||
std::optional<std::vector<Symbol>> Symbols;
|
||||
std::optional<std::vector<Symbol>> DynamicSymbols;
|
||||
std::optional<DWARFYAML::Data> DWARF;
|
||||
|
||||
std::vector<Section *> getSections() {
|
||||
std::vector<Section *> Ret;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "llvm/ObjectYAML/YAML.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -54,7 +55,7 @@ struct Section {
|
||||
llvm::yaml::Hex32 reserved1;
|
||||
llvm::yaml::Hex32 reserved2;
|
||||
llvm::yaml::Hex32 reserved3;
|
||||
Optional<llvm::yaml::BinaryRef> content;
|
||||
std::optional<llvm::yaml::BinaryRef> content;
|
||||
std::vector<Relocation> relocations;
|
||||
};
|
||||
|
||||
@@ -141,7 +142,7 @@ struct Object {
|
||||
std::vector<LoadCommand> LoadCommands;
|
||||
std::vector<Section> Sections;
|
||||
LinkEditData LinkEdit;
|
||||
Optional<llvm::yaml::BinaryRef> RawLinkEditSegment;
|
||||
std::optional<llvm::yaml::BinaryRef> RawLinkEditSegment;
|
||||
DWARFYAML::Data DWARF;
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "llvm/Object/OffloadBinary.h"
|
||||
#include "llvm/ObjectYAML/YAML.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
namespace OffloadYAML {
|
||||
@@ -30,17 +31,17 @@ struct Binary {
|
||||
};
|
||||
|
||||
struct Member {
|
||||
Optional<object::ImageKind> ImageKind;
|
||||
Optional<object::OffloadKind> OffloadKind;
|
||||
Optional<uint32_t> Flags;
|
||||
Optional<std::vector<StringEntry>> StringEntries;
|
||||
Optional<yaml::BinaryRef> Content;
|
||||
std::optional<object::ImageKind> ImageKind;
|
||||
std::optional<object::OffloadKind> OffloadKind;
|
||||
std::optional<uint32_t> Flags;
|
||||
std::optional<std::vector<StringEntry>> StringEntries;
|
||||
std::optional<yaml::BinaryRef> Content;
|
||||
};
|
||||
|
||||
Optional<uint32_t> Version;
|
||||
Optional<uint64_t> Size;
|
||||
Optional<uint64_t> EntryOffset;
|
||||
Optional<uint64_t> EntrySize;
|
||||
std::optional<uint32_t> Version;
|
||||
std::optional<uint64_t> Size;
|
||||
std::optional<uint64_t> EntryOffset;
|
||||
std::optional<uint64_t> EntrySize;
|
||||
std::vector<Member> Members;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "llvm/BinaryFormat/XCOFF.h"
|
||||
#include "llvm/ObjectYAML/YAML.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@@ -30,35 +31,35 @@ struct FileHeader {
|
||||
};
|
||||
|
||||
struct AuxiliaryHeader {
|
||||
Optional<llvm::yaml::Hex16> Magic;
|
||||
Optional<llvm::yaml::Hex16> Version;
|
||||
Optional<llvm::yaml::Hex64> TextStartAddr;
|
||||
Optional<llvm::yaml::Hex64> DataStartAddr;
|
||||
Optional<llvm::yaml::Hex64> TOCAnchorAddr;
|
||||
Optional<uint16_t> SecNumOfEntryPoint;
|
||||
Optional<uint16_t> SecNumOfText;
|
||||
Optional<uint16_t> SecNumOfData;
|
||||
Optional<uint16_t> SecNumOfTOC;
|
||||
Optional<uint16_t> SecNumOfLoader;
|
||||
Optional<uint16_t> SecNumOfBSS;
|
||||
Optional<llvm::yaml::Hex16> MaxAlignOfText;
|
||||
Optional<llvm::yaml::Hex16> MaxAlignOfData;
|
||||
Optional<llvm::yaml::Hex16> ModuleType;
|
||||
Optional<llvm::yaml::Hex8> CpuFlag;
|
||||
Optional<llvm::yaml::Hex8> CpuType;
|
||||
Optional<llvm::yaml::Hex8> TextPageSize;
|
||||
Optional<llvm::yaml::Hex8> DataPageSize;
|
||||
Optional<llvm::yaml::Hex8> StackPageSize;
|
||||
Optional<llvm::yaml::Hex8> FlagAndTDataAlignment;
|
||||
Optional<llvm::yaml::Hex64> TextSize;
|
||||
Optional<llvm::yaml::Hex64> InitDataSize;
|
||||
Optional<llvm::yaml::Hex64> BssDataSize;
|
||||
Optional<llvm::yaml::Hex64> EntryPointAddr;
|
||||
Optional<llvm::yaml::Hex64> MaxStackSize;
|
||||
Optional<llvm::yaml::Hex64> MaxDataSize;
|
||||
Optional<uint16_t> SecNumOfTData;
|
||||
Optional<uint16_t> SecNumOfTBSS;
|
||||
Optional<llvm::yaml::Hex16> Flag;
|
||||
std::optional<llvm::yaml::Hex16> Magic;
|
||||
std::optional<llvm::yaml::Hex16> Version;
|
||||
std::optional<llvm::yaml::Hex64> TextStartAddr;
|
||||
std::optional<llvm::yaml::Hex64> DataStartAddr;
|
||||
std::optional<llvm::yaml::Hex64> TOCAnchorAddr;
|
||||
std::optional<uint16_t> SecNumOfEntryPoint;
|
||||
std::optional<uint16_t> SecNumOfText;
|
||||
std::optional<uint16_t> SecNumOfData;
|
||||
std::optional<uint16_t> SecNumOfTOC;
|
||||
std::optional<uint16_t> SecNumOfLoader;
|
||||
std::optional<uint16_t> SecNumOfBSS;
|
||||
std::optional<llvm::yaml::Hex16> MaxAlignOfText;
|
||||
std::optional<llvm::yaml::Hex16> MaxAlignOfData;
|
||||
std::optional<llvm::yaml::Hex16> ModuleType;
|
||||
std::optional<llvm::yaml::Hex8> CpuFlag;
|
||||
std::optional<llvm::yaml::Hex8> CpuType;
|
||||
std::optional<llvm::yaml::Hex8> TextPageSize;
|
||||
std::optional<llvm::yaml::Hex8> DataPageSize;
|
||||
std::optional<llvm::yaml::Hex8> StackPageSize;
|
||||
std::optional<llvm::yaml::Hex8> FlagAndTDataAlignment;
|
||||
std::optional<llvm::yaml::Hex64> TextSize;
|
||||
std::optional<llvm::yaml::Hex64> InitDataSize;
|
||||
std::optional<llvm::yaml::Hex64> BssDataSize;
|
||||
std::optional<llvm::yaml::Hex64> EntryPointAddr;
|
||||
std::optional<llvm::yaml::Hex64> MaxStackSize;
|
||||
std::optional<llvm::yaml::Hex64> MaxDataSize;
|
||||
std::optional<uint16_t> SecNumOfTData;
|
||||
std::optional<uint16_t> SecNumOfTBSS;
|
||||
std::optional<llvm::yaml::Hex16> Flag;
|
||||
};
|
||||
|
||||
struct Relocation {
|
||||
@@ -100,8 +101,8 @@ struct AuxSymbolEnt {
|
||||
};
|
||||
|
||||
struct FileAuxEnt : AuxSymbolEnt {
|
||||
Optional<StringRef> FileNameOrString;
|
||||
Optional<XCOFF::CFileStringType> FileStringType;
|
||||
std::optional<StringRef> FileNameOrString;
|
||||
std::optional<XCOFF::CFileStringType> FileStringType;
|
||||
|
||||
FileAuxEnt() : AuxSymbolEnt(AuxSymbolType::AUX_FILE) {}
|
||||
static bool classof(const AuxSymbolEnt *S) {
|
||||
@@ -111,17 +112,17 @@ struct FileAuxEnt : AuxSymbolEnt {
|
||||
|
||||
struct CsectAuxEnt : AuxSymbolEnt {
|
||||
// Only for XCOFF32.
|
||||
Optional<uint32_t> SectionOrLength;
|
||||
Optional<uint32_t> StabInfoIndex;
|
||||
Optional<uint16_t> StabSectNum;
|
||||
std::optional<uint32_t> SectionOrLength;
|
||||
std::optional<uint32_t> StabInfoIndex;
|
||||
std::optional<uint16_t> StabSectNum;
|
||||
// Only for XCOFF64.
|
||||
Optional<uint32_t> SectionOrLengthLo;
|
||||
Optional<uint32_t> SectionOrLengthHi;
|
||||
std::optional<uint32_t> SectionOrLengthLo;
|
||||
std::optional<uint32_t> SectionOrLengthHi;
|
||||
// Common fields for both XCOFF32 and XCOFF64.
|
||||
Optional<uint32_t> ParameterHashIndex;
|
||||
Optional<uint16_t> TypeChkSectNum;
|
||||
Optional<uint8_t> SymbolAlignmentAndType;
|
||||
Optional<XCOFF::StorageMappingClass> StorageMappingClass;
|
||||
std::optional<uint32_t> ParameterHashIndex;
|
||||
std::optional<uint16_t> TypeChkSectNum;
|
||||
std::optional<uint8_t> SymbolAlignmentAndType;
|
||||
std::optional<XCOFF::StorageMappingClass> StorageMappingClass;
|
||||
|
||||
CsectAuxEnt() : AuxSymbolEnt(AuxSymbolType::AUX_CSECT) {}
|
||||
static bool classof(const AuxSymbolEnt *S) {
|
||||
@@ -130,10 +131,10 @@ struct CsectAuxEnt : AuxSymbolEnt {
|
||||
};
|
||||
|
||||
struct FunctionAuxEnt : AuxSymbolEnt {
|
||||
Optional<uint32_t> OffsetToExceptionTbl; // Only for XCOFF32.
|
||||
Optional<uint64_t> PtrToLineNum;
|
||||
Optional<uint32_t> SizeOfFunction;
|
||||
Optional<int32_t> SymIdxOfNextBeyond;
|
||||
std::optional<uint32_t> OffsetToExceptionTbl; // Only for XCOFF32.
|
||||
std::optional<uint64_t> PtrToLineNum;
|
||||
std::optional<uint32_t> SizeOfFunction;
|
||||
std::optional<int32_t> SymIdxOfNextBeyond;
|
||||
|
||||
FunctionAuxEnt() : AuxSymbolEnt(AuxSymbolType::AUX_FCN) {}
|
||||
static bool classof(const AuxSymbolEnt *S) {
|
||||
@@ -142,9 +143,9 @@ struct FunctionAuxEnt : AuxSymbolEnt {
|
||||
};
|
||||
|
||||
struct ExcpetionAuxEnt : AuxSymbolEnt {
|
||||
Optional<uint64_t> OffsetToExceptionTbl;
|
||||
Optional<uint32_t> SizeOfFunction;
|
||||
Optional<int32_t> SymIdxOfNextBeyond;
|
||||
std::optional<uint64_t> OffsetToExceptionTbl;
|
||||
std::optional<uint32_t> SizeOfFunction;
|
||||
std::optional<int32_t> SymIdxOfNextBeyond;
|
||||
|
||||
ExcpetionAuxEnt() : AuxSymbolEnt(AuxSymbolType::AUX_EXCEPT) {}
|
||||
static bool classof(const AuxSymbolEnt *S) {
|
||||
@@ -154,10 +155,10 @@ struct ExcpetionAuxEnt : AuxSymbolEnt {
|
||||
|
||||
struct BlockAuxEnt : AuxSymbolEnt {
|
||||
// Only for XCOFF32.
|
||||
Optional<uint16_t> LineNumHi;
|
||||
Optional<uint16_t> LineNumLo;
|
||||
std::optional<uint16_t> LineNumHi;
|
||||
std::optional<uint16_t> LineNumLo;
|
||||
// Only for XCOFF64.
|
||||
Optional<uint32_t> LineNum;
|
||||
std::optional<uint32_t> LineNum;
|
||||
|
||||
BlockAuxEnt() : AuxSymbolEnt(AuxSymbolType::AUX_SYM) {}
|
||||
static bool classof(const AuxSymbolEnt *S) {
|
||||
@@ -166,8 +167,8 @@ struct BlockAuxEnt : AuxSymbolEnt {
|
||||
};
|
||||
|
||||
struct SectAuxEntForDWARF : AuxSymbolEnt {
|
||||
Optional<uint32_t> LengthOfSectionPortion;
|
||||
Optional<uint32_t> NumberOfRelocEnt;
|
||||
std::optional<uint32_t> LengthOfSectionPortion;
|
||||
std::optional<uint32_t> NumberOfRelocEnt;
|
||||
|
||||
SectAuxEntForDWARF() : AuxSymbolEnt(AuxSymbolType::AUX_SECT) {}
|
||||
static bool classof(const AuxSymbolEnt *S) {
|
||||
@@ -176,9 +177,9 @@ struct SectAuxEntForDWARF : AuxSymbolEnt {
|
||||
};
|
||||
|
||||
struct SectAuxEntForStat : AuxSymbolEnt {
|
||||
Optional<uint32_t> SectionLength;
|
||||
Optional<uint16_t> NumberOfRelocEnt;
|
||||
Optional<uint16_t> NumberOfLineNum;
|
||||
std::optional<uint32_t> SectionLength;
|
||||
std::optional<uint16_t> NumberOfRelocEnt;
|
||||
std::optional<uint16_t> NumberOfLineNum;
|
||||
|
||||
SectAuxEntForStat() : AuxSymbolEnt(AuxSymbolType::AUX_STAT) {}
|
||||
static bool classof(const AuxSymbolEnt *S) {
|
||||
@@ -189,25 +190,25 @@ struct SectAuxEntForStat : AuxSymbolEnt {
|
||||
struct Symbol {
|
||||
StringRef SymbolName;
|
||||
llvm::yaml::Hex64 Value; // Symbol value; storage class-dependent.
|
||||
Optional<StringRef> SectionName;
|
||||
Optional<uint16_t> SectionIndex;
|
||||
std::optional<StringRef> SectionName;
|
||||
std::optional<uint16_t> SectionIndex;
|
||||
llvm::yaml::Hex16 Type;
|
||||
XCOFF::StorageClass StorageClass;
|
||||
Optional<uint8_t> NumberOfAuxEntries;
|
||||
std::optional<uint8_t> NumberOfAuxEntries;
|
||||
std::vector<std::unique_ptr<AuxSymbolEnt>> AuxEntries;
|
||||
};
|
||||
|
||||
struct StringTable {
|
||||
Optional<uint32_t> ContentSize; // The total size of the string table.
|
||||
Optional<uint32_t> Length; // The value of the length field for the first
|
||||
std::optional<uint32_t> ContentSize; // The total size of the string table.
|
||||
std::optional<uint32_t> Length; // The value of the length field for the first
|
||||
// 4 bytes of the table.
|
||||
Optional<std::vector<StringRef>> Strings;
|
||||
Optional<yaml::BinaryRef> RawContent;
|
||||
std::optional<std::vector<StringRef>> Strings;
|
||||
std::optional<yaml::BinaryRef> RawContent;
|
||||
};
|
||||
|
||||
struct Object {
|
||||
FileHeader Header;
|
||||
Optional<AuxiliaryHeader> AuxHeader;
|
||||
std::optional<AuxiliaryHeader> AuxHeader;
|
||||
std::vector<Section> Sections;
|
||||
std::vector<Symbol> Symbols;
|
||||
StringTable StrTbl;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@@ -83,12 +84,12 @@ protected:
|
||||
|
||||
struct Probe {
|
||||
std::string FunctionName;
|
||||
Optional<std::string> LinkageName;
|
||||
std::optional<std::string> LinkageName;
|
||||
yaml::Hex64 CFGHash;
|
||||
yaml::Hex64 CounterOffset;
|
||||
uint32_t NumCounters;
|
||||
Optional<std::string> FilePath;
|
||||
Optional<int> LineNumber;
|
||||
std::optional<std::string> FilePath;
|
||||
std::optional<int> LineNumber;
|
||||
};
|
||||
|
||||
struct CorrelationData {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "llvm/Bitstream/BitstreamWriter.h"
|
||||
#include "llvm/Remarks/BitstreamRemarkContainer.h"
|
||||
#include "llvm/Remarks/RemarkSerializer.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
namespace remarks {
|
||||
@@ -107,7 +108,7 @@ struct BitstreamRemarkSerializerHelper {
|
||||
void emitMetaBlock(uint64_t ContainerVersion,
|
||||
Optional<uint64_t> RemarkVersion,
|
||||
Optional<const StringTable *> StrTab = std::nullopt,
|
||||
Optional<StringRef> Filename = std::nullopt);
|
||||
std::optional<StringRef> Filename = std::nullopt);
|
||||
|
||||
/// Emit a remark block. The string table is required.
|
||||
void emitRemarkBlock(const Remark &Remark, StringTable &StrTab);
|
||||
@@ -146,9 +147,9 @@ struct BitstreamRemarkSerializer : public RemarkSerializer {
|
||||
/// The metadata serializer associated to this remark serializer. Based on the
|
||||
/// container type of the current serializer, the container type of the
|
||||
/// metadata serializer will change.
|
||||
std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
std::unique_ptr<MetaSerializer> metaSerializer(
|
||||
raw_ostream &OS,
|
||||
std::optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
|
||||
static bool classof(const RemarkSerializer *S) {
|
||||
return S->SerializerFormat == Format::Bitstream;
|
||||
@@ -167,13 +168,13 @@ struct BitstreamMetaSerializer : public MetaSerializer {
|
||||
BitstreamRemarkSerializerHelper *Helper = nullptr;
|
||||
|
||||
Optional<const StringTable *> StrTab;
|
||||
Optional<StringRef> ExternalFilename;
|
||||
std::optional<StringRef> ExternalFilename;
|
||||
|
||||
/// Create a new meta serializer based on \p ContainerType.
|
||||
BitstreamMetaSerializer(raw_ostream &OS,
|
||||
BitstreamRemarkContainerType ContainerType,
|
||||
Optional<const StringTable *> StrTab = std::nullopt,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt)
|
||||
std::optional<StringRef> ExternalFilename = std::nullopt)
|
||||
: MetaSerializer(OS), TmpHelper(std::nullopt), Helper(nullptr),
|
||||
StrTab(StrTab), ExternalFilename(ExternalFilename) {
|
||||
TmpHelper.emplace(ContainerType);
|
||||
@@ -184,7 +185,7 @@ struct BitstreamMetaSerializer : public MetaSerializer {
|
||||
BitstreamMetaSerializer(raw_ostream &OS,
|
||||
BitstreamRemarkSerializerHelper &Helper,
|
||||
Optional<const StringTable *> StrTab = std::nullopt,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt)
|
||||
std::optional<StringRef> ExternalFilename = std::nullopt)
|
||||
: MetaSerializer(OS), TmpHelper(std::nullopt), Helper(&Helper),
|
||||
StrTab(StrTab), ExternalFilename(ExternalFilename) {}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/CBindingWrapping.h"
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
@@ -44,7 +45,7 @@ struct Argument {
|
||||
// FIXME: We might want to be able to store other types than strings here.
|
||||
StringRef Val;
|
||||
// If set, the debug location corresponding to the value.
|
||||
Optional<RemarkLocation> Loc;
|
||||
std::optional<RemarkLocation> Loc;
|
||||
};
|
||||
|
||||
// Create wrappers for C Binding types (see CBindingWrapping.h).
|
||||
@@ -80,11 +81,11 @@ struct Remark {
|
||||
StringRef FunctionName;
|
||||
|
||||
/// The location in the source file of the remark.
|
||||
Optional<RemarkLocation> Loc;
|
||||
std::optional<RemarkLocation> Loc;
|
||||
|
||||
/// If profile information is available, this is the number of times the
|
||||
/// corresponding code was executed in a profile instrumentation run.
|
||||
Optional<uint64_t> Hotness;
|
||||
std::optional<uint64_t> Hotness;
|
||||
|
||||
/// Arguments collected via the streaming interface.
|
||||
SmallVector<Argument, 5> Args;
|
||||
@@ -112,7 +113,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Remark, LLVMRemarkEntryRef)
|
||||
/// Comparison operators for Remark objects and dependent objects.
|
||||
|
||||
template <typename T>
|
||||
bool operator<(const Optional<T> &LHS, const Optional<T> &RHS) {
|
||||
bool operator<(const std::optional<T> &LHS, const std::optional<T> &RHS) {
|
||||
// Sorting based on optionals should result in all `None` entries to appear
|
||||
// before the valid entries. For example, remarks with no debug location will
|
||||
// appear first.
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "llvm/Remarks/RemarkFormat.h"
|
||||
#include "llvm/Remarks/RemarkStringTable.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -47,7 +48,7 @@ struct RemarkSerializer {
|
||||
SerializerMode Mode;
|
||||
/// The string table containing all the unique strings used in the output.
|
||||
/// The table can be serialized to be consumed after the compilation.
|
||||
Optional<StringTable> StrTab;
|
||||
std::optional<StringTable> StrTab;
|
||||
|
||||
RemarkSerializer(Format SerializerFormat, raw_ostream &OS,
|
||||
SerializerMode Mode)
|
||||
@@ -60,7 +61,7 @@ struct RemarkSerializer {
|
||||
/// Return the corresponding metadata serializer.
|
||||
virtual std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) = 0;
|
||||
std::optional<StringRef> ExternalFilename = std::nullopt) = 0;
|
||||
};
|
||||
|
||||
/// This is the base class for a remark metadata serializer.
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "llvm/Remarks/RemarkSerializer.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
namespace remarks {
|
||||
@@ -35,12 +36,12 @@ struct YAMLRemarkSerializer : public RemarkSerializer {
|
||||
yaml::Output YAMLOutput;
|
||||
|
||||
YAMLRemarkSerializer(raw_ostream &OS, SerializerMode Mode,
|
||||
Optional<StringTable> StrTab = std::nullopt);
|
||||
std::optional<StringTable> StrTab = std::nullopt);
|
||||
|
||||
void emit(const Remark &Remark) override;
|
||||
std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
std::unique_ptr<MetaSerializer> metaSerializer(
|
||||
raw_ostream &OS,
|
||||
std::optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
|
||||
static bool classof(const RemarkSerializer *S) {
|
||||
return S->SerializerFormat == Format::YAML;
|
||||
@@ -49,13 +50,13 @@ struct YAMLRemarkSerializer : public RemarkSerializer {
|
||||
protected:
|
||||
YAMLRemarkSerializer(Format SerializerFormat, raw_ostream &OS,
|
||||
SerializerMode Mode,
|
||||
Optional<StringTable> StrTab = std::nullopt);
|
||||
std::optional<StringTable> StrTab = std::nullopt);
|
||||
};
|
||||
|
||||
struct YAMLMetaSerializer : public MetaSerializer {
|
||||
Optional<StringRef> ExternalFilename;
|
||||
std::optional<StringRef> ExternalFilename;
|
||||
|
||||
YAMLMetaSerializer(raw_ostream &OS, Optional<StringRef> ExternalFilename)
|
||||
YAMLMetaSerializer(raw_ostream &OS, std::optional<StringRef> ExternalFilename)
|
||||
: MetaSerializer(OS), ExternalFilename(ExternalFilename) {}
|
||||
|
||||
void emit() override;
|
||||
@@ -81,9 +82,9 @@ struct YAMLStrTabRemarkSerializer : public YAMLRemarkSerializer {
|
||||
/// Override to emit the metadata if necessary.
|
||||
void emit(const Remark &Remark) override;
|
||||
|
||||
std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
std::unique_ptr<MetaSerializer> metaSerializer(
|
||||
raw_ostream &OS,
|
||||
std::optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
|
||||
static bool classof(const RemarkSerializer *S) {
|
||||
return S->SerializerFormat == Format::YAMLStrTab;
|
||||
@@ -95,7 +96,7 @@ struct YAMLStrTabMetaSerializer : public YAMLMetaSerializer {
|
||||
const StringTable &StrTab;
|
||||
|
||||
YAMLStrTabMetaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename,
|
||||
std::optional<StringRef> ExternalFilename,
|
||||
const StringTable &StrTab)
|
||||
: YAMLMetaSerializer(OS, ExternalFilename), StrTab(StrTab) {}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define LLVM_SUPPORT_YAMLTRAITS_H
|
||||
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
@@ -27,6 +26,7 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <type_traits>
|
||||
@@ -904,9 +904,10 @@ public:
|
||||
}
|
||||
|
||||
template <typename T, typename Context>
|
||||
void mapOptionalWithContext(const char *Key, Optional<T> &Val, Context &Ctx) {
|
||||
this->processKeyWithDefault(Key, Val, Optional<T>(), /*Required=*/false,
|
||||
Ctx);
|
||||
void mapOptionalWithContext(const char *Key, std::optional<T> &Val,
|
||||
Context &Ctx) {
|
||||
this->processKeyWithDefault(Key, Val, std::optional<T>(),
|
||||
/*Required=*/false, Ctx);
|
||||
}
|
||||
|
||||
template <typename T, typename Context>
|
||||
@@ -926,9 +927,9 @@ public:
|
||||
|
||||
private:
|
||||
template <typename T, typename Context>
|
||||
void processKeyWithDefault(const char *Key, Optional<T> &Val,
|
||||
const Optional<T> &DefaultValue, bool Required,
|
||||
Context &Ctx);
|
||||
void processKeyWithDefault(const char *Key, std::optional<T> &Val,
|
||||
const std::optional<T> &DefaultValue,
|
||||
bool Required, Context &Ctx);
|
||||
|
||||
template <typename T, typename Context>
|
||||
void processKeyWithDefault(const char *Key, T &Val, const T &DefaultValue,
|
||||
@@ -1665,10 +1666,10 @@ private:
|
||||
};
|
||||
|
||||
template <typename T, typename Context>
|
||||
void IO::processKeyWithDefault(const char *Key, Optional<T> &Val,
|
||||
const Optional<T> &DefaultValue, bool Required,
|
||||
Context &Ctx) {
|
||||
assert(!DefaultValue && "Optional<T> shouldn't have a value!");
|
||||
void IO::processKeyWithDefault(const char *Key, std::optional<T> &Val,
|
||||
const std::optional<T> &DefaultValue,
|
||||
bool Required, Context &Ctx) {
|
||||
assert(!DefaultValue && "std::optional<T> shouldn't have a value!");
|
||||
void *SaveInfo;
|
||||
bool UseDefault = true;
|
||||
const bool sameAsDefault = outputting() && !Val;
|
||||
@@ -1677,13 +1678,14 @@ void IO::processKeyWithDefault(const char *Key, Optional<T> &Val,
|
||||
if (Val &&
|
||||
this->preflightKey(Key, Required, sameAsDefault, UseDefault, SaveInfo)) {
|
||||
|
||||
// When reading an Optional<X> key from a YAML description, we allow the
|
||||
// special "<none>" value, which can be used to specify that no value was
|
||||
// requested, i.e. the DefaultValue will be assigned. The DefaultValue is
|
||||
// usually None.
|
||||
// When reading an std::optional<X> key from a YAML description, we allow
|
||||
// the special "<none>" value, which can be used to specify that no value
|
||||
// was requested, i.e. the DefaultValue will be assigned. The DefaultValue
|
||||
// is usually None.
|
||||
bool IsNone = false;
|
||||
if (!outputting())
|
||||
if (const auto *Node = dyn_cast<ScalarNode>(((Input *)this)->getCurrentNode()))
|
||||
if (const auto *Node =
|
||||
dyn_cast<ScalarNode>(((Input *)this)->getCurrentNode()))
|
||||
// We use rtrim to ignore possible white spaces that might exist when a
|
||||
// comment is present on the same line.
|
||||
IsNone = Node->getRawValue().rtrim(' ') == "<none>";
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "llvm/Support/GraphWriter.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
using namespace llvm;
|
||||
@@ -204,7 +205,7 @@ BlockFrequency BlockFrequencyInfo::getBlockFreq(const BasicBlock *BB) const {
|
||||
return BFI ? BFI->getBlockFreq(BB) : 0;
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
BlockFrequencyInfo::getBlockProfileCount(const BasicBlock *BB,
|
||||
bool AllowSynthetic) const {
|
||||
if (!BFI)
|
||||
@@ -213,7 +214,7 @@ BlockFrequencyInfo::getBlockProfileCount(const BasicBlock *BB,
|
||||
return BFI->getBlockProfileCount(*getFunction(), BB, AllowSynthetic);
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
BlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const {
|
||||
if (!BFI)
|
||||
return std::nullopt;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -585,7 +586,7 @@ BlockFrequencyInfoImplBase::getBlockFreq(const BlockNode &Node) const {
|
||||
return Freqs[Node.Index].Integer;
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
BlockFrequencyInfoImplBase::getBlockProfileCount(const Function &F,
|
||||
const BlockNode &Node,
|
||||
bool AllowSynthetic) const {
|
||||
@@ -593,7 +594,7 @@ BlockFrequencyInfoImplBase::getBlockProfileCount(const Function &F,
|
||||
AllowSynthetic);
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
BlockFrequencyInfoImplBase::getProfileCountFromFreq(const Function &F,
|
||||
uint64_t Freq,
|
||||
bool AllowSynthetic) const {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -60,7 +61,8 @@ bool OptimizationRemarkEmitter::invalidate(
|
||||
return false;
|
||||
}
|
||||
|
||||
Optional<uint64_t> OptimizationRemarkEmitter::computeHotness(const Value *V) {
|
||||
std::optional<uint64_t>
|
||||
OptimizationRemarkEmitter::computeHotness(const Value *V) {
|
||||
if (!BFI)
|
||||
return std::nullopt;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/ProfileData/ProfileCommon.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include <optional>
|
||||
using namespace llvm;
|
||||
|
||||
// Knobs for profile summary based thresholds.
|
||||
@@ -75,7 +76,7 @@ void ProfileSummaryInfo::refresh() {
|
||||
computeThresholds();
|
||||
}
|
||||
|
||||
Optional<uint64_t> ProfileSummaryInfo::getProfileCount(
|
||||
std::optional<uint64_t> ProfileSummaryInfo::getProfileCount(
|
||||
const CallBase &Call, BlockFrequencyInfo *BFI, bool AllowSynthetic) const {
|
||||
assert((isa<CallInst>(Call) || isa<InvokeInst>(Call)) &&
|
||||
"We can only get profile count for call/invoke instruction.");
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
|
||||
#include "llvm/CodeGen/MBFIWrapper.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -31,7 +31,7 @@ void MBFIWrapper::setBlockFreq(const MachineBasicBlock *MBB,
|
||||
MergedBBFreq[MBB] = F;
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
MBFIWrapper::getBlockProfileCount(const MachineBasicBlock *MBB) const {
|
||||
auto I = MergedBBFreq.find(MBB);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/GraphWriter.h"
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
using namespace llvm;
|
||||
@@ -231,7 +232,7 @@ MachineBlockFrequencyInfo::getBlockFreq(const MachineBasicBlock *MBB) const {
|
||||
return MBFI ? MBFI->getBlockFreq(MBB) : 0;
|
||||
}
|
||||
|
||||
Optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount(
|
||||
std::optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount(
|
||||
const MachineBasicBlock *MBB) const {
|
||||
if (!MBFI)
|
||||
return std::nullopt;
|
||||
@@ -240,7 +241,7 @@ Optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount(
|
||||
return MBFI->getBlockProfileCount(F, MBB);
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
MachineBlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const {
|
||||
if (!MBFI)
|
||||
return std::nullopt;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -157,7 +158,7 @@ setDescendantEHBlocksCold(SmallVectorImpl<MachineBasicBlock *> &EHBlocks,
|
||||
static bool isColdBlock(const MachineBasicBlock &MBB,
|
||||
const MachineBlockFrequencyInfo *MBFI,
|
||||
ProfileSummaryInfo *PSI) {
|
||||
Optional<uint64_t> Count = MBFI->getBlockProfileCount(&MBB);
|
||||
std::optional<uint64_t> Count = MBFI->getBlockProfileCount(&MBB);
|
||||
if (!Count)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -30,7 +31,7 @@ DiagnosticInfoMIROptimization::MachineArgument::MachineArgument(
|
||||
/*SkipDebugLoc=*/true);
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
MachineOptimizationRemarkEmitter::computeHotness(const MachineBasicBlock &MBB) {
|
||||
if (!MBFI)
|
||||
return std::nullopt;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llvm/Remarks/RemarkStreamer.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/ToolOutputFile.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -45,7 +46,7 @@ static remarks::Type toRemarkType(enum DiagnosticKind Kind) {
|
||||
}
|
||||
|
||||
/// DiagnosticLocation -> remarks::RemarkLocation.
|
||||
static Optional<remarks::RemarkLocation>
|
||||
static std::optional<remarks::RemarkLocation>
|
||||
toRemarkLocation(const DiagnosticLocation &DL) {
|
||||
if (!DL.isValid())
|
||||
return std::nullopt;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llvm/Support/LineIterator.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::ifs;
|
||||
@@ -216,10 +217,11 @@ Error ifs::writeIFSToOutputStream(raw_ostream &OS, const IFSStub &Stub) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error ifs::overrideIFSTarget(IFSStub &Stub, Optional<IFSArch> OverrideArch,
|
||||
Optional<IFSEndiannessType> OverrideEndianness,
|
||||
Optional<IFSBitWidthType> OverrideBitWidth,
|
||||
Optional<std::string> OverrideTriple) {
|
||||
Error ifs::overrideIFSTarget(
|
||||
IFSStub &Stub, std::optional<IFSArch> OverrideArch,
|
||||
std::optional<IFSEndiannessType> OverrideEndianness,
|
||||
std::optional<IFSBitWidthType> OverrideBitWidth,
|
||||
std::optional<std::string> OverrideTriple) {
|
||||
std::error_code OverrideEC(1, std::generic_category());
|
||||
if (OverrideArch) {
|
||||
if (Stub.Target.Arch && Stub.Target.Arch.value() != OverrideArch.value()) {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
@@ -454,7 +455,7 @@ static bool writeCOFF(COFFParser &CP, raw_ostream &OS) {
|
||||
}
|
||||
for (uint32_t I = 0; I < CP.Obj.OptionalHeader->Header.NumberOfRvaAndSize;
|
||||
++I) {
|
||||
const Optional<COFF::DataDirectory> *DataDirectories =
|
||||
const std::optional<COFF::DataDirectory> *DataDirectories =
|
||||
CP.Obj.OptionalHeader->DataDirectories;
|
||||
uint32_t NumDataDir = std::size(CP.Obj.OptionalHeader->DataDirectories);
|
||||
if (I >= NumDataDir || !DataDirectories[I]) {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -552,7 +553,7 @@ static void writeLineTableOpcode(const DWARFYAML::LineTableOpcode &Op,
|
||||
}
|
||||
|
||||
static std::vector<uint8_t>
|
||||
getStandardOpcodeLengths(uint16_t Version, Optional<uint8_t> OpcodeBase) {
|
||||
getStandardOpcodeLengths(uint16_t Version, std::optional<uint8_t> OpcodeBase) {
|
||||
// If the opcode_base field isn't specified, we returns the
|
||||
// standard_opcode_lengths array according to the version by default.
|
||||
std::vector<uint8_t> StandardOpcodeLengths{0, 1, 1, 1, 1, 0,
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -314,7 +315,7 @@ template <class ELFT> class ELFState {
|
||||
|
||||
BumpPtrAllocator StringAlloc;
|
||||
uint64_t alignToOffset(ContiguousBlobAccumulator &CBA, uint64_t Align,
|
||||
llvm::Optional<llvm::yaml::Hex64> Offset);
|
||||
std::optional<llvm::yaml::Hex64> Offset);
|
||||
|
||||
uint64_t getSectionNameOffset(StringRef Name);
|
||||
|
||||
@@ -715,8 +716,8 @@ uint64_t ELFState<ELFT>::getSectionNameOffset(StringRef Name) {
|
||||
}
|
||||
|
||||
static uint64_t writeContent(ContiguousBlobAccumulator &CBA,
|
||||
const Optional<yaml::BinaryRef> &Content,
|
||||
const Optional<llvm::yaml::Hex64> &Size) {
|
||||
const std::optional<yaml::BinaryRef> &Content,
|
||||
const std::optional<llvm::yaml::Hex64> &Size) {
|
||||
size_t ContentSize = 0;
|
||||
if (Content) {
|
||||
CBA.writeAsBinary(*Content);
|
||||
@@ -1453,7 +1454,7 @@ void ELFState<ELFT>::writeSectionContent(
|
||||
template <class ELFT>
|
||||
uint64_t
|
||||
ELFState<ELFT>::alignToOffset(ContiguousBlobAccumulator &CBA, uint64_t Align,
|
||||
llvm::Optional<llvm::yaml::Hex64> Offset) {
|
||||
std::optional<llvm::yaml::Hex64> Offset) {
|
||||
uint64_t CurrentOffset = CBA.getOffset();
|
||||
uint64_t AlignedOffset;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -1160,7 +1161,7 @@ namespace {
|
||||
|
||||
struct NormalizedOther {
|
||||
NormalizedOther(IO &IO) : YamlIO(IO) {}
|
||||
NormalizedOther(IO &IO, Optional<uint8_t> Original) : YamlIO(IO) {
|
||||
NormalizedOther(IO &IO, std::optional<uint8_t> Original) : YamlIO(IO) {
|
||||
assert(Original && "This constructor is only used for outputting YAML and "
|
||||
"assumes a non-empty Original");
|
||||
std::vector<StOtherPiece> Ret;
|
||||
@@ -1200,7 +1201,7 @@ struct NormalizedOther {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Optional<uint8_t> denormalize(IO &) {
|
||||
std::optional<uint8_t> denormalize(IO &) {
|
||||
if (!Other)
|
||||
return std::nullopt;
|
||||
uint8_t Ret = 0;
|
||||
@@ -1248,7 +1249,7 @@ struct NormalizedOther {
|
||||
}
|
||||
|
||||
IO &YamlIO;
|
||||
Optional<std::vector<StOtherPiece>> Other;
|
||||
std::optional<std::vector<StOtherPiece>> Other;
|
||||
std::string UnknownFlagsHolder;
|
||||
};
|
||||
|
||||
@@ -1298,11 +1299,11 @@ void MappingTraits<ELFYAML::Symbol>::mapping(IO &IO, ELFYAML::Symbol &Symbol) {
|
||||
|
||||
// Symbol's Other field is a bit special. It is usually a field that
|
||||
// represents st_other and holds the symbol visibility. However, on some
|
||||
// platforms, it can contain bit fields and regular values, or even sometimes a
|
||||
// crazy mix of them (see comments for NormalizedOther). Because of this, we
|
||||
// platforms, it can contain bit fields and regular values, or even sometimes
|
||||
// a crazy mix of them (see comments for NormalizedOther). Because of this, we
|
||||
// need special handling.
|
||||
MappingNormalization<NormalizedOther, Optional<uint8_t>> Keys(IO,
|
||||
Symbol.Other);
|
||||
MappingNormalization<NormalizedOther, std::optional<uint8_t>> Keys(
|
||||
IO, Symbol.Other);
|
||||
IO.mapOptional("Other", Keys->Other);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
|
||||
#include "llvm/Object/MachO.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include <optional>
|
||||
|
||||
#define DEBUG_TYPE "correlator"
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "llvm/Remarks/BitstreamRemarkSerializer.h"
|
||||
#include "llvm/Remarks/Remark.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::remarks;
|
||||
@@ -232,7 +233,7 @@ void BitstreamRemarkSerializerHelper::setupBlockInfo() {
|
||||
|
||||
void BitstreamRemarkSerializerHelper::emitMetaBlock(
|
||||
uint64_t ContainerVersion, Optional<uint64_t> RemarkVersion,
|
||||
Optional<const StringTable *> StrTab, Optional<StringRef> Filename) {
|
||||
Optional<const StringTable *> StrTab, std::optional<StringRef> Filename) {
|
||||
// Emit the meta block
|
||||
Bitstream.EnterSubblock(META_BLOCK_ID, 3);
|
||||
|
||||
@@ -277,7 +278,7 @@ void BitstreamRemarkSerializerHelper::emitRemarkBlock(const Remark &Remark,
|
||||
R.push_back(StrTab.add(Remark.FunctionName).first);
|
||||
Bitstream.EmitRecordWithAbbrev(RecordRemarkHeaderAbbrevID, R);
|
||||
|
||||
if (const Optional<RemarkLocation> &Loc = Remark.Loc) {
|
||||
if (const std::optional<RemarkLocation> &Loc = Remark.Loc) {
|
||||
R.clear();
|
||||
R.push_back(RECORD_REMARK_DEBUG_LOC);
|
||||
R.push_back(StrTab.add(Loc->SourceFilePath).first);
|
||||
@@ -286,7 +287,7 @@ void BitstreamRemarkSerializerHelper::emitRemarkBlock(const Remark &Remark,
|
||||
Bitstream.EmitRecordWithAbbrev(RecordRemarkDebugLocAbbrevID, R);
|
||||
}
|
||||
|
||||
if (Optional<uint64_t> Hotness = Remark.Hotness) {
|
||||
if (std::optional<uint64_t> Hotness = Remark.Hotness) {
|
||||
R.clear();
|
||||
R.push_back(RECORD_REMARK_HOTNESS);
|
||||
R.push_back(*Hotness);
|
||||
@@ -366,7 +367,7 @@ void BitstreamRemarkSerializer::emit(const Remark &Remark) {
|
||||
}
|
||||
|
||||
std::unique_ptr<MetaSerializer> BitstreamRemarkSerializer::metaSerializer(
|
||||
raw_ostream &OS, Optional<StringRef> ExternalFilename) {
|
||||
raw_ostream &OS, std::optional<StringRef> ExternalFilename) {
|
||||
assert(Helper.ContainerType !=
|
||||
BitstreamRemarkContainerType::SeparateRemarksMeta);
|
||||
bool IsStandalone =
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "llvm/Remarks/Remark.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::remarks;
|
||||
@@ -60,7 +61,7 @@ extern "C" LLVMRemarkStringRef LLVMRemarkArgGetValue(LLVMRemarkArgRef Arg) {
|
||||
|
||||
extern "C" LLVMRemarkDebugLocRef
|
||||
LLVMRemarkArgGetDebugLoc(LLVMRemarkArgRef Arg) {
|
||||
if (const Optional<RemarkLocation> &Loc = unwrap(Arg)->Loc)
|
||||
if (const std::optional<RemarkLocation> &Loc = unwrap(Arg)->Loc)
|
||||
return wrap(&*Loc);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -91,13 +92,13 @@ LLVMRemarkEntryGetFunctionName(LLVMRemarkEntryRef Remark) {
|
||||
|
||||
extern "C" LLVMRemarkDebugLocRef
|
||||
LLVMRemarkEntryGetDebugLoc(LLVMRemarkEntryRef Remark) {
|
||||
if (const Optional<RemarkLocation> &Loc = unwrap(Remark)->Loc)
|
||||
if (const std::optional<RemarkLocation> &Loc = unwrap(Remark)->Loc)
|
||||
return wrap(&*Loc);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" uint64_t LLVMRemarkEntryGetHotness(LLVMRemarkEntryRef Remark) {
|
||||
if (const Optional<uint64_t> &Hotness = unwrap(Remark)->Hotness)
|
||||
if (const std::optional<uint64_t> &Hotness = unwrap(Remark)->Hotness)
|
||||
return *Hotness;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ Expected<Argument> YAMLRemarkParser::parseArg(yaml::Node &Node) {
|
||||
|
||||
std::optional<StringRef> KeyStr;
|
||||
std::optional<StringRef> ValueStr;
|
||||
Optional<RemarkLocation> Loc;
|
||||
std::optional<RemarkLocation> Loc;
|
||||
|
||||
for (yaml::KeyValueNode &ArgEntry : *ArgMap) {
|
||||
Expected<StringRef> MaybeKey = parseKey(ArgEntry);
|
||||
|
||||
@@ -23,8 +23,8 @@ using namespace llvm::remarks;
|
||||
// unsigned or a StringRef).
|
||||
template <typename T>
|
||||
static void mapRemarkHeader(yaml::IO &io, T PassName, T RemarkName,
|
||||
Optional<RemarkLocation> RL, T FunctionName,
|
||||
Optional<uint64_t> Hotness,
|
||||
std::optional<RemarkLocation> RL, T FunctionName,
|
||||
std::optional<uint64_t> Hotness,
|
||||
ArrayRef<Argument> Args) {
|
||||
io.mapRequired("Pass", PassName);
|
||||
io.mapRequired("Name", RemarkName);
|
||||
@@ -158,12 +158,12 @@ template <> struct MappingTraits<Argument> {
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(Argument)
|
||||
|
||||
YAMLRemarkSerializer::YAMLRemarkSerializer(raw_ostream &OS, SerializerMode Mode,
|
||||
Optional<StringTable> StrTabIn)
|
||||
std::optional<StringTable> StrTabIn)
|
||||
: YAMLRemarkSerializer(Format::YAML, OS, Mode, std::move(StrTabIn)) {}
|
||||
|
||||
YAMLRemarkSerializer::YAMLRemarkSerializer(Format SerializerFormat,
|
||||
raw_ostream &OS, SerializerMode Mode,
|
||||
Optional<StringTable> StrTabIn)
|
||||
std::optional<StringTable> StrTabIn)
|
||||
: RemarkSerializer(SerializerFormat, OS, Mode),
|
||||
YAMLOutput(OS, reinterpret_cast<void *>(this)) {
|
||||
StrTab = std::move(StrTabIn);
|
||||
@@ -176,9 +176,8 @@ void YAMLRemarkSerializer::emit(const Remark &Remark) {
|
||||
YAMLOutput << R;
|
||||
}
|
||||
|
||||
std::unique_ptr<MetaSerializer>
|
||||
YAMLRemarkSerializer::metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename) {
|
||||
std::unique_ptr<MetaSerializer> YAMLRemarkSerializer::metaSerializer(
|
||||
raw_ostream &OS, std::optional<StringRef> ExternalFilename) {
|
||||
return std::make_unique<YAMLMetaSerializer>(OS, ExternalFilename);
|
||||
}
|
||||
|
||||
@@ -197,7 +196,7 @@ void YAMLStrTabRemarkSerializer::emit(const Remark &Remark) {
|
||||
}
|
||||
|
||||
std::unique_ptr<MetaSerializer> YAMLStrTabRemarkSerializer::metaSerializer(
|
||||
raw_ostream &OS, Optional<StringRef> ExternalFilename) {
|
||||
raw_ostream &OS, std::optional<StringRef> ExternalFilename) {
|
||||
assert(StrTab);
|
||||
return std::make_unique<YAMLStrTabMetaSerializer>(OS, ExternalFilename,
|
||||
*StrTab);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "llvm/Support/AMDGPUMetadata.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm::AMDGPU;
|
||||
using namespace llvm::AMDGPU::HSAMD;
|
||||
@@ -112,7 +113,7 @@ struct MappingTraits<Kernel::Arg::Metadata> {
|
||||
YIO.mapRequired(Kernel::Arg::Key::ValueKind, MD.mValueKind);
|
||||
|
||||
// Removed. Accepted for parsing compatibility, but not emitted.
|
||||
Optional<ValueType> Unused;
|
||||
std::optional<ValueType> Unused;
|
||||
YIO.mapOptional(Kernel::Arg::Key::ValueType, Unused);
|
||||
|
||||
YIO.mapOptional(Kernel::Arg::Key::PointeeAlign, MD.mPointeeAlign,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/MC/MCLinkerOptimizationHint.h"
|
||||
#include <cassert>
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -132,7 +133,7 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
|
||||
/// redzone, and no value otherwise.
|
||||
/// Initialized during frame lowering, unless the function has the noredzone
|
||||
/// attribute, in which case it is set to false at construction.
|
||||
Optional<bool> HasRedZone;
|
||||
std::optional<bool> HasRedZone;
|
||||
|
||||
/// ForwardedMustTailRegParms - A list of virtual and physical registers
|
||||
/// that must be forwarded to every musttail call.
|
||||
@@ -334,7 +335,7 @@ public:
|
||||
return NumLocalDynamicTLSAccesses;
|
||||
}
|
||||
|
||||
Optional<bool> hasRedZone() const { return HasRedZone; }
|
||||
std::optional<bool> hasRedZone() const { return HasRedZone; }
|
||||
void setHasRedZone(bool s) { HasRedZone = s; }
|
||||
|
||||
int getVarArgsStackIndex() const { return VarArgsStackIndex; }
|
||||
@@ -458,7 +459,7 @@ private:
|
||||
|
||||
namespace yaml {
|
||||
struct AArch64FunctionInfo final : public yaml::MachineFunctionInfo {
|
||||
Optional<bool> HasRedZone;
|
||||
std::optional<bool> HasRedZone;
|
||||
|
||||
AArch64FunctionInfo() = default;
|
||||
AArch64FunctionInfo(const llvm::AArch64FunctionInfo &MFI);
|
||||
|
||||
@@ -1485,7 +1485,7 @@ bool GCNTargetMachine::parseMachineFunctionInfo(
|
||||
MFI->reserveWWMRegister(ParsedReg);
|
||||
}
|
||||
|
||||
auto parseAndCheckArgument = [&](const Optional<yaml::SIArgument> &A,
|
||||
auto parseAndCheckArgument = [&](const std::optional<yaml::SIArgument> &A,
|
||||
const TargetRegisterClass &RC,
|
||||
ArgDescriptor &Arg, unsigned UserSGPRs,
|
||||
unsigned SystemSGPRs) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include <cassert>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#define MAX_LANES 64
|
||||
@@ -537,12 +538,12 @@ static yaml::StringValue regToString(Register Reg,
|
||||
return Dest;
|
||||
}
|
||||
|
||||
static Optional<yaml::SIArgumentInfo>
|
||||
static std::optional<yaml::SIArgumentInfo>
|
||||
convertArgumentInfo(const AMDGPUFunctionArgInfo &ArgInfo,
|
||||
const TargetRegisterInfo &TRI) {
|
||||
yaml::SIArgumentInfo AI;
|
||||
|
||||
auto convertArg = [&](Optional<yaml::SIArgument> &A,
|
||||
auto convertArg = [&](std::optional<yaml::SIArgument> &A,
|
||||
const ArgDescriptor &Arg) {
|
||||
if (!Arg)
|
||||
return false;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "llvm/CodeGen/MIRYamlMapping.h"
|
||||
#include "llvm/CodeGen/PseudoSourceValue.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -90,7 +91,7 @@ struct SIArgument {
|
||||
StringValue RegisterName;
|
||||
unsigned StackOffset;
|
||||
};
|
||||
Optional<unsigned> Mask;
|
||||
std::optional<unsigned> Mask;
|
||||
|
||||
// Default constructor, which creates a stack argument.
|
||||
SIArgument() : IsRegister(false), StackOffset(0) {}
|
||||
@@ -153,27 +154,27 @@ template <> struct MappingTraits<SIArgument> {
|
||||
};
|
||||
|
||||
struct SIArgumentInfo {
|
||||
Optional<SIArgument> PrivateSegmentBuffer;
|
||||
Optional<SIArgument> DispatchPtr;
|
||||
Optional<SIArgument> QueuePtr;
|
||||
Optional<SIArgument> KernargSegmentPtr;
|
||||
Optional<SIArgument> DispatchID;
|
||||
Optional<SIArgument> FlatScratchInit;
|
||||
Optional<SIArgument> PrivateSegmentSize;
|
||||
std::optional<SIArgument> PrivateSegmentBuffer;
|
||||
std::optional<SIArgument> DispatchPtr;
|
||||
std::optional<SIArgument> QueuePtr;
|
||||
std::optional<SIArgument> KernargSegmentPtr;
|
||||
std::optional<SIArgument> DispatchID;
|
||||
std::optional<SIArgument> FlatScratchInit;
|
||||
std::optional<SIArgument> PrivateSegmentSize;
|
||||
|
||||
Optional<SIArgument> WorkGroupIDX;
|
||||
Optional<SIArgument> WorkGroupIDY;
|
||||
Optional<SIArgument> WorkGroupIDZ;
|
||||
Optional<SIArgument> WorkGroupInfo;
|
||||
Optional<SIArgument> LDSKernelId;
|
||||
Optional<SIArgument> PrivateSegmentWaveByteOffset;
|
||||
std::optional<SIArgument> WorkGroupIDX;
|
||||
std::optional<SIArgument> WorkGroupIDY;
|
||||
std::optional<SIArgument> WorkGroupIDZ;
|
||||
std::optional<SIArgument> WorkGroupInfo;
|
||||
std::optional<SIArgument> LDSKernelId;
|
||||
std::optional<SIArgument> PrivateSegmentWaveByteOffset;
|
||||
|
||||
Optional<SIArgument> ImplicitArgPtr;
|
||||
Optional<SIArgument> ImplicitBufferPtr;
|
||||
std::optional<SIArgument> ImplicitArgPtr;
|
||||
std::optional<SIArgument> ImplicitBufferPtr;
|
||||
|
||||
Optional<SIArgument> WorkItemIDX;
|
||||
Optional<SIArgument> WorkItemIDY;
|
||||
Optional<SIArgument> WorkItemIDZ;
|
||||
std::optional<SIArgument> WorkItemIDX;
|
||||
std::optional<SIArgument> WorkItemIDY;
|
||||
std::optional<SIArgument> WorkItemIDZ;
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<SIArgumentInfo> {
|
||||
@@ -270,9 +271,9 @@ struct SIMachineFunctionInfo final : public yaml::MachineFunctionInfo {
|
||||
unsigned BytesInStackArgArea = 0;
|
||||
bool ReturnsVoid = true;
|
||||
|
||||
Optional<SIArgumentInfo> ArgInfo;
|
||||
std::optional<SIArgumentInfo> ArgInfo;
|
||||
SIMode Mode;
|
||||
Optional<FrameIndex> ScavengeFI;
|
||||
std::optional<FrameIndex> ScavengeFI;
|
||||
StringValue VGPRForAGPRCopy;
|
||||
|
||||
SIMachineFunctionInfo() = default;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/ProfileData/InstrProf.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -73,7 +74,7 @@ static bool runCGProfilePass(
|
||||
continue;
|
||||
TargetTransformInfo &TTI = GetTTI(F);
|
||||
for (auto &BB : F) {
|
||||
Optional<uint64_t> BBCount = BFI.getBlockProfileCount(&BB);
|
||||
std::optional<uint64_t> BBCount = BFI.getBlockProfileCount(&BB);
|
||||
if (!BBCount)
|
||||
continue;
|
||||
for (auto &I : BB) {
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "llvm/Transforms/Utils/Cloning.h"
|
||||
#include "llvm/Transforms/Utils/ValueMapper.h"
|
||||
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
@@ -1707,7 +1708,7 @@ void CHR::transformScopes(CHRScope *Scope, DenseSet<PHINode *> &TrivialPHIs) {
|
||||
BasicBlock *EntryBlock = FirstRegion->getEntry();
|
||||
Region *LastRegion = Scope->RegInfos[Scope->RegInfos.size() - 1].R;
|
||||
BasicBlock *ExitBlock = LastRegion->getExit();
|
||||
Optional<uint64_t> ProfileCount = BFI.getBlockProfileCount(EntryBlock);
|
||||
std::optional<uint64_t> ProfileCount = BFI.getBlockProfileCount(EntryBlock);
|
||||
|
||||
if (ExitBlock) {
|
||||
// Insert a trivial phi at the exit block (where the CHR hot path and the
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <cinttypes>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -43,7 +44,8 @@ DebugMapObject::DebugMapObject(StringRef ObjectFilename,
|
||||
uint8_t Type)
|
||||
: Filename(std::string(ObjectFilename)), Timestamp(Timestamp), Type(Type) {}
|
||||
|
||||
bool DebugMapObject::addSymbol(StringRef Name, Optional<uint64_t> ObjectAddress,
|
||||
bool DebugMapObject::addSymbol(StringRef Name,
|
||||
std::optional<uint64_t> ObjectAddress,
|
||||
uint64_t LinkedAddress, uint32_t Size) {
|
||||
auto InsertResult = Symbols.insert(
|
||||
std::make_pair(Name, SymbolMapping(ObjectAddress, LinkedAddress, Size)));
|
||||
@@ -277,7 +279,7 @@ MappingTraits<dsymutil::DebugMapObject>::YamlDMO::denormalize(IO &IO) {
|
||||
dsymutil::DebugMapObject Res(Path, sys::toTimePoint(Timestamp), MachO::N_OSO);
|
||||
for (auto &Entry : Entries) {
|
||||
auto &Mapping = Entry.second;
|
||||
Optional<uint64_t> ObjAddress;
|
||||
std::optional<uint64_t> ObjAddress;
|
||||
if (Mapping.ObjectAddress)
|
||||
ObjAddress = *Mapping.ObjectAddress;
|
||||
auto AddressIt = SymbolAddresses.find(Entry.first);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#define LLVM_TOOLS_DSYMUTIL_DEBUGMAP_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
@@ -35,6 +34,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -135,11 +135,11 @@ public:
|
||||
class DebugMapObject {
|
||||
public:
|
||||
struct SymbolMapping {
|
||||
Optional<yaml::Hex64> ObjectAddress;
|
||||
std::optional<yaml::Hex64> ObjectAddress;
|
||||
yaml::Hex64 BinaryAddress;
|
||||
yaml::Hex32 Size;
|
||||
|
||||
SymbolMapping(Optional<uint64_t> ObjectAddr, uint64_t BinaryAddress,
|
||||
SymbolMapping(std::optional<uint64_t> ObjectAddr, uint64_t BinaryAddress,
|
||||
uint32_t Size)
|
||||
: BinaryAddress(BinaryAddress), Size(Size) {
|
||||
if (ObjectAddr)
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
/// Adds a symbol mapping to this DebugMapObject.
|
||||
/// \returns false if the symbol was already registered. The request
|
||||
/// is discarded in this case.
|
||||
bool addSymbol(StringRef SymName, Optional<uint64_t> ObjectAddress,
|
||||
bool addSymbol(StringRef SymName, std::optional<uint64_t> ObjectAddress,
|
||||
uint64_t LinkedAddress, uint32_t Size);
|
||||
|
||||
/// Lookup a symbol mapping.
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
#include "BinaryHolder.h"
|
||||
#include "DebugMap.h"
|
||||
#include "MachOUtils.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/Object/MachO.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
@@ -59,10 +59,10 @@ private:
|
||||
std::vector<std::string> CommonSymbols;
|
||||
|
||||
/// Map of the currently processed object file symbol addresses.
|
||||
StringMap<Optional<uint64_t>> CurrentObjectAddresses;
|
||||
StringMap<std::optional<uint64_t>> CurrentObjectAddresses;
|
||||
|
||||
/// Lazily computed map of symbols aliased to the processed object file.
|
||||
StringMap<Optional<uint64_t>> CurrentObjectAliasMap;
|
||||
StringMap<std::optional<uint64_t>> CurrentObjectAliasMap;
|
||||
|
||||
/// If CurrentObjectAliasMap has been computed for a given address.
|
||||
SmallSet<uint64_t, 4> SeenAliasValues;
|
||||
|
||||
@@ -84,14 +84,14 @@ public:
|
||||
struct DriverConfig {
|
||||
std::vector<std::string> InputFilePaths;
|
||||
|
||||
Optional<FileFormat> InputFormat;
|
||||
Optional<FileFormat> OutputFormat;
|
||||
std::optional<FileFormat> InputFormat;
|
||||
std::optional<FileFormat> OutputFormat;
|
||||
|
||||
std::optional<std::string> HintIfsTarget;
|
||||
Optional<std::string> OptTargetTriple;
|
||||
Optional<IFSArch> OverrideArch;
|
||||
Optional<IFSBitWidthType> OverrideBitWidth;
|
||||
Optional<IFSEndiannessType> OverrideEndianness;
|
||||
std::optional<std::string> OptTargetTriple;
|
||||
std::optional<IFSArch> OverrideArch;
|
||||
std::optional<IFSBitWidthType> OverrideBitWidth;
|
||||
std::optional<IFSEndiannessType> OverrideEndianness;
|
||||
|
||||
bool StripIfsArch = false;
|
||||
bool StripIfsBitwidth = false;
|
||||
@@ -130,7 +130,7 @@ static std::string getTypeName(IFSSymbolType Type) {
|
||||
}
|
||||
|
||||
static Expected<std::unique_ptr<IFSStub>>
|
||||
readInputFile(Optional<FileFormat> &InputFormat, StringRef FilePath) {
|
||||
readInputFile(std::optional<FileFormat> &InputFormat, StringRef FilePath) {
|
||||
// Read in file.
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrError =
|
||||
MemoryBuffer::getFileOrSTDIN(FilePath, /*IsText=*/true);
|
||||
@@ -306,7 +306,7 @@ static DriverConfig parseArgs(int argc, char *const *argv) {
|
||||
for (const opt::Arg *A : Args.filtered(OPT_INPUT))
|
||||
Config.InputFilePaths.push_back(A->getValue());
|
||||
if (const opt::Arg *A = Args.getLastArg(OPT_input_format_EQ)) {
|
||||
Config.InputFormat = StringSwitch<Optional<FileFormat>>(A->getValue())
|
||||
Config.InputFormat = StringSwitch<std::optional<FileFormat>>(A->getValue())
|
||||
.Case("IFS", FileFormat::IFS)
|
||||
.Case("ELF", FileFormat::ELF)
|
||||
.Default(std::nullopt);
|
||||
@@ -319,7 +319,7 @@ static DriverConfig parseArgs(int argc, char *const *argv) {
|
||||
" option: Cannot find option named '" + OptionName + "'!");
|
||||
};
|
||||
if (const opt::Arg *A = Args.getLastArg(OPT_output_format_EQ)) {
|
||||
Config.OutputFormat = StringSwitch<Optional<FileFormat>>(A->getValue())
|
||||
Config.OutputFormat = StringSwitch<std::optional<FileFormat>>(A->getValue())
|
||||
.Case("IFS", FileFormat::IFS)
|
||||
.Case("ELF", FileFormat::ELF)
|
||||
.Case("TBD", FileFormat::TBD)
|
||||
@@ -341,7 +341,7 @@ static DriverConfig parseArgs(int argc, char *const *argv) {
|
||||
}
|
||||
if (const opt::Arg *A = Args.getLastArg(OPT_endianness_EQ)) {
|
||||
Config.OverrideEndianness =
|
||||
StringSwitch<Optional<IFSEndiannessType>>(A->getValue())
|
||||
StringSwitch<std::optional<IFSEndiannessType>>(A->getValue())
|
||||
.Case("little", IFSEndiannessType::Little)
|
||||
.Case("big", IFSEndiannessType::Big)
|
||||
.Default(std::nullopt);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
|
||||
using namespace llvm;
|
||||
@@ -208,7 +209,7 @@ static bool readLocationInfo(LocationInfoTy &LocationInfo) {
|
||||
Arg.Val.getAsInteger(10, UnrollCount);
|
||||
}
|
||||
|
||||
const Optional<remarks::RemarkLocation> &Loc = Remark.Loc;
|
||||
const std::optional<remarks::RemarkLocation> &Loc = Remark.Loc;
|
||||
if (!Loc)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "OutputStyle.h"
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
@@ -24,6 +23,7 @@
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@@ -67,7 +67,7 @@ struct PdbDbiModuleInfo {
|
||||
StringRef Mod;
|
||||
std::vector<StringRef> SourceFiles;
|
||||
std::vector<CodeViewYAML::YAMLDebugSubsection> Subsections;
|
||||
Optional<PdbModiStream> Modi;
|
||||
std::optional<PdbModiStream> Modi;
|
||||
};
|
||||
|
||||
struct PdbDbiStream {
|
||||
@@ -94,16 +94,16 @@ struct PdbPublicsStream {
|
||||
struct PdbObject {
|
||||
explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
|
||||
|
||||
Optional<MSFHeaders> Headers;
|
||||
Optional<std::vector<uint32_t>> StreamSizes;
|
||||
Optional<std::vector<StreamBlockList>> StreamMap;
|
||||
Optional<PdbInfoStream> PdbStream;
|
||||
Optional<PdbDbiStream> DbiStream;
|
||||
Optional<PdbTpiStream> TpiStream;
|
||||
Optional<PdbTpiStream> IpiStream;
|
||||
Optional<PdbPublicsStream> PublicsStream;
|
||||
std::optional<MSFHeaders> Headers;
|
||||
std::optional<std::vector<uint32_t>> StreamSizes;
|
||||
std::optional<std::vector<StreamBlockList>> StreamMap;
|
||||
std::optional<PdbInfoStream> PdbStream;
|
||||
std::optional<PdbDbiStream> DbiStream;
|
||||
std::optional<PdbTpiStream> TpiStream;
|
||||
std::optional<PdbTpiStream> IpiStream;
|
||||
std::optional<PdbPublicsStream> PublicsStream;
|
||||
|
||||
Optional<std::vector<StringRef>> StringTable;
|
||||
std::optional<std::vector<StringRef>> StringTable;
|
||||
|
||||
BumpPtrAllocator &Allocator;
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llvm/ObjectYAML/DWARFYAML.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@@ -165,7 +166,7 @@ Error dumpDebugRanges(DWARFContext &DCtx, DWARFYAML::Data &Y) {
|
||||
return ErrorSuccess();
|
||||
}
|
||||
|
||||
static Optional<DWARFYAML::PubSection>
|
||||
static std::optional<DWARFYAML::PubSection>
|
||||
dumpPubSection(const DWARFContext &DCtx, const DWARFSection &Section,
|
||||
bool IsGNUStyle) {
|
||||
DWARFYAML::PubSection Y;
|
||||
|
||||
@@ -54,11 +54,11 @@ class ELFDumper {
|
||||
Expected<std::vector<ELFYAML::ProgramHeader>>
|
||||
dumpProgramHeaders(ArrayRef<std::unique_ptr<ELFYAML::Chunk>> Sections);
|
||||
|
||||
Optional<DWARFYAML::Data>
|
||||
std::optional<DWARFYAML::Data>
|
||||
dumpDWARFSections(std::vector<std::unique_ptr<ELFYAML::Chunk>> &Sections);
|
||||
|
||||
Error dumpSymbols(const Elf_Shdr *Symtab,
|
||||
Optional<std::vector<ELFYAML::Symbol>> &Symbols);
|
||||
std::optional<std::vector<ELFYAML::Symbol>> &Symbols);
|
||||
Error dumpSymbol(const Elf_Sym *Sym, const Elf_Shdr *SymTab,
|
||||
StringRef StrTable, ELFYAML::Symbol &S);
|
||||
Expected<std::vector<std::unique_ptr<ELFYAML::Chunk>>> dumpSections();
|
||||
@@ -102,7 +102,7 @@ class ELFDumper {
|
||||
dumpPlaceholderSection(const Elf_Shdr *Shdr);
|
||||
|
||||
bool shouldPrintSection(const ELFYAML::Section &S, const Elf_Shdr &SHdr,
|
||||
Optional<DWARFYAML::Data> DWARF);
|
||||
std::optional<DWARFYAML::Data> DWARF);
|
||||
|
||||
public:
|
||||
ELFDumper(const object::ELFFile<ELFT> &O, std::unique_ptr<DWARFContext> DCtx);
|
||||
@@ -183,7 +183,7 @@ ELFDumper<ELFT>::getUniquedSymbolName(const Elf_Sym *Sym, StringRef StrTable,
|
||||
template <class ELFT>
|
||||
bool ELFDumper<ELFT>::shouldPrintSection(const ELFYAML::Section &S,
|
||||
const Elf_Shdr &SHdr,
|
||||
Optional<DWARFYAML::Data> DWARF) {
|
||||
std::optional<DWARFYAML::Data> DWARF) {
|
||||
// We only print the SHT_NULL section at index 0 when it
|
||||
// has at least one non-null field, because yaml2obj
|
||||
// normally creates the zero section at index 0 implicitly.
|
||||
@@ -511,7 +511,7 @@ ELFDumper<ELFT>::dumpProgramHeaders(
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
Optional<DWARFYAML::Data> ELFDumper<ELFT>::dumpDWARFSections(
|
||||
std::optional<DWARFYAML::Data> ELFDumper<ELFT>::dumpDWARFSections(
|
||||
std::vector<std::unique_ptr<ELFYAML::Chunk>> &Sections) {
|
||||
DWARFYAML::Data DWARF;
|
||||
for (std::unique_ptr<ELFYAML::Chunk> &C : Sections) {
|
||||
@@ -674,7 +674,8 @@ ELFDumper<ELFT>::dumpSections() {
|
||||
|
||||
template <class ELFT>
|
||||
Error ELFDumper<ELFT>::dumpSymbols(
|
||||
const Elf_Shdr *Symtab, Optional<std::vector<ELFYAML::Symbol>> &Symbols) {
|
||||
const Elf_Shdr *Symtab,
|
||||
std::optional<std::vector<ELFYAML::Symbol>> &Symbols) {
|
||||
if (!Symtab)
|
||||
return Error::success();
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
|
||||
cl::Prefix, cl::cat(Cat));
|
||||
} // namespace
|
||||
|
||||
static Optional<std::string> preprocess(StringRef Buf,
|
||||
yaml::ErrorHandler ErrHandler) {
|
||||
static std::optional<std::string> preprocess(StringRef Buf,
|
||||
yaml::ErrorHandler ErrHandler) {
|
||||
DenseMap<StringRef, StringRef> Defines;
|
||||
for (StringRef Define : D) {
|
||||
StringRef Macro, Definition;
|
||||
@@ -134,7 +134,8 @@ int main(int argc, char **argv) {
|
||||
if (!Buf)
|
||||
return 1;
|
||||
|
||||
Optional<std::string> Buffer = preprocess(Buf.get()->getBuffer(), ErrHandler);
|
||||
std::optional<std::string> Buffer =
|
||||
preprocess(Buf.get()->getBuffer(), ErrHandler);
|
||||
if (!Buffer)
|
||||
return 1;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "llvm/Support/FormatVariadic.h"
|
||||
#include "llvm/Support/ToolOutputFile.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace mlir;
|
||||
|
||||
@@ -52,7 +53,7 @@ struct LinalgYAMLContext {
|
||||
struct LinalgOpMetadata {
|
||||
std::string name;
|
||||
std::string cppClassName;
|
||||
Optional<std::string> doc;
|
||||
std::optional<std::string> doc;
|
||||
SmallVector<std::string> implements;
|
||||
SmallVector<std::string> defines;
|
||||
};
|
||||
@@ -76,11 +77,11 @@ enum class LinalgOperandDefKind {
|
||||
struct LinalgOperandDef {
|
||||
std::string name;
|
||||
LinalgOperandDefKind kind;
|
||||
Optional<std::string> typeVar;
|
||||
Optional<SerializedAffineMap> shapeMap;
|
||||
Optional<SerializedAffineMap> indexAttrMap;
|
||||
Optional<SmallVector<int64_t>> defaultIndices;
|
||||
Optional<std::string> defaultFn;
|
||||
std::optional<std::string> typeVar;
|
||||
std::optional<SerializedAffineMap> shapeMap;
|
||||
std::optional<SerializedAffineMap> indexAttrMap;
|
||||
std::optional<SmallVector<int64_t>> defaultIndices;
|
||||
std::optional<std::string> defaultFn;
|
||||
};
|
||||
|
||||
enum class LinalgIteratorTypeDef {
|
||||
@@ -89,7 +90,7 @@ enum class LinalgIteratorTypeDef {
|
||||
};
|
||||
|
||||
struct LinalgIndexingMapsConfig {
|
||||
Optional<SmallVector<SerializedAffineMap>> staticIndexingMaps;
|
||||
std::optional<SmallVector<SerializedAffineMap>> staticIndexingMaps;
|
||||
};
|
||||
|
||||
struct ScalarExpression;
|
||||
@@ -98,19 +99,19 @@ enum class ScalarFnKind { Unary, Binary, Type };
|
||||
|
||||
struct ScalarFn {
|
||||
ScalarFnKind kind;
|
||||
Optional<std::string> fnName;
|
||||
Optional<std::string> attrName;
|
||||
Optional<std::string> typeVar;
|
||||
std::optional<std::string> fnName;
|
||||
std::optional<std::string> attrName;
|
||||
std::optional<std::string> typeVar;
|
||||
// NOTE: This must be of arity 1, but to break the self-referential cycle,
|
||||
// we use a heap allocated vector.
|
||||
std::vector<ScalarExpression> operands;
|
||||
};
|
||||
|
||||
struct ScalarExpression {
|
||||
Optional<std::string> arg;
|
||||
Optional<std::string> constant;
|
||||
Optional<int64_t> index;
|
||||
Optional<ScalarFn> scalarFn;
|
||||
std::optional<std::string> arg;
|
||||
std::optional<std::string> constant;
|
||||
std::optional<int64_t> index;
|
||||
std::optional<ScalarFn> scalarFn;
|
||||
};
|
||||
|
||||
struct ScalarAssign {
|
||||
@@ -126,8 +127,8 @@ struct LinalgStructuredOpConfig {
|
||||
};
|
||||
|
||||
struct LinalgOpConfig {
|
||||
Optional<LinalgOpMetadata> metadata;
|
||||
Optional<LinalgStructuredOpConfig> structuredOp;
|
||||
std::optional<LinalgOpMetadata> metadata;
|
||||
std::optional<LinalgStructuredOpConfig> structuredOp;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user