@@ -40,6 +40,7 @@ const char *const KindTemplateAlias = "TemplateAlias";
4040const char *const KindTemplatePack = " TemplatePack" ;
4141const char *const KindUndefined = " Undefined" ;
4242const char *const KindUnion = " Union" ;
43+ const char *const KindModule = " Module" ;
4344} // end anonymous namespace
4445
4546// ===----------------------------------------------------------------------===//
@@ -50,6 +51,8 @@ const char *LVScope::kind() const {
5051 const char *Kind = KindUndefined;
5152 if (getIsArray ())
5253 Kind = KindArray;
54+ else if (getIsModule ())
55+ Kind = KindModule;
5356 else if (getIsBlock ())
5457 Kind = KindBlock;
5558 else if (getIsCallSite ())
@@ -101,7 +104,8 @@ LVScopeDispatch LVScope::Dispatch = {
101104 {LVScopeKind::IsTemplateAlias, &LVScope::getIsTemplateAlias},
102105 {LVScopeKind::IsTemplatePack, &LVScope::getIsTemplatePack},
103106 {LVScopeKind::IsTryBlock, &LVScope::getIsTryBlock},
104- {LVScopeKind::IsUnion, &LVScope::getIsUnion}};
107+ {LVScopeKind::IsUnion, &LVScope::getIsUnion},
108+ {LVScopeKind::IsModule, &LVScope::getIsModule}};
105109
106110void LVScope::addToChildren (LVElement *Element) {
107111 if (!Children)
@@ -2116,3 +2120,15 @@ bool LVScopeTemplatePack::equals(const LVScope *Scope) const {
21162120void LVScopeTemplatePack::printExtra (raw_ostream &OS, bool Full) const {
21172121 OS << formattedKind (kind ()) << " " << formattedName (getName ()) << " \n " ;
21182122}
2123+
2124+ // ===----------------------------------------------------------------------===//
2125+ // DWARF module (DW_TAG_module).
2126+ // ===----------------------------------------------------------------------===//
2127+ bool LVScopeModule::equals (const LVScope *Scope) const {
2128+ // For lexical blocks, LVScope::equals() compares the parent scope.
2129+ return LVScope::equals (Scope) && (Scope->getName () == getName ());
2130+ }
2131+
2132+ void LVScopeModule::printExtra (raw_ostream &OS, bool Full) const {
2133+ OS << formattedKind (kind ()) << " " << formattedName (getName ()) << " \n " ;
2134+ }
0 commit comments