[cfe-commits] r162768 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/Stmt.cpp

Dmitri Gribenko gribozavr at gmail.com
Tue Aug 28 10:48:34 PDT 2012


On Tue, Aug 28, 2012 at 10:43 AM, Chad Rosier <mcrosier at apple.com> wrote:
> +std::string AsmStmt::generateAsmString(ASTContext &C) const {
> +  StmtClass stmtClass = getStmtClass();
> +  if (stmtClass == Stmt::GCCAsmStmtClass)
> +    return static_cast<const GCCAsmStmt*>(this)->generateAsmString(C);
> +  if (stmtClass == Stmt::MSAsmStmtClass)
> +    return static_cast<const MSAsmStmt*>(this)->generateAsmString(C);
> +  llvm_unreachable("unknown asm statement kind!");
> +}

It is conventional to use cast<> in such cases.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list