[PATCH] Add an AdjustedType sugar node for adjusting calling conventions

Richard Smith richard at metafoo.co.uk
Wed Dec 4 16:42:14 PST 2013


  LGTM


================
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();
 
----------------
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;


http://llvm-reviews.chandlerc.com/D2332

BRANCH
  fix-memptr-cc

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list