[PATCH] D146342: [WIP][-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 16:33:31 PDT 2023


ziqingluo-90 added a comment.

>> Current tests are mostly fine except that some notes with message "in instantiation of ... " are missing. Although these notes are not emitted by our analysis, we better understand why things change.
>
> This sounds familiar, I think @usama54321 ran into a similar problem from inside clang-tidy: https://discourse.llvm.org/t/clang-tidy-diagnostics-for-template-code/62909

Thank you for the reference.  I checked out the code printing instantiation stacks:

  void PrintContextStack() {
    if (!CodeSynthesisContexts.empty() &&
        CodeSynthesisContexts.size() != LastEmittedCodeSynthesisContextDepth) {
      PrintInstantiationStack();
      LastEmittedCodeSynthesisContextDepth = CodeSynthesisContexts.size();
    }
  ...

The `CodeSynthesisContexts` keeps track of instantiation stack during parsing.  It's not a surprise that `CodeSynthesisContexts` is empty by the end of parsing.  That's why no such note gets printed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146342



More information about the cfe-commits mailing list