|
51 | 51 | #include "llvm/Support/SHA1.h" |
52 | 52 | #include "llvm/Support/SHA256.h" |
53 | 53 | #include "llvm/Support/TimeProfiler.h" |
| 54 | +#include <optional> |
54 | 55 | using namespace clang; |
55 | 56 | using namespace clang::CodeGen; |
56 | 57 |
|
@@ -345,7 +346,7 @@ StringRef CGDebugInfo::getClassName(const RecordDecl *RD) { |
345 | 346 | return StringRef(); |
346 | 347 | } |
347 | 348 |
|
348 | | -Optional<llvm::DIFile::ChecksumKind> |
| 349 | +std::optional<llvm::DIFile::ChecksumKind> |
349 | 350 | CGDebugInfo::computeChecksum(FileID FID, SmallString<64> &Checksum) const { |
350 | 351 | Checksum.clear(); |
351 | 352 |
|
@@ -373,8 +374,8 @@ CGDebugInfo::computeChecksum(FileID FID, SmallString<64> &Checksum) const { |
373 | 374 | llvm_unreachable("Unhandled DebugSrcHashKind enum"); |
374 | 375 | } |
375 | 376 |
|
376 | | -Optional<StringRef> CGDebugInfo::getSource(const SourceManager &SM, |
377 | | - FileID FID) { |
| 377 | +std::optional<StringRef> CGDebugInfo::getSource(const SourceManager &SM, |
| 378 | + FileID FID) { |
378 | 379 | if (!CGM.getCodeGenOpts().EmbedSource) |
379 | 380 | return std::nullopt; |
380 | 381 |
|
@@ -419,17 +420,18 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) { |
419 | 420 |
|
420 | 421 | SmallString<64> Checksum; |
421 | 422 |
|
422 | | - Optional<llvm::DIFile::ChecksumKind> CSKind = computeChecksum(FID, Checksum); |
423 | | - Optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo; |
| 423 | + std::optional<llvm::DIFile::ChecksumKind> CSKind = |
| 424 | + computeChecksum(FID, Checksum); |
| 425 | + std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo; |
424 | 426 | if (CSKind) |
425 | 427 | CSInfo.emplace(*CSKind, Checksum); |
426 | 428 | return createFile(FileName, CSInfo, getSource(SM, SM.getFileID(Loc))); |
427 | 429 | } |
428 | 430 |
|
429 | | -llvm::DIFile * |
430 | | -CGDebugInfo::createFile(StringRef FileName, |
431 | | - Optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo, |
432 | | - Optional<StringRef> Source) { |
| 431 | +llvm::DIFile *CGDebugInfo::createFile( |
| 432 | + StringRef FileName, |
| 433 | + std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo, |
| 434 | + std::optional<StringRef> Source) { |
433 | 435 | StringRef Dir; |
434 | 436 | StringRef File; |
435 | 437 | std::string RemappedFile = remapDIPath(FileName); |
@@ -512,8 +514,8 @@ StringRef CGDebugInfo::getCurrentDirname() { |
512 | 514 |
|
513 | 515 | void CGDebugInfo::CreateCompileUnit() { |
514 | 516 | SmallString<64> Checksum; |
515 | | - Optional<llvm::DIFile::ChecksumKind> CSKind; |
516 | | - Optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo; |
| 517 | + std::optional<llvm::DIFile::ChecksumKind> CSKind; |
| 518 | + std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo; |
517 | 519 |
|
518 | 520 | // Should we be asking the SourceManager for the main file name, instead of |
519 | 521 | // accepting it as an argument? This just causes the main file name to |
@@ -1148,8 +1150,9 @@ llvm::DIType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag, |
1148 | 1150 | // Size is always the size of a pointer. |
1149 | 1151 | uint64_t Size = CGM.getContext().getTypeSize(Ty); |
1150 | 1152 | auto Align = getTypeAlignIfRequired(Ty, CGM.getContext()); |
1151 | | - Optional<unsigned> DWARFAddressSpace = CGM.getTarget().getDWARFAddressSpace( |
1152 | | - CGM.getTypes().getTargetAddressSpace(PointeeTy)); |
| 1153 | + std::optional<unsigned> DWARFAddressSpace = |
| 1154 | + CGM.getTarget().getDWARFAddressSpace( |
| 1155 | + CGM.getTypes().getTargetAddressSpace(PointeeTy)); |
1153 | 1156 |
|
1154 | 1157 | SmallVector<llvm::Metadata *, 4> Annots; |
1155 | 1158 | auto *BTFAttrTy = dyn_cast<BTFTagAttributedType>(PointeeTy); |
@@ -2201,7 +2204,7 @@ llvm::DIType *CGDebugInfo::getOrCreateVTablePtrType(llvm::DIFile *Unit) { |
2201 | 2204 | llvm::DIType *SubTy = DBuilder.createSubroutineType(SElements); |
2202 | 2205 | unsigned Size = Context.getTypeSize(Context.VoidPtrTy); |
2203 | 2206 | unsigned VtblPtrAddressSpace = CGM.getTarget().getVtblPtrAddressSpace(); |
2204 | | - Optional<unsigned> DWARFAddressSpace = |
| 2207 | + std::optional<unsigned> DWARFAddressSpace = |
2205 | 2208 | CGM.getTarget().getDWARFAddressSpace(VtblPtrAddressSpace); |
2206 | 2209 |
|
2207 | 2210 | llvm::DIType *vtbl_ptr_type = DBuilder.createPointerType( |
@@ -2298,7 +2301,7 @@ void CGDebugInfo::CollectVTableInfo(const CXXRecordDecl *RD, llvm::DIFile *Unit, |
2298 | 2301 | VFTLayout.vtable_components().size() - CGM.getLangOpts().RTTIData; |
2299 | 2302 | unsigned VTableWidth = PtrWidth * VSlotCount; |
2300 | 2303 | unsigned VtblPtrAddressSpace = CGM.getTarget().getVtblPtrAddressSpace(); |
2301 | | - Optional<unsigned> DWARFAddressSpace = |
| 2304 | + std::optional<unsigned> DWARFAddressSpace = |
2302 | 2305 | CGM.getTarget().getDWARFAddressSpace(VtblPtrAddressSpace); |
2303 | 2306 |
|
2304 | 2307 | // Create a very wide void* type and insert it directly in the element list. |
@@ -4284,7 +4287,7 @@ void CGDebugInfo::CreateLexicalBlock(SourceLocation Loc) { |
4284 | 4287 |
|
4285 | 4288 | void CGDebugInfo::AppendAddressSpaceXDeref( |
4286 | 4289 | unsigned AddressSpace, SmallVectorImpl<uint64_t> &Expr) const { |
4287 | | - Optional<unsigned> DWARFAddressSpace = |
| 4290 | + std::optional<unsigned> DWARFAddressSpace = |
4288 | 4291 | CGM.getTarget().getDWARFAddressSpace(AddressSpace); |
4289 | 4292 | if (!DWARFAddressSpace) |
4290 | 4293 | return; |
|
0 commit comments