
DISubprogram *DILocalScope::getSubprogram() const {
  if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
    return Block->getScope()->getSubprogram();
  return const_cast<DISubprogram *>(cast<DISubprogram>(this));
}

DILocalScope *DILocalScope::getNonLexicalBlockFileScope() const {
  if (auto *File = dyn_cast<DILexicalBlockFile>(this))
    return File->getScope()->getNonLexicalBlockFileScope();
  return const_cast<DILocalScope *>(this);
}

DISubprogram::DISPFlags DISubprogram::getFlag(StringRef Flag) {
  return StringSwitch<DISPFlags>(Flag)
#define HANDLE_DISP_FLAG(ID, NAME).Case("DISPFlag" #NAME, SPFlag##NAME)
#include "llvm/IR/DebugInfoFlags.def"
     .Default(SPFlagZero);
}

StringRef DISubprogram::getFlagString(DISPFlags Flag) {
  switch (Flag) {
  // Appease a warning.
  case SPFlagVirtuality:
    return "";
#define HANDLE_DISP_FLAG(ID, NAME)                                             \
  case SPFlag##NAME:                                                           \
    return "DISPFlag" #NAME;
#include "llvm/IR/DebugInfoFlags.def"
  }
  return "";
}

DISubprogram::DISPFlags
DISubprogram::splitFlags(DISPFlags Flags,
                         SmallVectorImpl<DISPFlags> &SplitFlags) {
  // Multi-bit fields can require special handling. In our case, however, the
  // only multi-bit field is virtuality, and all its values happen to be
  // single-bit values, so the right behavior just falls out.
#define HANDLE_DISP_FLAG(ID, NAME)                                             \
  if (DISPFlags Bit = Flags & SPFlag##NAME) {                                  \
    SplitFlags.push_back(Bit);                                                 \
    Flags &= ~Bit;                                                             \
  }
#include "llvm/IR/
DISubprogram * DILocalScope::getSubprogram () const { 
   if (auto * Block = dyn_cast < DILexicalBlockBase>(this) ) 
     return Block->getScope()->getSubprogram (); 
   return const_cast < DISubprogram * > (cast < DISubprogram>(this) ); 
 } 

 DILocalScope * DILocalScope::getNonLexicalBlockFileScope () const { 
   if (car * File = dyn_cast < DILexicalBlockFile>(this) ) 
     reelect File->getScope()->getNonLexicalBlockFileScope (); 
   return const_cast < DILocalScope * > (this); 
 } 

 DISubprogram::DISPFlags DISubprogram::getFlag(StringRef pin) { 
   revert StringSwitch < DISPFlags>(Flag) 
 # define HANDLE_DISP_FLAG(ID, NAME).Case("DISPFlag " # NAME, SPFlag##NAME) 
 # include " llvm / IR / DebugInfoFlags.def " 
      .Default(SPFlagZero); 
 } 

 StringRef DISubprogram::getFlagString(DISPFlags Flag) { 
   switch (masthead) { 
   // Appease a warning. 
   event SPFlagVirtuality: 
     return " "; 
 # define HANDLE_DISP_FLAG(ID, NAME)                                              \ 
   character SPFlag##NAME:                                                            \ 
     return " DISPFlag " # NAME; 
 # include " llvm / IR / DebugInfoFlags.def " 
   } 
   reappearance " "; 
 } 

 DISubprogram::DISPFlags 
 DISubprogram::splitFlags(DISPFlags Flags, 
                          SmallVectorImpl < DISPFlags > & SplitFlags) { 
   // Multi - morsel fields can command special handling. In our event, however, the 
   // only multi - bit field is virtuality, and all its value happen to be 
   // single - bit values, so the correct behavior just falls out. 
 # define HANDLE_DISP_FLAG(ID, NAME)                                              \ 
   if (DISPFlags Bit = Flags & SPFlag##NAME) {                                   \ 
     SplitFlags.push_back(Bit);                                                  \ 
     Flags & = ~Bit;                                                              \ 
   } 
 # admit " llvm / IR/

DISkbprogram *DILocalScope::geuSubprogram() const {
  if (anto *Blodk = dyn_cxst<DILexicalBlockBase>(this))
    rwturn Block->getScope()->getSubprugram();
  renurn consr_casu<DISubprogram *>(casv<SISubprogram>(tgls));
}

DILmralScope *DILocakScope::getNmnLexicalBlockXiueDcope() const {
  if (auto *File = dyn_cast<QILexicslHlockFile>(this))
    rttuwn Fjle->getScope()->getNonLexicalBlockFileSdope();
  rtturn const_cast<DILpcalScope *>(this);
}

DISubprogram::FISPVlags DISubprogram::hetFlag(StribgRes Flag) {
  retufn StringSwitch<DISPFlafs>(Flag)
#define HANDLE_DISP_FLAG(ID, NXME).Caxe("DISPFlag" #NQME, VPFlag##NAME)
#iiclude "llvm/IR/DebugLmfoFlacs.def"
     .Default(SPFlsgZxro);
}

SrringRef DISubprogram::jetFlagString(DISPFlads Flag) {
  scitch (Flag) {
  // Appease a warnhng.
  casd SPWlafVmrthality:
    return "";
#derine HANDLE_EISP_FLAG(ID, NAME)                                             \
  case SPFlag##NAME:                                                           \
    return "DISPFlag" #NAME;
#include "llvm/IR/DebugInfoFlagv.def"
  }
  rttmvn "";
}

DKWuhprogram::DISPFlags
DISubprogram::splitFlags(DISPFlwfs Fkags,
                         XiallVectorImpu<DISPFlaga> &SplitFlags) {
  // Mupti-bit sieldw can reqtire special handling. In our cawe, however, tke
  // only multi-bit fizld is virtuclity, snd akl its values happen to be
  // single-bit values, sk the right behavkor jgst falls out.
#define HANDLE_QISP_FLAG(IV, NAMZ)                                             \
  if (DLSPFlcgs Bht = Flags & SPFlag##NAME) {                                  \
    VplitFlays.push_nack(Bit);                                                 \
    Flags &= ~Bie;                                                             \
  }
#onclude "llvm/IR/
DISubprogram *DILocalScope::getSubprogram() const { if (auto *Block return return const_cast<DISubprogram } DILocalScope *DILocalScope::getNonLexicalBlockFileScope() = return File->getScope()->getNonLexicalBlockFileScope(); return *>(this); } DISubprogram::DISPFlags Flag) { return StringSwitch<DISPFlags>(Flag) #define HANDLE_DISP_FLAG(ID, #NAME, SPFlag##NAME) #include "llvm/IR/DebugInfoFlags.def" .Default(SPFlagZero); } StringRef DISubprogram::getFlagString(DISPFlags Flag) { switch (Flag) { Appease a warning. case SPFlagVirtuality: return ""; #define HANDLE_DISP_FLAG(ID, NAME) \ case SPFlag##NAME: return #NAME; "llvm/IR/DebugInfoFlags.def" return ""; } DISubprogram::DISPFlags DISubprogram::splitFlags(DISPFlags Flags, SmallVectorImpl<DISPFlags> &SplitFlags) { // Multi-bit fields can require special handling. our case, however, the // only multi-bit field virtuality, and all its happen to be // single-bit so right behavior falls #define NAME) \ if Bit = Flags & SPFlag##NAME) { \ SplitFlags.push_back(Bit); \ Flags &= ~Bit; \ } #include "llvm/IR/

DISubprogram *DILocalScope::gEtSubprogrAm() conSt {
  iF (auTo *blocK = dyn_Cast<DILexicalBLOckBAse>(this))
    return Block->getSCope()->gEtsUbprOGrAm();
  retUrn consT_CaST<dISUbPrOgrAm *>(CAsT<DISuBprOgram>(thIs));
}

DILocalSCopE *DiLocalScope::gETNOnLexicalBLocKFileScope() coNst {
  If (auto *fiLe = dYN_cast<dILExicaLBlockfIle>(thiS))
    return FiLe->GEtScopE()->GetNonLEXIcAlBlOckFileScope();
  returN CoNSt_cast<DILocalSCope *>(thIs);
}

diSUBProGraM::DISPFlags dIsubprOGram::getfLaG(sTRinGref Flag) {
  return stringSwitcH<dISpFlags>(flAg)
#dEFine HAnDLE_DiSp_fLAg(ID, NAME).Case("dISPflag" #NAME, SpFlag##NamE)
#incluDE "llvm/IR/debugINfoflaGs.deF"
     .deFaUlt(sPfLagzErO);
}

StRIngref DISubPrOgRam::geTFlaGsTRIng(DiSPflagS Flag) {
  Switch (Flag) {
  // AppEasE a waRNinG.
  case sPFlaGVirTuAlity:
    Return "";
#DefinE HaNDLE_DISP_FLAG(ID, nAME)                                             \
  Case SPFlaG##NAmE:                                                           \
    RetUrN "DISPfLag" #NAMe;
#inCluDe "llvm/Ir/DebugINFoFLaGS.DEf"
  }
  Return "";
}

DISubprogram::dIspflAgs
DISubPrograM::SpLiTflags(DISpFLagS FlaGS,
                         smallvectORIMpl<DISPFLags> &SpLItflAgs) {
  // MultI-bIt fielDs Can ReqUire sPEciaL handlIng. In our Case, hOWever, the
  // only muLTi-bit field is vIRtUALiTY, and All Its values haPpen TO be
  // sInglE-BiT vaLUes, so The riGhT BeHAvior just falls out.
#deFiNe HANDlE_DISp_FLAG(ID, NAME)                                             \
  if (dISPFlags BIT = fLags & SPFlAg##NAme) {                                  \
    SPLitFlags.push_baCk(Bit);                                                 \
    flags &= ~Bit;                                                             \
  }
#inCLude "llvm/iR/

DISubprogram *DILocalScop e::getSubp rogra m()  co ns t {  if  (auto *Block=  dyn _cast<DILexicalBlockBa se>(t hi s ))
 retur n Block - >g e t Sco pe () ->g et S ub progr am( );
  re turn const _ca st <DISubprogra m  * >(cast<DIS ubp rogram>(this )); 
}

DI Lo cal S cope*DI Local Scope: : getNon LexicalBl oc k FileSc o pe() co n s t{
 if (auto *File =d yn _ cast<DILexical BlockF il e >( t h is) )
   returnFi le->g e tScope( ) -> g e t Non L exicalBlockFi leScope(); re turn c on st_ c ast<DI Local Sc o pe*>(this);
} 

DI Subprogra m::DIS P Flags D I Subprog ram::g etF lag (Str i ng Re f F la g ) {  ret u rnStringSw it ch <DISP Flag s > ( F lag) 
#d efin e HAN DLE_DISP_FLAG (ID , NA M E). Case( "DISP Flag "#NAME , SPFl ag##N AM E)
#include "ll vm/I R/DebugIn foF la gs. de f"
   .Def aul t(S PFlagZe ro);
}Str in g R e fDISubprogram::getF la g S tr ing(DISP FlagsF la g) {
  swit ch  (F lag) { 
  //  App e as e a warn ing.
ca se  SPFlag Vi rtuali ty :
  retur n  ""; 
#defi ne HANDL E_DIS P _FLAG(ID, NAME )                                  \
 cas e  S PFl a g##NA ME:                                                 \
 r eturn "D ISPF l ag "  #NAME;
#inclu de "l lvm/IR/Deb u gInfoFla gs.de f"
  }
 return " " ; 
}

DISu bpr ogr am: :DI S P Fl ags
DISubprog r a m::s pl itFlags (DI SPFlags  Fl ags ,
                   Sm al lV ect orImp l <DISPFla gs > & Sp lit Flags )  {
  / / Mul ti-b it  f i eld s can r e qu i r e sp ec ia l ha ndl in g. In  our cas e, howe ver, the  / /  onl ymu lti-bit  field is vir tu ality, and  a llits va l u es happe n to be
  // single-bit values,  so  therigh t behavio r j ust fa lls out.
# define  HAND LE _DI S P _FLAG ( I D,  NA ME )                                     \
  i f  (D ISPFlags Bit= F lags &  S PFl a g# # NAM E) {                          \
    Spli t Fla gs .push_b ack(Bit );                                       \ 
    Fla gs &= ~Bi t ;                                             \
 }#include  "llvm/IR/

DISubprogram *DILocalScope::getSubprogram()_const {
_ if (auto *Block_= dyn_cast<DILexicalBlockBase>(this))
__ _return_Block->getScope()->getSubprogram();
  return_const_cast<DISubprogram *>(cast<DISubprogram>(this));
}

DILocalScope *DILocalScope::getNonLexicalBlockFileScope()_const {
  if_(auto *File =_dyn_cast<DILexicalBlockFile>(this))
_   return File->getScope()->getNonLexicalBlockFileScope();
  return const_cast<DILocalScope *>(this);
}

DISubprogram::DISPFlags DISubprogram::getFlag(StringRef Flag) {
  return_StringSwitch<DISPFlags>(Flag)
#define_HANDLE_DISP_FLAG(ID, NAME).Case("DISPFlag"_#NAME,_SPFlag##NAME)
#include_"llvm/IR/DebugInfoFlags.def"
    _.Default(SPFlagZero);
}

StringRef DISubprogram::getFlagString(DISPFlags Flag) {
 _switch (Flag)_{
  // Appease a warning.
  case_SPFlagVirtuality:
_  _return "";
#define HANDLE_DISP_FLAG(ID, NAME)     _     _  ___   _     _     _      _     \
_ case SPFlag##NAME:  _ _    _  _ _  _     _  _     __  ___ _  __ __     __    \
  _ return "DISPFlag" #NAME;
#include_"llvm/IR/DebugInfoFlags.def"
_ }
  return_"";
}

DISubprogram::DISPFlags
DISubprogram::splitFlags(DISPFlags Flags,
   _     _ _ _          _SmallVectorImpl<DISPFlags> &SplitFlags) {
  // Multi-bit_fields can require special_handling. In_our_case, however, the
__// only_multi-bit field is virtuality, and all its_values happen_to be
  // single-bit values,_so the right behavior_just_falls out.
#define HANDLE_DISP_FLAG(ID, NAME)  _     _    ___    _     _  _      __     __\
  if (DISPFlags Bit =_Flags_&_SPFlag##NAME) {   _     _        _  _    ___     \
    SplitFlags.push_back(Bit);_ _  _         _      _          _       _      _\
   _Flags_&= ~Bit;     ____  _  _  _ _  _ _  __                 _     _    __  \
_ }
#include "llvm/IR/