================ @@ -451,6 +462,10 @@ class StreamChecker : public Checker<check::PreCall, eval::Call, /// The built-in va_list type is platform-specific mutable QualType VaListType; + mutable const VarDecl *StdinDecl = nullptr; + mutable const VarDecl *StdoutDecl = nullptr; + mutable const VarDecl *StderrDecl = nullptr; ---------------- NagyDonat wrote:
`<bikeshedding>` In your code the three standard streams have exactly identical roles (as far as I see), and I think it would be good to emphasize this by storing them in a three-element array instead of three separate independently named variables. For example, I could imagine a solution like ```c++ const char *StdStreamNames[3] = {"stdin", "stdout", "stderr"}; mutable const VarDecl *StdStreamDecls[3] = {}; // ... in checkASTDecl() for (int i = 0; i < 3; i++) { // inline getGlobalStreamPointerByName here to initialize // StdStreamDecls[i] via StdStreamNames[i] } // ... in assumeNoAliasingWithStdStreams() for (const VarDecl *Var : StdStreamDecls) { // put the definition of the lambda `assumeRetNE` here } ``` (This is just a rough draft, there might be more idiomatic/elegant solutions for some parts.) `</bikeshedding>` https://github.com/llvm/llvm-project/pull/100085 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits