if (FileBuildID)
return StringRef(*FileBuildID);
- return NoneType();
+ return None;
}
void setFileBuildID(StringRef ID) { FileBuildID = std::string(ID); }
if (Callback(StringRef(Name)))
return StringRef(Name);
- return NoneType();
+ return None;
}
/// Check if (possibly one out of many) function name matches the given
/// Return the name of the section this function originated from.
Optional<StringRef> getOriginSectionName() const {
if (!OriginSection)
- return NoneType();
+ return None;
return OriginSection->getName();
}
unsigned Index) const {
const MCInst *AnnotationInst = getAnnotationInst(Inst);
if (!AnnotationInst)
- return NoneType();
+ return None;
for (int I = AnnotationInst->getNumOperands() - 1; I >= 0; --I) {
int64_t ImmValue = AnnotationInst->getOperand(I).getImm();
}
}
- return NoneType();
+ return None;
}
protected:
auto AI = AnnotationNameIndexMap.find(Name);
if (AI != AnnotationNameIndexMap.end())
return AI->second;
- return NoneType();
+ return None;
}
/// Return annotation index matching the \p Name. Create a new index if the
}
}
- return NoneType();
+ return None;
}
ErrorOr<BinarySection &> BinaryContext::getSectionForAddress(uint64_t Address) {
Optional<MCLandingPad> MCPlusBuilder::getEHInfo(const MCInst &Inst) const {
if (!isCall(Inst))
- return NoneType();
+ return None;
Optional<int64_t> LPSym =
getAnnotationOpValue(Inst, MCAnnotation::kEHLandingPad);
if (!LPSym)
- return NoneType();
+ return None;
Optional<int64_t> Action =
getAnnotationOpValue(Inst, MCAnnotation::kEHAction);
if (!Action)
- return NoneType();
+ return None;
return std::make_pair(reinterpret_cast<const MCSymbol *>(*LPSym),
static_cast<uint64_t>(*Action));
Optional<int64_t> Value =
getAnnotationOpValue(Inst, MCAnnotation::kConditionalTailCall);
if (!Value)
- return NoneType();
+ return None;
return static_cast<uint64_t>(*Value);
}
Optional<uint32_t> MCPlusBuilder::getOffset(const MCInst &Inst) const {
Optional<int64_t> Value = getAnnotationOpValue(Inst, MCAnnotation::kOffset);
if (!Value)
- return NoneType();
+ return None;
return static_cast<uint32_t>(*Value);
}
auto Iter = Maps.find(FuncAddress);
if (Iter == Maps.end())
- return NoneType();
+ return None;
const MapTy &Map = Iter->second;
auto FromIter = Map.upper_bound(From);
SmallVector<std::pair<uint64_t, uint64_t>, 16> Res;
if (!recordTrace(BF, FirstLBR, SecondLBR, Count, &Res))
- return NoneType();
+ return None;
return Res;
}
if (LineEnd == StringRef::npos) {
reportError("expected rest of line");
Diag << "Found: " << ParsingBuf << "\n";
- return NoneType();
+ return None;
}
StringRef Line = ParsingBuf.substr(0, LineEnd);
size_t Pos = Line.find("PERF_RECORD_COMM exec");
if (Pos == StringRef::npos)
- return NoneType();
+ return None;
Line = Line.drop_front(Pos);
// Line:
if (PIDStr.getAsInteger(10, PID)) {
reportError("expected PID");
Diag << "Found: " << PIDStr << "in '" << Line << "'\n";
- return NoneType();
+ return None;
}
return PID;
uint64_t USecTime;
if (SecTimeStr.getAsInteger(10, SecTime) ||
USecTimeStr.getAsInteger(10, USecTime))
- return NoneType();
+ return None;
return SecTime * 1000000ULL + USecTime;
}
}
if (LineEnd == StringRef::npos) {
reportError("expected rest of line");
Diag << "Found: " << ParsingBuf << "\n";
- return NoneType();
+ return None;
}
StringRef Line = ParsingBuf.substr(0, LineEnd);
size_t Pos = Line.find("PERF_RECORD_FORK");
if (Pos == StringRef::npos) {
consumeRestOfLine();
- return NoneType();
+ return None;
}
ForkInfo FI;
if (ChildPIDStr.getAsInteger(10, FI.ChildPID)) {
reportError("expected PID");
Diag << "Found: " << ChildPIDStr << "in '" << Line << "'\n";
- return NoneType();
+ return None;
}
const StringRef ParentPIDStr = Line.rsplit('(').second.split(':').first;
if (ParentPIDStr.getAsInteger(10, FI.ParentPID)) {
reportError("expected PID");
Diag << "Found: " << ParentPIDStr << "in '" << Line << "'\n";
- return NoneType();
+ return None;
}
consumeRestOfLine();
ErrorOr<StringRef> BuildIDStr = parseString(FieldSeparator, true);
if (std::error_code EC = BuildIDStr.getError())
- return NoneType();
+ return None;
// If one of the strings is missing, don't issue a parsing error, but still
// do not return a value.
consumeAllRemainingFS();
if (checkNewLine())
- return NoneType();
+ return None;
ErrorOr<StringRef> NameStr = parseString(FieldSeparator, true);
if (std::error_code EC = NameStr.getError())
- return NoneType();
+ return None;
consumeRestOfLine();
return std::make_pair(NameStr.get(), BuildIDStr.get());
if (!FileName.empty())
return FileName;
- return NoneType();
+ return None;
}
std::error_code
return Name.substr(0, LTOSuffixPos + 11);
if ((LTOSuffixPos = Name.find(".llvm.")) != StringRef::npos)
return Name.substr(0, LTOSuffixPos + 6);
- return NoneType();
+ return None;
}
namespace {
Optional<std::string> RewriteInstance::getPrintableBuildID() const {
if (BuildID.empty())
- return NoneType();
+ return None;
std::string Str;
raw_string_ostream OS(Str);
assert(SymbolName && "cannot get symbol name");
auto updateSymbolValue = [&](const StringRef Name,
- Optional<uint64_t> Value = NoneType()) {
+ Optional<uint64_t> Value = None) {
NewSymbol.st_value = Value ? *Value : getNewValueForSymbol(Name);
NewSymbol.st_shndx = ELF::SHN_ABS;
outs() << "BOLT-INFO: setting " << Name << " to 0x"
if (FKI.Flags & MCFixupKindInfo::FKF_IsPCRel) {
switch (FKI.TargetSize) {
default:
- return NoneType();
+ return None;
case 8: RelType = ELF::R_X86_64_PC8; break;
case 16: RelType = ELF::R_X86_64_PC16; break;
case 32: RelType = ELF::R_X86_64_PC32; break;
} else {
switch (FKI.TargetSize) {
default:
- return NoneType();
+ return None;
case 8: RelType = ELF::R_X86_64_8; break;
case 16: RelType = ELF::R_X86_64_16; break;
case 32: RelType = ELF::R_X86_64_32; break;
Optional<uint8_t> readDWARFExpressionTargetReg(StringRef ExprBytes) {
uint8_t Opcode = ExprBytes[0];
if (Opcode == dwarf::DW_CFA_def_cfa_expression)
- return NoneType();
+ return None;
assert((Opcode == dwarf::DW_CFA_expression ||
Opcode == dwarf::DW_CFA_val_expression) &&
"invalid DWARF expression CFI");
SmallVector<StringRef, 3> Parts;
Profile.split(Parts, "_");
if (Parts.size() != 3)
- return NoneType();
+ return None;
Triple::EnvironmentType Kind =
StringSwitch<Triple::EnvironmentType>(Parts[0])
.Case("as", Triple::EnvironmentType::Amplification)
.Default(Triple::EnvironmentType::UnknownEnvironment);
if (Kind == Triple::EnvironmentType::UnknownEnvironment)
- return NoneType();
+ return None;
unsigned long long Major = 0;
if (llvm::getAsUnsignedInteger(Parts[1], 0, Major))
- return NoneType();
+ return None;
unsigned long long Minor = 0;
if (Parts[2] == "x" && Kind == Triple::EnvironmentType::Library)
Minor = OfflineLibMinor;
else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor))
- return NoneType();
+ return None;
// dxil-unknown-shadermodel-hull
llvm::Triple T;
if (isLegalShaderModel(T))
return T.getTriple();
else
- return NoneType();
+ return None;
}
bool isLegalValidatorVersion(StringRef ValVersionStr, const Driver &D) {
static llvm::Optional<llvm::StringRef>
guessIncludePath(llvm::StringRef path_to_file, llvm::StringRef pattern) {
if (pattern.empty())
- return llvm::NoneType();
+ return llvm::None;
size_t pos = path_to_file.find(pattern);
if (pos == llvm::StringRef::npos)
- return llvm::NoneType();
+ return llvm::None;
return path_to_file.substr(0, pos + pattern.size());
}
protected:
InlineAdvisor(Module &M, FunctionAnalysisManager &FAM,
- Optional<InlineContext> IC = NoneType::None);
+ Optional<InlineContext> IC = llvm::None);
virtual std::unique_ptr<InlineAdvice> getAdviceImpl(CallBase &CB) = 0;
virtual std::unique_ptr<InlineAdvice> getMandatoryAdvice(CallBase &CB,
bool Advice);
public:
void init(Module *Mod) {
M = Mod;
- ImpreciseReleaseMDKind = NoneType::None;
- CopyOnEscapeMDKind = NoneType::None;
- NoObjCARCExceptionsMDKind = NoneType::None;
+ ImpreciseReleaseMDKind = llvm::None;
+ CopyOnEscapeMDKind = llvm::None;
+ NoObjCARCExceptionsMDKind = llvm::None;
}
unsigned get(ARCMDKindID ID) {
DebugVariable(const DILocalVariable *Var, const DIExpression *DIExpr,
const DILocation *InlinedAt)
- : Variable(Var),
- Fragment(DIExpr ? DIExpr->getFragmentInfo() : NoneType()),
+ : Variable(Var), Fragment(DIExpr ? DIExpr->getFragmentInfo() : None),
InlinedAt(InlinedAt) {}
const DILocalVariable *getVariable() const { return Variable; }
/// Empty key: no key should be generated that has no DILocalVariable.
static inline DebugVariable getEmptyKey() {
- return DebugVariable(nullptr, NoneType(), nullptr);
+ return DebugVariable(nullptr, None, nullptr);
}
/// Difference in tombstone is that the Optional is meaningful.
for (auto &MI : MBB) {
if (MI.isDebugValue()) {
- DebugVariable Var(MI.getDebugVariable(), NoneType(),
+ DebugVariable Var(MI.getDebugVariable(), None,
MI.getDebugLoc()->getInlinedAt());
auto VMI = VariableMap.find(Var);
// Just stop tracking this variable, until we cover DBG_VALUE_LIST.
VariableMap;
for (auto &I : *BB) {
if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) {
- DebugVariable Key(DVI->getVariable(),
- NoneType(),
+ DebugVariable Key(DVI->getVariable(), None,
DVI->getDebugLoc()->getInlinedAt());
auto VMI = VariableMap.find(Key);
auto *DAI = dyn_cast<DbgAssignIntrinsic>(DVI);
DenseSet<DebugVariable> SeenDefForAggregate;
// Returns the DebugVariable for DVI with no fragment info.
auto GetAggregateVariable = [](DbgValueInst *DVI) {
- return DebugVariable(DVI->getVariable(), NoneType(),
+ return DebugVariable(DVI->getVariable(), None,
DVI->getDebugLoc()->getInlinedAt());
};
return Instr;
}
}
- return NoneType();
+ return None;
};
std::unique_ptr<DWARFContext> Ctx = DWARFContext::create(E);
DILocalVariable *VarB =
DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8, nullptr);
- DebugVariable DebugVariableA(VarA, NoneType(), nullptr);
- DebugVariable DebugVariableInlineA(VarA, NoneType(), InlinedLoc);
- DebugVariable DebugVariableB(VarB, NoneType(), nullptr);
+ DebugVariable DebugVariableA(VarA, None, nullptr);
+ DebugVariable DebugVariableInlineA(VarA, None, InlinedLoc);
+ DebugVariable DebugVariableB(VarB, None, nullptr);
DebugVariable DebugVariableFragB(VarB, {{16, 16}}, nullptr);
DebugVariableMap.insert({DebugVariableA, 2});
if (parser.parseOperand(*chunkSize) || parser.parseColonType(chunkType))
return failure();
} else {
- chunkSize = llvm::NoneType::None;
+ chunkSize = llvm::None;
}
break;
case ClauseScheduleKind::Auto:
case ClauseScheduleKind::Runtime:
- chunkSize = llvm::NoneType::None;
+ chunkSize = llvm::None;
}
// If there is a comma, we have one or more modifiers..