From: Aaron Ballman Date: Fri, 29 Nov 2013 16:12:29 +0000 (+0000) Subject: Fixes a possible assert in the custom SubsetSubject logic for the attr emitter. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c5c075cefb7d96292e0c9665a4aac6b2b3e954a8;p=clang Fixes a possible assert in the custom SubsetSubject logic for the attr emitter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195962 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index ec076e250c..af0693a2ca 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -1827,9 +1827,10 @@ static std::string GenerateCustomAppertainsTo(const Record &Subject, std::string FnName = "is" + Subject.getName(); OS << "static bool " << FnName << "(const Decl *D) {\n"; - OS << " const " << Base->getName() << "Decl *S = cast<" << Base->getName(); + OS << " const " << Base->getName() << "Decl *S = dyn_cast<"; + OS << Base->getName(); OS << "Decl>(D);\n"; - OS << " return " << Subject.getValueAsString("CheckCode") << ";\n"; + OS << " return S && " << Subject.getValueAsString("CheckCode") << ";\n"; OS << "}\n\n"; CustomSubjectSet.insert(FnName);