forked from OSchip/llvm-project
[clang] Don't use Optional::getValue (NFC)
This commit is contained in:
parent
7a47ee51a1
commit
ca4af13e48
|
@ -495,7 +495,7 @@ public:
|
|||
if (ResultKind == Ambiguous) {
|
||||
(void)WasAmbiguous;
|
||||
assert(WasAmbiguous);
|
||||
Ambiguity = SavedAK.getValue();
|
||||
Ambiguity = *SavedAK;
|
||||
} else if (Paths) {
|
||||
deletePaths(Paths);
|
||||
Paths = nullptr;
|
||||
|
|
|
@ -2833,8 +2833,7 @@ bool ASTContext::hasUniqueObjectRepresentations(QualType Ty) const {
|
|||
Optional<int64_t> StructSize =
|
||||
structHasUniqueObjectRepresentations(*this, Record);
|
||||
|
||||
return StructSize &&
|
||||
StructSize.getValue() == static_cast<int64_t>(getTypeSize(Ty));
|
||||
return StructSize && *StructSize == static_cast<int64_t>(getTypeSize(Ty));
|
||||
}
|
||||
|
||||
// FIXME: More cases to handle here (list by rsmith):
|
||||
|
|
|
@ -737,7 +737,7 @@ Stmt *BodyFarm::getBody(const FunctionDecl *D) {
|
|||
|
||||
if (FF) { Val = FF(C, D); }
|
||||
else if (Injector) { Val = Injector->getBody(D); }
|
||||
return Val.getValue();
|
||||
return *Val;
|
||||
}
|
||||
|
||||
static const ObjCIvarDecl *findBackingIvar(const ObjCPropertyDecl *Prop) {
|
||||
|
@ -900,5 +900,5 @@ Stmt *BodyFarm::getBody(const ObjCMethodDecl *D) {
|
|||
|
||||
Val = createObjCPropertyGetter(C, D);
|
||||
|
||||
return Val.getValue();
|
||||
return *Val;
|
||||
}
|
||||
|
|
|
@ -1065,7 +1065,7 @@ private:
|
|||
// 'swift_async' goes first and overrides anything else.
|
||||
if (auto ConventionalAsync =
|
||||
isConventionalSwiftAsync(Function, ParamIndex)) {
|
||||
return ConventionalAsync.getValue();
|
||||
return *ConventionalAsync;
|
||||
}
|
||||
|
||||
return shouldBeCalledOnce(Function->getParamDecl(ParamIndex)) ||
|
||||
|
@ -1082,7 +1082,7 @@ private:
|
|||
|
||||
// 'swift_async' goes first and overrides anything else.
|
||||
if (auto ConventionalAsync = isConventionalSwiftAsync(Method, ParamIndex)) {
|
||||
return ConventionalAsync.getValue();
|
||||
return *ConventionalAsync;
|
||||
}
|
||||
|
||||
const ParmVarDecl *Parameter = Method->getParamDecl(ParamIndex);
|
||||
|
|
|
@ -351,7 +351,7 @@ static unsigned scanFromBlock(const CFGBlock *Start,
|
|||
shouldTreatSuccessorsAsReachable(item, *PP);
|
||||
}
|
||||
|
||||
if (TreatAllSuccessorsAsReachable.getValue()) {
|
||||
if (*TreatAllSuccessorsAsReachable) {
|
||||
B = UB;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -109,8 +109,7 @@ parseTargetID(const llvm::Triple &T, llvm::StringRef TargetID,
|
|||
if (!OptionalProcessor)
|
||||
return llvm::None;
|
||||
|
||||
llvm::StringRef Processor =
|
||||
getCanonicalProcessorName(T, OptionalProcessor.getValue());
|
||||
llvm::StringRef Processor = getCanonicalProcessorName(T, *OptionalProcessor);
|
||||
if (Processor.empty())
|
||||
return llvm::None;
|
||||
|
||||
|
@ -150,8 +149,7 @@ getConflictTargetIDCombination(const std::set<llvm::StringRef> &TargetIDs) {
|
|||
llvm::StringMap<Info> FeatureMap;
|
||||
for (auto &&ID : TargetIDs) {
|
||||
llvm::StringMap<bool> Features;
|
||||
llvm::StringRef Proc =
|
||||
parseTargetIDWithFormatCheckingOnly(ID, &Features).getValue();
|
||||
llvm::StringRef Proc = *parseTargetIDWithFormatCheckingOnly(ID, &Features);
|
||||
auto Loc = FeatureMap.find(Proc);
|
||||
if (Loc == FeatureMap.end())
|
||||
FeatureMap[Proc] = Info{ID, Features};
|
||||
|
|
|
@ -418,8 +418,7 @@ void AMDGPUTargetInfo::getTargetDefines(const LangOptions &Opts,
|
|||
Builder.defineMacro("__amdgcn_processor__",
|
||||
Twine("\"") + Twine(CanonName) + Twine("\""));
|
||||
Builder.defineMacro("__amdgcn_target_id__",
|
||||
Twine("\"") + Twine(getTargetID().getValue()) +
|
||||
Twine("\""));
|
||||
Twine("\"") + Twine(*getTargetID()) + Twine("\""));
|
||||
for (auto F : getAllPossibleTargetIDFeatures(getTriple(), CanonName)) {
|
||||
auto Loc = OffloadArchFeatures.find(F);
|
||||
if (Loc != OffloadArchFeatures.end()) {
|
||||
|
|
|
@ -4286,7 +4286,7 @@ void CGDebugInfo::AppendAddressSpaceXDeref(
|
|||
return;
|
||||
|
||||
Expr.push_back(llvm::dwarf::DW_OP_constu);
|
||||
Expr.push_back(DWARFAddressSpace.getValue());
|
||||
Expr.push_back(*DWARFAddressSpace);
|
||||
Expr.push_back(llvm::dwarf::DW_OP_swap);
|
||||
Expr.push_back(llvm::dwarf::DW_OP_xderef);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) {
|
|||
}
|
||||
|
||||
uint64_t Major = Version.getMajor();
|
||||
uint64_t Minor = Version.getMinor().getValue();
|
||||
uint64_t Minor = *Version.getMinor();
|
||||
|
||||
auto &Ctx = M.getContext();
|
||||
IRBuilder<> B(M.getContext());
|
||||
|
|
|
@ -442,7 +442,7 @@ CodeGen::RValue CGObjCRuntime::GeneratePossiblySpecializedMessageSend(
|
|||
if (Optional<llvm::Value *> SpecializedResult =
|
||||
tryGenerateSpecializedMessageSend(CGF, ResultType, Receiver, Args,
|
||||
Sel, Method, isClassMessage)) {
|
||||
return RValue::get(SpecializedResult.getValue());
|
||||
return RValue::get(*SpecializedResult);
|
||||
}
|
||||
return GenerateMessageSend(CGF, Return, ResultType, Sel, Receiver, Args, OID,
|
||||
Method);
|
||||
|
|
|
@ -10788,7 +10788,7 @@ void CGOpenMPRuntime::registerTargetGlobalVariable(const VarDecl *VD,
|
|||
// If we have host/nohost variables, they do not need to be registered.
|
||||
Optional<OMPDeclareTargetDeclAttr::DevTypeTy> DevTy =
|
||||
OMPDeclareTargetDeclAttr::getDeviceType(VD);
|
||||
if (DevTy && DevTy.getValue() != OMPDeclareTargetDeclAttr::DT_Any)
|
||||
if (DevTy && *DevTy != OMPDeclareTargetDeclAttr::DT_Any)
|
||||
return;
|
||||
|
||||
llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy> Res =
|
||||
|
@ -12192,8 +12192,7 @@ static llvm::Value *getAlignmentValue(CodeGenModule &CGM, const VarDecl *VD) {
|
|||
if (!AllocateAlignment)
|
||||
return nullptr;
|
||||
|
||||
return llvm::ConstantInt::get(CGM.SizeTy,
|
||||
AllocateAlignment.getValue().getQuantity());
|
||||
return llvm::ConstantInt::get(CGM.SizeTy, AllocateAlignment->getQuantity());
|
||||
}
|
||||
|
||||
Address CGOpenMPRuntime::getAddressOfLocalVariable(CodeGenFunction &CGF,
|
||||
|
|
|
@ -3663,7 +3663,7 @@ void CGOpenMPRuntimeGPU::emitFunctionProlog(CodeGenFunction &CGF,
|
|||
CheckVarsEscapingDeclContext VarChecker(CGF, llvm::None);
|
||||
VarChecker.Visit(Body);
|
||||
I->getSecond().SecondaryLocalVarData.emplace();
|
||||
DeclToAddrMapTy &Data = I->getSecond().SecondaryLocalVarData.getValue();
|
||||
DeclToAddrMapTy &Data = *I->getSecond().SecondaryLocalVarData;
|
||||
for (const ValueDecl *VD : VarChecker.getEscapedDecls()) {
|
||||
assert(VD->isCanonicalDecl() && "Expected canonical declaration");
|
||||
Data.insert(std::make_pair(VD, MappedVarData()));
|
||||
|
|
|
@ -502,8 +502,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
|
|||
getContext().getTargetInfo().getVScaleRange(getLangOpts());
|
||||
if (VScaleRange) {
|
||||
CurFn->addFnAttr(llvm::Attribute::getWithVScaleRangeArgs(
|
||||
getLLVMContext(), VScaleRange.getValue().first,
|
||||
VScaleRange.getValue().second));
|
||||
getLLVMContext(), VScaleRange->first, VScaleRange->second));
|
||||
}
|
||||
|
||||
// If we generated an unreachable return block, delete it now.
|
||||
|
|
|
@ -4461,7 +4461,7 @@ LangAS CodeGenModule::GetGlobalConstantAddressSpace() const {
|
|||
// casted to Generic pointers which are used to model HIP's "flat" pointers.
|
||||
return LangAS::cuda_device;
|
||||
if (auto AS = getTarget().getConstantAddressSpace())
|
||||
return AS.getValue();
|
||||
return *AS;
|
||||
return LangAS::Default;
|
||||
}
|
||||
|
||||
|
@ -4736,7 +4736,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
|
|||
// Check for alignment specifed in an 'omp allocate' directive.
|
||||
if (llvm::Optional<CharUnits> AlignValFromAllocate =
|
||||
getOMPAllocateAlignment(D))
|
||||
AlignVal = AlignValFromAllocate.getValue();
|
||||
AlignVal = *AlignValFromAllocate;
|
||||
GV->setAlignment(AlignVal.getAsAlign());
|
||||
|
||||
// On Darwin, unlike other Itanium C++ ABI platforms, the thread-wrapper
|
||||
|
|
|
@ -9495,7 +9495,7 @@ AMDGPUTargetCodeGenInfo::getGlobalVarAddressSpace(CodeGenModule &CGM,
|
|||
if (CGM.isTypeConstant(D->getType(), false) &&
|
||||
D->hasConstantInitialization()) {
|
||||
if (auto ConstAS = CGM.getTarget().getConstantAddressSpace())
|
||||
return ConstAS.getValue();
|
||||
return *ConstAS;
|
||||
}
|
||||
return DefaultGlobalAS;
|
||||
}
|
||||
|
|
|
@ -1242,7 +1242,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
|
|||
StringRef TargetProfile = A->getValue();
|
||||
if (auto Triple =
|
||||
toolchains::HLSLToolChain::parseTargetProfile(TargetProfile))
|
||||
TargetTriple = Triple.getValue();
|
||||
TargetTriple = *Triple;
|
||||
else
|
||||
Diag(diag::err_drv_invalid_directx_shader_module) << TargetProfile;
|
||||
|
||||
|
@ -3006,8 +3006,7 @@ class OffloadingActionBuilder final {
|
|||
auto &&ConflictingArchs = getConflictOffloadArchCombination(GpuArchs);
|
||||
if (ConflictingArchs) {
|
||||
C.getDriver().Diag(clang::diag::err_drv_bad_offload_arch_combo)
|
||||
<< ConflictingArchs.getValue().first
|
||||
<< ConflictingArchs.getValue().second;
|
||||
<< ConflictingArchs->first << ConflictingArchs->second;
|
||||
C.setContainsError();
|
||||
return true;
|
||||
}
|
||||
|
@ -3195,7 +3194,7 @@ class OffloadingActionBuilder final {
|
|||
C.setContainsError();
|
||||
return StringRef();
|
||||
}
|
||||
auto CanId = getCanonicalTargetID(ArchStr.getValue(), Features);
|
||||
auto CanId = getCanonicalTargetID(*ArchStr, Features);
|
||||
return Args.MakeArgStringRef(CanId);
|
||||
};
|
||||
|
||||
|
@ -4314,8 +4313,7 @@ static StringRef getCanonicalArchString(Compilation &C,
|
|||
C.setContainsError();
|
||||
return StringRef();
|
||||
}
|
||||
return Args.MakeArgStringRef(
|
||||
getCanonicalTargetID(Arch.getValue(), Features));
|
||||
return Args.MakeArgStringRef(getCanonicalTargetID(*Arch, Features));
|
||||
}
|
||||
|
||||
// If the input isn't CUDA or HIP just return the architecture.
|
||||
|
@ -4371,8 +4369,7 @@ Driver::getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
|
|||
|
||||
if (auto ConflictingArchs = getConflictOffloadArchCombination(Archs, Kind)) {
|
||||
C.getDriver().Diag(clang::diag::err_drv_bad_offload_arch_combo)
|
||||
<< ConflictingArchs.getValue().first
|
||||
<< ConflictingArchs.getValue().second;
|
||||
<< ConflictingArchs->first << ConflictingArchs->second;
|
||||
C.setContainsError();
|
||||
}
|
||||
|
||||
|
|
|
@ -552,7 +552,7 @@ void amdgpu::getAMDGPUTargetFeatures(const Driver &D,
|
|||
llvm::StringMap<bool> FeatureMap;
|
||||
auto OptionalGpuArch = parseTargetID(Triple, TargetID, &FeatureMap);
|
||||
if (OptionalGpuArch) {
|
||||
StringRef GpuArch = OptionalGpuArch.getValue();
|
||||
StringRef GpuArch = *OptionalGpuArch;
|
||||
// Iterate through all possible target ID features for the given GPU.
|
||||
// If it is mapped to true, add +feature.
|
||||
// If it is mapped to false, add -feature.
|
||||
|
@ -730,7 +730,7 @@ AMDGPUToolChain::getParsedTargetID(const llvm::opt::ArgList &DriverArgs) const {
|
|||
if (!OptionalGpuArch)
|
||||
return {TargetID.str(), None, None};
|
||||
|
||||
return {TargetID.str(), OptionalGpuArch.getValue().str(), FeatureMap};
|
||||
return {TargetID.str(), OptionalGpuArch->str(), FeatureMap};
|
||||
}
|
||||
|
||||
void AMDGPUToolChain::checkTargetID(
|
||||
|
@ -738,7 +738,7 @@ void AMDGPUToolChain::checkTargetID(
|
|||
auto PTID = getParsedTargetID(DriverArgs);
|
||||
if (PTID.OptionalTargetID && !PTID.OptionalGPUArch) {
|
||||
getDriver().Diag(clang::diag::err_drv_bad_target_id)
|
||||
<< PTID.OptionalTargetID.getValue();
|
||||
<< *PTID.OptionalTargetID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ void AVRToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
|||
return;
|
||||
|
||||
// Add 'avr-libc/include' to clang system include paths if applicable.
|
||||
std::string AVRInc = AVRLibcRoot.getValue() + "/include";
|
||||
std::string AVRInc = *AVRLibcRoot + "/include";
|
||||
if (llvm::sys::fs::is_directory(AVRInc))
|
||||
addSystemInclude(DriverArgs, CC1Args, AVRInc);
|
||||
}
|
||||
|
|
|
@ -411,6 +411,6 @@ void HIPAMDToolChain::checkTargetID(
|
|||
auto PTID = getParsedTargetID(DriverArgs);
|
||||
if (PTID.OptionalTargetID && !PTID.OptionalGPUArch) {
|
||||
getDriver().Diag(clang::diag::err_drv_bad_target_id)
|
||||
<< PTID.OptionalTargetID.getValue();
|
||||
<< *PTID.OptionalTargetID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ bool isLegalValidatorVersion(StringRef ValVersionStr, const Driver &D) {
|
|||
}
|
||||
|
||||
uint64_t Major = Version.getMajor();
|
||||
uint64_t Minor = Version.getMinor().getValue();
|
||||
uint64_t Minor = *Version.getMinor();
|
||||
if (Major == 0 && Minor != 0) {
|
||||
D.Diag(diag::err_drv_invalid_empty_dxil_validator_version) << ValVersionStr;
|
||||
return false;
|
||||
|
|
|
@ -230,7 +230,7 @@ void hexagon::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
|
||||
CmdArgs.push_back(Args.MakeArgString("-gpsize=" + Twine(G.getValue())));
|
||||
CmdArgs.push_back(Args.MakeArgString("-gpsize=" + Twine(*G)));
|
||||
}
|
||||
|
||||
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
|
||||
|
@ -569,7 +569,7 @@ void HexagonToolChain::getHexagonLibraryPaths(const ArgList &Args,
|
|||
// Assume G0 with -shared.
|
||||
bool HasG0 = Args.hasArg(options::OPT_shared);
|
||||
if (auto G = getSmallDataThreshold(Args))
|
||||
HasG0 = G.getValue() == 0;
|
||||
HasG0 = *G == 0;
|
||||
|
||||
const std::string CpuVer = GetTargetCPUVersion(Args).str();
|
||||
for (auto &Dir : RootDirs) {
|
||||
|
|
|
@ -1756,8 +1756,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(
|
|||
SkipFunctionBodies == SkipFunctionBodiesScope::PreambleAndMainFile;
|
||||
|
||||
if (ModuleFormat)
|
||||
CI->getHeaderSearchOpts().ModuleFormat =
|
||||
std::string(ModuleFormat.getValue());
|
||||
CI->getHeaderSearchOpts().ModuleFormat = std::string(*ModuleFormat);
|
||||
|
||||
// Create the AST unit.
|
||||
std::unique_ptr<ASTUnit> AST;
|
||||
|
|
|
@ -1074,7 +1074,7 @@ static void initOption(AnalyzerOptions::ConfigTable &Config,
|
|||
else
|
||||
OptionField = DefaultVal;
|
||||
} else
|
||||
OptionField = PossiblyInvalidVal.getValue();
|
||||
OptionField = *PossiblyInvalidVal;
|
||||
}
|
||||
|
||||
static void initOption(AnalyzerOptions::ConfigTable &Config,
|
||||
|
|
|
@ -625,7 +625,7 @@ bool Scanner::lexPragma(const char *&First, const char *const End) {
|
|||
if (!FoundId)
|
||||
return false;
|
||||
|
||||
StringRef Id = FoundId.getValue();
|
||||
StringRef Id = *FoundId;
|
||||
auto Kind = llvm::StringSwitch<DirectiveKind>(Id)
|
||||
.Case("once", pp_pragma_once)
|
||||
.Case("push_macro", pp_pragma_push_macro)
|
||||
|
@ -740,7 +740,7 @@ bool Scanner::lexPPLine(const char *&First, const char *const End) {
|
|||
if (!FoundId)
|
||||
return false;
|
||||
|
||||
StringRef Id = FoundId.getValue();
|
||||
StringRef Id = *FoundId;
|
||||
|
||||
if (Id == "pragma")
|
||||
return lexPragma(First, End);
|
||||
|
|
|
@ -462,7 +462,7 @@ void Preprocessor::SuggestTypoedDirective(const Token &Tok,
|
|||
CharSourceRange DirectiveRange = CharSourceRange::getCharRange(
|
||||
Tok.getLocation(),
|
||||
Tok.getLocation().getLocWithOffset(Directive.size()));
|
||||
StringRef SuggValue = Sugg.getValue();
|
||||
StringRef SuggValue = *Sugg;
|
||||
|
||||
auto Hint = FixItHint::CreateReplacement(DirectiveRange, SuggValue);
|
||||
Diag(Tok, diag::warn_pp_invalid_directive) << 1 << SuggValue << Hint;
|
||||
|
|
|
@ -1562,7 +1562,7 @@ bool Parser::parseOpenMPAppendArgs(
|
|||
// Parse the interop-types.
|
||||
if (Optional<OMPDeclareVariantAttr::InteropType> IType =
|
||||
parseInteropTypeList(*this))
|
||||
InterOpTypes.push_back(IType.getValue());
|
||||
InterOpTypes.push_back(*IType);
|
||||
else
|
||||
HasError = true;
|
||||
|
||||
|
@ -1892,7 +1892,7 @@ void Parser::ParseOMPDeclareTargetClauses(
|
|||
case OMPC_DEVICE_TYPE_unknown:
|
||||
llvm_unreachable("Unexpected device_type");
|
||||
}
|
||||
DeviceTypeLoc = DevTypeData.getValue().Loc;
|
||||
DeviceTypeLoc = DevTypeData->Loc;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -501,7 +501,7 @@ static void DoEmitAvailabilityWarning(Sema &S, AvailabilityResult K,
|
|||
SmallVector<StringRef, 12> SelectorSlotNames;
|
||||
Optional<unsigned> NumParams = tryParseObjCMethodName(
|
||||
Replacement, SelectorSlotNames, S.getLangOpts());
|
||||
if (NumParams && NumParams.getValue() == Sel.getNumArgs()) {
|
||||
if (NumParams && *NumParams == Sel.getNumArgs()) {
|
||||
assert(SelectorSlotNames.size() == Locs.size());
|
||||
for (unsigned I = 0; I < Locs.size(); ++I) {
|
||||
if (!Sel.getNameForSlot(I).empty()) {
|
||||
|
|
|
@ -1034,7 +1034,7 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
|
|||
Optional<unsigned> IndexOptional = TranslateIndex(Index);
|
||||
if (!IndexOptional)
|
||||
return llvm::None;
|
||||
unsigned NewIndex = IndexOptional.getValue();
|
||||
unsigned NewIndex = *IndexOptional;
|
||||
Expr::EvalResult Result;
|
||||
Expr *SizeArg = TheCall->getArg(NewIndex);
|
||||
if (!SizeArg->EvaluateAsInt(Result, getASTContext()))
|
||||
|
@ -1059,7 +1059,7 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
|
|||
Optional<unsigned> IndexOptional = TranslateIndex(Index);
|
||||
if (!IndexOptional)
|
||||
return llvm::None;
|
||||
unsigned NewIndex = IndexOptional.getValue();
|
||||
unsigned NewIndex = *IndexOptional;
|
||||
|
||||
const Expr *ObjArg = TheCall->getArg(NewIndex);
|
||||
uint64_t Result;
|
||||
|
@ -1074,7 +1074,7 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
|
|||
Optional<unsigned> IndexOptional = TranslateIndex(Index);
|
||||
if (!IndexOptional)
|
||||
return llvm::None;
|
||||
unsigned NewIndex = IndexOptional.getValue();
|
||||
unsigned NewIndex = *IndexOptional;
|
||||
|
||||
const Expr *ObjArg = TheCall->getArg(NewIndex);
|
||||
uint64_t Result;
|
||||
|
@ -1284,8 +1284,7 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
|
|||
}
|
||||
|
||||
if (!SourceSize || !DestinationSize ||
|
||||
llvm::APSInt::compareValues(SourceSize.getValue(),
|
||||
DestinationSize.getValue()) <= 0)
|
||||
llvm::APSInt::compareValues(*SourceSize, *DestinationSize) <= 0)
|
||||
return;
|
||||
|
||||
StringRef FunctionName = GetFunctionName();
|
||||
|
|
|
@ -5054,7 +5054,7 @@ static void AddRecordMembersCompletionResults(
|
|||
Results.allowNestedNameSpecifiers();
|
||||
std::vector<FixItHint> FixIts;
|
||||
if (AccessOpFixIt)
|
||||
FixIts.emplace_back(AccessOpFixIt.getValue());
|
||||
FixIts.emplace_back(*AccessOpFixIt);
|
||||
CodeCompletionDeclConsumer Consumer(Results, RD, BaseType, std::move(FixIts));
|
||||
SemaRef.LookupVisibleDecls(RD, Sema::LookupMemberName, Consumer,
|
||||
SemaRef.CodeCompleter->includeGlobals(),
|
||||
|
|
|
@ -2729,7 +2729,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
|
|||
if (IOSToTvOSMapping) {
|
||||
if (auto MappedVersion =
|
||||
IOSToTvOSMapping->map(Version, VersionTuple(0, 0), None)) {
|
||||
return MappedVersion.getValue();
|
||||
return *MappedVersion;
|
||||
}
|
||||
}
|
||||
return Version;
|
||||
|
|
|
@ -8239,8 +8239,7 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
|
|||
if (const Optional<unsigned> Index =
|
||||
getStackIndexOfNearestEnclosingCaptureCapableLambda(
|
||||
S.FunctionScopes, Var, S))
|
||||
S.MarkCaptureUsedInEnclosingContext(Var, VarExpr->getExprLoc(),
|
||||
Index.getValue());
|
||||
S.MarkCaptureUsedInEnclosingContext(Var, VarExpr->getExprLoc(), *Index);
|
||||
const bool IsVarNeverAConstantExpression =
|
||||
VariableCanNeverBeAConstantExpression(Var, S.Context);
|
||||
if (!IsFullExprInstantiationDependent || IsVarNeverAConstantExpression) {
|
||||
|
@ -8273,7 +8272,7 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
|
|||
if (const Optional<unsigned> Index =
|
||||
getStackIndexOfNearestEnclosingCaptureCapableLambda(
|
||||
S.FunctionScopes, /*0 is 'this'*/ nullptr, S)) {
|
||||
const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
|
||||
const unsigned FunctionScopeIndexOfCapturableLambda = *Index;
|
||||
S.CheckCXXThisCapture(CurrentLSI->PotentialThisCaptureLocation,
|
||||
/*Explicit*/ false, /*BuildAndDiagnose*/ true,
|
||||
&FunctionScopeIndexOfCapturableLambda);
|
||||
|
|
|
@ -182,7 +182,7 @@ Optional<unsigned> clang::getStackIndexOfNearestEnclosingCaptureCapableLambda(
|
|||
if (!OptionalStackIndex)
|
||||
return NoLambdaIsCaptureCapable;
|
||||
|
||||
const unsigned IndexOfCaptureReadyLambda = OptionalStackIndex.getValue();
|
||||
const unsigned IndexOfCaptureReadyLambda = *OptionalStackIndex;
|
||||
assert(((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) ||
|
||||
S.getCurGenericLambda()) &&
|
||||
"The capture ready lambda for a potential capture can only be the "
|
||||
|
@ -433,7 +433,7 @@ void Sema::handleLambdaNumbering(
|
|||
unsigned ManglingNumber, DeviceManglingNumber;
|
||||
Decl *ManglingContextDecl;
|
||||
std::tie(HasKnownInternalLinkage, ManglingNumber, DeviceManglingNumber,
|
||||
ManglingContextDecl) = Mangling.getValue();
|
||||
ManglingContextDecl) = *Mangling;
|
||||
Class->setLambdaMangling(ManglingNumber, ManglingContextDecl,
|
||||
HasKnownInternalLinkage);
|
||||
Class->setDeviceLambdaManglingNumber(DeviceManglingNumber);
|
||||
|
|
|
@ -8427,7 +8427,7 @@ Expr *OpenMPIterationSpaceChecker::buildNumIterations(
|
|||
tryBuildCapture(SemaRef, MinLessMaxRes.get(), Captures).get();
|
||||
if (!MinLessMax)
|
||||
return nullptr;
|
||||
if (TestIsLessOp.getValue()) {
|
||||
if (*TestIsLessOp) {
|
||||
// LB(MinVal) < LB(MaxVal) ? LB(MinVal) : LB(MaxVal) - min(LB(MinVal),
|
||||
// LB(MaxVal))
|
||||
ExprResult MinLB = SemaRef.ActOnConditionalOp(DefaultLoc, DefaultLoc,
|
||||
|
@ -8504,7 +8504,7 @@ Expr *OpenMPIterationSpaceChecker::buildNumIterations(
|
|||
tryBuildCapture(SemaRef, MinGreaterMaxRes.get(), Captures).get();
|
||||
if (!MinGreaterMax)
|
||||
return nullptr;
|
||||
if (TestIsLessOp.getValue()) {
|
||||
if (*TestIsLessOp) {
|
||||
// UB(MinVal) > UB(MaxVal) ? UB(MinVal) : UB(MaxVal) - max(UB(MinVal),
|
||||
// UB(MaxVal))
|
||||
ExprResult MaxUB = SemaRef.ActOnConditionalOp(
|
||||
|
@ -8599,7 +8599,7 @@ std::pair<Expr *, Expr *> OpenMPIterationSpaceChecker::buildMinMaxValues(
|
|||
if (!Upper || !Lower)
|
||||
return std::make_pair(nullptr, nullptr);
|
||||
|
||||
if (TestIsLessOp.getValue())
|
||||
if (*TestIsLessOp)
|
||||
MinExpr = Lower;
|
||||
else
|
||||
MaxExpr = Upper;
|
||||
|
@ -8643,7 +8643,7 @@ std::pair<Expr *, Expr *> OpenMPIterationSpaceChecker::buildMinMaxValues(
|
|||
if (!Diff.isUsable())
|
||||
return std::make_pair(nullptr, nullptr);
|
||||
|
||||
if (TestIsLessOp.getValue()) {
|
||||
if (*TestIsLessOp) {
|
||||
// MinExpr = Lower;
|
||||
// MaxExpr = Lower + (((Upper - Lower [- 1]) / Step) * Step)
|
||||
Diff = SemaRef.BuildBinOp(
|
||||
|
@ -8676,7 +8676,7 @@ std::pair<Expr *, Expr *> OpenMPIterationSpaceChecker::buildMinMaxValues(
|
|||
if (!Diff.isUsable())
|
||||
return std::make_pair(nullptr, nullptr);
|
||||
|
||||
if (TestIsLessOp.getValue())
|
||||
if (*TestIsLessOp)
|
||||
MaxExpr = Diff.get();
|
||||
else
|
||||
MinExpr = Diff.get();
|
||||
|
@ -14463,8 +14463,7 @@ StmtResult Sema::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
|
|||
uint64_t Factor;
|
||||
SourceLocation FactorLoc;
|
||||
if (Expr *FactorVal = PartialClause->getFactor()) {
|
||||
Factor =
|
||||
FactorVal->getIntegerConstantExpr(Context).getValue().getZExtValue();
|
||||
Factor = FactorVal->getIntegerConstantExpr(Context)->getZExtValue();
|
||||
FactorLoc = FactorVal->getExprLoc();
|
||||
} else {
|
||||
// TODO: Use a better profitability model.
|
||||
|
|
|
@ -13196,7 +13196,7 @@ static QualType chooseRecoveryType(OverloadCandidateSet &CS,
|
|||
|
||||
if (!Result)
|
||||
return QualType();
|
||||
auto Value = Result.getValue();
|
||||
auto Value = *Result;
|
||||
if (Value.isNull() || Value->isUndeducedType())
|
||||
return QualType();
|
||||
return Value;
|
||||
|
|
|
@ -867,7 +867,7 @@ bool Sema::DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
|
|||
}
|
||||
}
|
||||
if (Note) // Diagnostics were emitted.
|
||||
Diag(Pattern->getLocation(), Note.getValue());
|
||||
Diag(Pattern->getLocation(), *Note);
|
||||
|
||||
// In general, Instantiation isn't marked invalid to get more than one
|
||||
// error for multiple undefined instantiations. But the code that does
|
||||
|
|
|
@ -286,7 +286,7 @@ void ObjCDeallocChecker::checkBeginFunction(
|
|||
if (!LValLoc)
|
||||
continue;
|
||||
|
||||
SVal InitialVal = State->getSVal(LValLoc.getValue());
|
||||
SVal InitialVal = State->getSVal(*LValLoc);
|
||||
SymbolRef Symbol = InitialVal.getAsSymbol();
|
||||
if (!Symbol || !isa<SymbolRegionValue>(Symbol))
|
||||
continue;
|
||||
|
@ -957,7 +957,7 @@ ObjCDeallocChecker::getValueReleasedByNillingOut(const ObjCMethodCall &M,
|
|||
if (!LValLoc)
|
||||
return nullptr;
|
||||
|
||||
SVal CurrentValInIvar = State->getSVal(LValLoc.getValue());
|
||||
SVal CurrentValInIvar = State->getSVal(*LValLoc);
|
||||
return CurrentValInIvar.getAsSymbol();
|
||||
}
|
||||
|
||||
|
|
|
@ -732,7 +732,7 @@ void GenericTaintChecker::initTaintRules(CheckerContext &C) const {
|
|||
}
|
||||
|
||||
GenericTaintRuleParser::RulesContTy Rules{
|
||||
ConfigParser.parseConfiguration(Option, std::move(Config.getValue()))};
|
||||
ConfigParser.parseConfiguration(Option, std::move(*Config))};
|
||||
|
||||
DynamicTaintRules.emplace(std::make_move_iterator(Rules.begin()),
|
||||
std::make_move_iterator(Rules.end()));
|
||||
|
|
|
@ -2355,7 +2355,7 @@ public:
|
|||
// well. Try to use the correct type when looking up the value.
|
||||
SVal RVal;
|
||||
if (ExplodedGraph::isInterestingLValueExpr(Inner))
|
||||
RVal = LVState->getRawSVal(L.getValue(), Inner->getType());
|
||||
RVal = LVState->getRawSVal(*L, Inner->getType());
|
||||
else if (CanDereference)
|
||||
RVal = LVState->getSVal(L->getRegion());
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ bool ento::CallDescription::matchesImpl(const FunctionDecl *Callee,
|
|||
const NamedDecl *ND) -> bool {
|
||||
DeclarationName Name = ND->getDeclName();
|
||||
if (const auto *II = Name.getAsIdentifierInfo())
|
||||
return II == CD.II.getValue(); // Fast case.
|
||||
return II == *CD.II; // Fast case.
|
||||
|
||||
// Fallback to the slow stringification and comparison for:
|
||||
// C++ overloaded operators, constructors, destructors, etc.
|
||||
|
|
|
@ -1201,7 +1201,7 @@ lookupRuntimeDefinition(const ObjCInterfaceDecl *Interface,
|
|||
}
|
||||
}
|
||||
|
||||
return Val.getValue();
|
||||
return *Val;
|
||||
}
|
||||
|
||||
RuntimeDefinition ObjCMethodCall::getRuntimeDefinition() const {
|
||||
|
|
|
@ -118,7 +118,7 @@ SVal Environment::getSVal(const EnvironmentEntry &Entry,
|
|||
case Stmt::SizeOfPackExprClass:
|
||||
case Stmt::PredefinedExprClass:
|
||||
// Known constants; defer to SValBuilder.
|
||||
return svalBuilder.getConstantVal(cast<Expr>(S)).getValue();
|
||||
return *svalBuilder.getConstantVal(cast<Expr>(S));
|
||||
|
||||
case Stmt::ReturnStmtClass: {
|
||||
const auto *RS = cast<ReturnStmt>(S);
|
||||
|
|
|
@ -1998,7 +1998,7 @@ RegionStoreManager::getBindingForDerivedDefaultValue(RegionBindingsConstRef B,
|
|||
QualType Ty) {
|
||||
|
||||
if (const Optional<SVal> &D = B.getDefaultBinding(superR)) {
|
||||
const SVal &val = D.getValue();
|
||||
const SVal &val = *D;
|
||||
if (SymbolRef parentSym = val.getAsSymbol())
|
||||
return svalBuilder.getDerivedRegionValueSymbolVal(parentSym, R);
|
||||
|
||||
|
@ -2213,7 +2213,7 @@ SVal RegionStoreManager::getBindingForVar(RegionBindingsConstRef B,
|
|||
|
||||
if (Optional<SVal> V = getBindingForDerivedDefaultValue(B, MS, R, T)) {
|
||||
assert(!V->getAs<nonloc::LazyCompoundVal>());
|
||||
return V.getValue();
|
||||
return *V;
|
||||
}
|
||||
|
||||
return svalBuilder.getRegionValueSymbolVal(R);
|
||||
|
|
|
@ -213,7 +213,7 @@ void RVVType::initBuiltinStr() {
|
|||
BuiltinStr += "*";
|
||||
return;
|
||||
}
|
||||
BuiltinStr = "q" + utostr(Scale.getValue()) + BuiltinStr;
|
||||
BuiltinStr = "q" + utostr(*Scale) + BuiltinStr;
|
||||
// Pointer to vector types. Defined for segment load intrinsics.
|
||||
// segment load intrinsics have pointer type arguments to store the loaded
|
||||
// vector values.
|
||||
|
@ -228,7 +228,7 @@ void RVVType::initClangBuiltinStr() {
|
|||
ClangBuiltinStr = "__rvv_";
|
||||
switch (ScalarType) {
|
||||
case ScalarTypeKind::Boolean:
|
||||
ClangBuiltinStr += "bool" + utostr(64 / Scale.getValue()) + "_t";
|
||||
ClangBuiltinStr += "bool" + utostr(64 / *Scale) + "_t";
|
||||
return;
|
||||
case ScalarTypeKind::Float:
|
||||
ClangBuiltinStr += "float";
|
||||
|
@ -282,7 +282,7 @@ void RVVType::initTypeStr() {
|
|||
else
|
||||
// Vector bool is special case, the formulate is
|
||||
// `vbool<N>_t = MVT::nxv<64/N>i1` ex. vbool16_t = MVT::4i1
|
||||
Str += "vbool" + utostr(64 / Scale.getValue()) + "_t";
|
||||
Str += "vbool" + utostr(64 / *Scale) + "_t";
|
||||
break;
|
||||
case ScalarTypeKind::Float:
|
||||
if (isScalar()) {
|
||||
|
@ -314,7 +314,7 @@ void RVVType::initShortStr() {
|
|||
switch (ScalarType) {
|
||||
case ScalarTypeKind::Boolean:
|
||||
assert(isVector());
|
||||
ShortStr = "b" + utostr(64 / Scale.getValue());
|
||||
ShortStr = "b" + utostr(64 / *Scale);
|
||||
return;
|
||||
case ScalarTypeKind::Float:
|
||||
ShortStr = "f" + utostr(ElementBitwidth);
|
||||
|
@ -926,7 +926,7 @@ std::string RVVIntrinsic::getSuffixStr(
|
|||
SmallVector<std::string> SuffixStrs;
|
||||
for (auto PD : PrototypeDescriptors) {
|
||||
auto T = RVVType::computeType(Type, Log2LMUL, PD);
|
||||
SuffixStrs.push_back(T.getValue()->getShortStr());
|
||||
SuffixStrs.push_back((*T)->getShortStr());
|
||||
}
|
||||
return join(SuffixStrs, "_");
|
||||
}
|
||||
|
|
|
@ -1155,7 +1155,7 @@ int clang_Type_getNumTemplateArguments(CXType CT) {
|
|||
if (!TA)
|
||||
return -1;
|
||||
|
||||
return GetTemplateArgumentArraySize(TA.getValue());
|
||||
return GetTemplateArgumentArraySize(*TA);
|
||||
}
|
||||
|
||||
CXType clang_Type_getTemplateArgumentAsType(CXType CT, unsigned index) {
|
||||
|
@ -1167,7 +1167,7 @@ CXType clang_Type_getTemplateArgumentAsType(CXType CT, unsigned index) {
|
|||
if (!TA)
|
||||
return MakeCXType(QualType(), GetTU(CT));
|
||||
|
||||
Optional<QualType> QT = FindTemplateArgumentTypeAt(TA.getValue(), index);
|
||||
Optional<QualType> QT = FindTemplateArgumentTypeAt(*TA, index);
|
||||
return MakeCXType(QT.value_or(QualType()), GetTU(CT));
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ bool InferPedantic::groupInPedantic(const Record *Group, bool increment) {
|
|||
// Consider a group in -Wpendatic IFF if has at least one diagnostic
|
||||
// or subgroup AND all of those diagnostics and subgroups are covered
|
||||
// by -Wpedantic via our computation.
|
||||
return V.first != 0 && V.first == V.second.getValue();
|
||||
return V.first != 0 && V.first == *V.second;
|
||||
}
|
||||
|
||||
void InferPedantic::markGroup(const Record *Group) {
|
||||
|
|
|
@ -478,8 +478,7 @@ void RVVEmitter::createRVVIntrinsics(
|
|||
Name, SuffixStr, OverloadedName, OverloadedSuffixStr, IRName,
|
||||
/*IsMasked=*/false, /*HasMaskedOffOperand=*/false, HasVL,
|
||||
UnMaskedPolicy, HasUnMaskedOverloaded, HasBuiltinAlias,
|
||||
ManualCodegen, Types.getValue(), IntrinsicTypes, RequiredFeatures,
|
||||
NF));
|
||||
ManualCodegen, *Types, IntrinsicTypes, RequiredFeatures, NF));
|
||||
if (HasMasked) {
|
||||
// Create a masked intrinsic
|
||||
Optional<RVVTypes> MaskTypes =
|
||||
|
@ -489,7 +488,7 @@ void RVVEmitter::createRVVIntrinsics(
|
|||
MaskedIRName,
|
||||
/*IsMasked=*/true, HasMaskedOffOperand, HasVL, MaskedPolicy,
|
||||
HasUnMaskedOverloaded, HasBuiltinAlias, MaskedManualCodegen,
|
||||
MaskTypes.getValue(), IntrinsicTypes, RequiredFeatures, NF));
|
||||
*MaskTypes, IntrinsicTypes, RequiredFeatures, NF));
|
||||
}
|
||||
} // end for Log2LMULList
|
||||
} // end for TypeRange
|
||||
|
|
Loading…
Reference in New Issue