Index: clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp +++ clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp @@ -30,8 +30,10 @@ // previously. void MultipleInheritanceCheck::addNodeToInterfaceMap(const CXXRecordDecl *Node, bool isInterface) { - StringRef Name = Node->getIdentifier()->getName(); - InterfaceMap.insert(std::make_pair(Name, isInterface)); + if (const auto *Id = Node->getIdentifier()) { + StringRef Name = Id->getName(); + InterfaceMap.insert(std::make_pair(Name, isInterface)); + } } // Returns "true" if the boolean "isInterface" has been set to the @@ -39,12 +41,16 @@ // interface status for the current node is not yet known. bool MultipleInheritanceCheck::getInterfaceStatus(const CXXRecordDecl *Node, bool &isInterface) const { - StringRef Name = Node->getIdentifier()->getName(); - llvm::StringMapConstIterator Pair = InterfaceMap.find(Name); - if (Pair == InterfaceMap.end()) - return false; - isInterface = Pair->second; - return true; + if (!Node) return false; + if (const auto *Id = Node->getIdentifier()) { + StringRef Name = Id->getName(); + llvm::StringMapConstIterator Pair = InterfaceMap.find(Name); + if (Pair == InterfaceMap.end()) + return false; + isInterface = Pair->second; + return true; + } + return false; } bool MultipleInheritanceCheck::isCurrentClassInterface( @@ -104,7 +110,7 @@ const auto *Base = cast(Ty->getDecl()->getDefinition()); if (!isInterface(Base)) NumConcrete++; } - + // Check virtual bases to see if there is more than one concrete // non-virtual base. for (const auto &V : D->vbases()) {