r195962 - Fixes a possible assert in the custom SubsetSubject logic for the attr emitter.

Aaron Ballman aaron at aaronballman.com
Fri Nov 29 08:12:30 PST 2013


Author: aaronballman
Date: Fri Nov 29 10:12:29 2013
New Revision: 195962

URL: http://llvm.org/viewvc/llvm-project?rev=195962&view=rev
Log:
Fixes a possible assert in the custom SubsetSubject logic for the attr emitter.

Modified:
    cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=195962&r1=195961&r2=195962&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Fri Nov 29 10:12:29 2013
@@ -1827,9 +1827,10 @@ static std::string GenerateCustomApperta
 
   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);





More information about the cfe-commits mailing list