forked from OSchip/llvm-project
[lld] Don't use Optional::hasValue (NFC)
This patch replaces x.hasValue() with x where x is contextually convertible to bool.
This commit is contained in:
parent
96d1b4ddb2
commit
586fb81eee
|
@ -744,7 +744,7 @@ static void updateARMVFPArgs(const ARMAttributeParser &attributes,
|
|||
static void updateSupportedARMFeatures(const ARMAttributeParser &attributes) {
|
||||
Optional<unsigned> attr =
|
||||
attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
|
||||
if (!attr.hasValue())
|
||||
if (!attr)
|
||||
return;
|
||||
auto arch = attr.getValue();
|
||||
switch (arch) {
|
||||
|
|
|
@ -367,7 +367,7 @@ macho::PriorityBuilder::buildInputSectionPriorities() {
|
|||
|
||||
auto addSym = [&](const Defined *sym) {
|
||||
Optional<size_t> symbolPriority = getSymbolPriority(sym);
|
||||
if (!symbolPriority.hasValue())
|
||||
if (!symbolPriority)
|
||||
return;
|
||||
size_t &priority = sectionPriorities[sym->isec];
|
||||
priority = std::max(priority, symbolPriority.getValue());
|
||||
|
|
|
@ -249,9 +249,9 @@ class InputFunction : public InputChunk {
|
|||
public:
|
||||
InputFunction(const WasmSignature &s, const WasmFunction *func, ObjFile *f)
|
||||
: InputChunk(f, InputChunk::Function, func->SymbolName), signature(s),
|
||||
function(func), exportName(func && func->ExportName.hasValue()
|
||||
? (*func->ExportName).str()
|
||||
: llvm::Optional<std::string>()) {
|
||||
function(func),
|
||||
exportName(func && func->ExportName ? (*func->ExportName).str()
|
||||
: llvm::Optional<std::string>()) {
|
||||
inputSectionOffset = function->CodeSectionOffset;
|
||||
rawData =
|
||||
file->codeSection->Content.slice(inputSectionOffset, function->Size);
|
||||
|
@ -268,8 +268,8 @@ public:
|
|||
}
|
||||
|
||||
llvm::Optional<StringRef> getExportName() const {
|
||||
return exportName.hasValue() ? llvm::Optional<StringRef>(*exportName)
|
||||
: llvm::Optional<StringRef>();
|
||||
return exportName ? llvm::Optional<StringRef>(*exportName)
|
||||
: llvm::Optional<StringRef>();
|
||||
}
|
||||
void setExportName(std::string exportName) { this->exportName = exportName; }
|
||||
uint32_t getFunctionInputOffset() const { return getInputSectionOffset(); }
|
||||
|
|
Loading…
Reference in New Issue