urnathan added a comment.

Looks like a good cleanup.  Let me know what you think about the idea of 
retaining the switch.



================
Comment at: clang/lib/Serialization/ASTReader.cpp:10176-10184
+            if (auto *TTP = dyn_cast<TemplateTypeParmDecl>(D))
+              return TTP->hasDefaultArgument() &&
+                      !TTP->defaultArgumentWasInherited();
+            if (auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D))
+              return NTTP->hasDefaultArgument() &&
+                      !NTTP->defaultArgumentWasInherited();
+            auto *TTP = cast<TemplateTemplateParmDecl>(D);
----------------
Rather than use dyn_cast, can't you use the switch(getKind()) idiom of the 
original?  That'll reduce the number of virtual calls won't it?  Bonus points 
for passing getKind() into the lambda so the compiler has a chance of noticing 
a loop unswitching possibility?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118437/new/

https://reviews.llvm.org/D118437

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to