aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorShraiysh Vaishay <shraiysh@gmail.com>2023-04-15 21:16:16 -0500
committerShraiysh Vaishay <shraiysh@gmail.com>2023-04-17 13:40:51 -0500
commit7021182d6b43de9488ab70de626192ce70b3a4a6 (patch)
tree193d14c63ce01bf680f9919b5cbb4b11a944de8b /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent63395cb0b69dee69ec5d5d0d552482c607861178 (diff)
downloadllvm-7021182d6b43de9488ab70de626192ce70b3a4a6.zip
llvm-7021182d6b43de9488ab70de626192ce70b3a4a6.tar.gz
llvm-7021182d6b43de9488ab70de626192ce70b3a4a6.tar.bz2
[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.
This patch replaces the uses of PointerUnion.is function by llvm::isa, PointerUnion.get function by llvm::cast, and PointerUnion.dyn_cast by llvm::dyn_cast_if_present. This is according to the FIXME in the definition of the class PointerUnion. This patch does not remove them as they are being used in other subprojects. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D148449
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 5aceb33..3494ae0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -1719,12 +1719,13 @@ TypeIndex CodeViewDebug::lowerTypeArray(const DICompositeType *Ty) {
// Otherwise, if it has an upperboud, use (upperbound - lowerbound + 1),
// where lowerbound is from the LowerBound field of the Subrange,
// or the language default lowerbound if that field is unspecified.
- if (auto *CI = Subrange->getCount().dyn_cast<ConstantInt *>())
+ if (auto *CI = dyn_cast_if_present<ConstantInt *>(Subrange->getCount()))
Count = CI->getSExtValue();
- else if (auto *UI = Subrange->getUpperBound().dyn_cast<ConstantInt *>()) {
+ else if (auto *UI = dyn_cast_if_present<ConstantInt *>(
+ Subrange->getUpperBound())) {
// Fortran uses 1 as the default lowerbound; other languages use 0.
int64_t Lowerbound = (moduleIsInFortran()) ? 1 : 0;
- auto *LI = Subrange->getLowerBound().dyn_cast<ConstantInt *>();
+ auto *LI = dyn_cast_if_present<ConstantInt *>(Subrange->getLowerBound());
Lowerbound = (LI) ? LI->getSExtValue() : Lowerbound;
Count = UI->getSExtValue() - Lowerbound + 1;
}
@@ -3283,7 +3284,7 @@ void CodeViewDebug::emitDebugInfoForGlobals() {
// Second, emit each global that is in a comdat into its own .debug$S
// section along with its own symbol substream.
for (const CVGlobalVariable &CVGV : ComdatVariables) {
- const GlobalVariable *GV = CVGV.GVInfo.get<const GlobalVariable *>();
+ const GlobalVariable *GV = cast<const GlobalVariable *>(CVGV.GVInfo);
MCSymbol *GVSym = Asm->getSymbol(GV);
OS.AddComment("Symbol subsection for " +
Twine(GlobalValue::dropLLVMManglingEscape(GV->getName())));
@@ -3392,7 +3393,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
: getFullyQualifiedName(Scope, DIGV->getName());
if (const GlobalVariable *GV =
- CVGV.GVInfo.dyn_cast<const GlobalVariable *>()) {
+ dyn_cast_if_present<const GlobalVariable *>(CVGV.GVInfo)) {
// DataSym record, see SymbolRecord.h for more info. Thread local data
// happens to have the same format as global data.
MCSymbol *GVSym = Asm->getSymbol(GV);
@@ -3419,7 +3420,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
emitNullTerminatedSymbolName(OS, QualifiedName, LengthOfDataRecord);
endSymbolRecord(DataEnd);
} else {
- const DIExpression *DIE = CVGV.GVInfo.get<const DIExpression *>();
+ const DIExpression *DIE = cast<const DIExpression *>(CVGV.GVInfo);
assert(DIE->isConstant() &&
"Global constant variables must contain a constant expression.");