[PATCH] Add an AdjustedType sugar node for adjusting calling conventions
Reid Kleckner
rnk at google.com
Wed Dec 4 17:19:25 PST 2013
================
Comment at: lib/AST/Decl.cpp:2512-2514
@@ -2511,5 +2511,5 @@
const FunctionType *FT = getType()->castAs<FunctionType>();
- if (isa<FunctionNoProtoType>(FT))
+ if (FT->getAs<FunctionNoProtoType>())
return 0;
- return cast<FunctionProtoType>(FT)->getNumArgs();
+ return FT->castAs<FunctionProtoType>()->getNumArgs();
----------------
Richard Smith wrote:
> The pre-existing `isa<...>` check here looks correct to me; what's this change for?
>
> If anything, we should rewrite this as
>
> const FunctionProtoType *FPT = getType()->getAs<FunctionProtoType>();
> return FPT ? FPT->getNumArgs() : 0;
Yeah, this wasn't necessary. I was debugging crashes here and I forgot to revert this because putting back the isa<> and cast<> seemed suspicious. I'll commit your suggested rewrite.
http://llvm-reviews.chandlerc.com/D2332
BRANCH
fix-memptr-cc
ARCANIST PROJECT
clang
More information about the cfe-commits
mailing list