[cfe-commits] r162768 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/Stmt.cpp
Chad Rosier
mcrosier at apple.com
Tue Aug 28 11:05:31 PDT 2012
On Aug 28, 2012, at 10:48 AM, Dmitri Gribenko wrote:
> 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.
I based these changes off of John's work in r125183. I don't claim to be an expert on the use of casts, but I'm guessing John used the static_cast to elide the run-time checks. John, please correct me if I'm wrong…
Chad
> 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