================
@@ -548,7 +548,15 @@ TranslationUnitDecl *Decl::getTranslationUnitDecl() {
 }
 
 ASTContext &Decl::getASTContext() const {
-  return getTranslationUnitDecl()->getASTContext();
+  if (const auto *TUD = dyn_cast<TranslationUnitDecl>(this))
+    return TUD->getASTContext();
----------------
zmodem wrote:

Could you move the cache check first, and skip this type check on the fast path?

https://github.com/llvm/llvm-project/pull/226612
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to