diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 73986b274076..834946411b84 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -410,7 +410,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, if (TI.getTriple().getOS() == llvm::Triple::ShaderModel) { VersionTuple Version = TI.getTriple().getOSVersion(); Builder.defineMacro("__SHADER_TARGET_MAJOR", Twine(Version.getMajor())); - unsigned Minor = Version.getMinor() ? *Version.getMinor() : 0; + unsigned Minor = Version.getMinor().getValueOr(0); Builder.defineMacro("__SHADER_TARGET_MINOR", Twine(Minor)); } return; diff --git a/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp b/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp index 162f1db0189b..da2041d54104 100644 --- a/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp @@ -90,10 +90,8 @@ Error CVSymbolVisitor::visitSymbolStreamFiltered(const CVSymbolArray &Symbols, if (!Filter.SymbolOffset) return visitSymbolStream(Symbols); uint32_t SymbolOffset = *Filter.SymbolOffset; - uint32_t ParentRecurseDepth = - Filter.ParentRecursiveDepth ? *Filter.ParentRecursiveDepth : 0; - uint32_t ChildrenRecurseDepth = - Filter.ChildRecursiveDepth ? *Filter.ChildRecursiveDepth : 0; + uint32_t ParentRecurseDepth = Filter.ParentRecursiveDepth.getValueOr(0); + uint32_t ChildrenRecurseDepth = Filter.ChildRecursiveDepth.getValueOr(0); if (!Symbols.isOffsetValid(SymbolOffset)) return createStringError(inconvertibleErrorCode(), "Invalid symbol offset"); CVSymbol Sym = *Symbols.at(SymbolOffset); diff --git a/llvm/lib/InterfaceStub/ELFObjHandler.cpp b/llvm/lib/InterfaceStub/ELFObjHandler.cpp index 6f37cf6f7e8a..55d06cd224f7 100644 --- a/llvm/lib/InterfaceStub/ELFObjHandler.cpp +++ b/llvm/lib/InterfaceStub/ELFObjHandler.cpp @@ -217,7 +217,7 @@ public: // time as long as it is not SHN_UNDEF. Set shndx to 1, which // points to ".dynsym". uint16_t Shndx = Sym.Undefined ? SHN_UNDEF : 1; - uint64_t Size = Sym.Size ? *Sym.Size : 0; + uint64_t Size = Sym.Size.getValueOr(0); DynSym.Content.add(DynStr.Content.getOffset(Sym.Name), Size, Bind, convertIFSSymbolTypeToELF(Sym.Type), 0, Shndx); }