sammccall created this revision. sammccall added a reviewer: kadircet. Herald added a subscriber: usaxena95. Herald added a project: All. sammccall requested review of this revision. Herald added subscribers: cfe-commits, ilya-biryukov. Herald added a project: clang.
This speeds up clangd's buildAST() (i.e. parsing with a preamble) by 5% on clangd/AST.cpp, by avoiding filling up the diagnostic state map with entries for all the files where templates are being instantiated from. (I would assume it has a similar effect on PCH and modules compiles). This approach is obviously pretty fragile, and we should find ways to make isIgnored() cheaper instead. But these changes in particular don't seem to make the code worse in any case. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D129683 Files: clang/lib/Sema/Sema.cpp Index: clang/lib/Sema/Sema.cpp =================================================================== --- clang/lib/Sema/Sema.cpp +++ clang/lib/Sema/Sema.cpp @@ -582,9 +582,6 @@ } void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr* E) { - if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant, - E->getBeginLoc())) - return; // nullptr only exists from C++11 on, so don't warn on its absence earlier. if (!getLangOpts().CPlusPlus11) return; @@ -594,6 +591,10 @@ if (E->IgnoreParenImpCasts()->getType()->isNullPtrType()) return; + if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant, + E->getBeginLoc())) + return; + // Don't diagnose the conversion from a 0 literal to a null pointer argument // in a synthesized call to operator<=>. if (!CodeSynthesisContexts.empty() &&
Index: clang/lib/Sema/Sema.cpp =================================================================== --- clang/lib/Sema/Sema.cpp +++ clang/lib/Sema/Sema.cpp @@ -582,9 +582,6 @@ } void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr* E) { - if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant, - E->getBeginLoc())) - return; // nullptr only exists from C++11 on, so don't warn on its absence earlier. if (!getLangOpts().CPlusPlus11) return; @@ -594,6 +591,10 @@ if (E->IgnoreParenImpCasts()->getType()->isNullPtrType()) return; + if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant, + E->getBeginLoc())) + return; + // Don't diagnose the conversion from a 0 literal to a null pointer argument // in a synthesized call to operator<=>. if (!CodeSynthesisContexts.empty() &&
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits