njames93 added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/cert/ExitHandlerCheck.cpp:33 +bool isExitFunction(StringRef FnName) { + return FnName == "_Exit" || FnName == "exit" || FnName == "quick_exit"; +} ---------------- whisperity wrote: > aaron.ballman wrote: > > Because this rule applies in C++ as well as C, you should protect these > > names so that calling something like this doesn't trigger the check: > > ``` > > namespace menu_items { > > void exit(int); > > } > > ``` > > I think we want `::_Exit` and `::std::_Exit` to check the fully qualified > > names (I believe this will still work in C, but should be tested). The same > > goes for the other names (including `atexit` and `at_quick_exit` above). > > I think we want `::_Exit` and `::std::_Exit` to check the fully qualified > > names (I believe this will still work in C, but should be tested). > > Tested with Clang-Query: > > ``` > clang-query> m functionDecl(hasName("::atexit")) > > Match #1: > > /home/whisperity/LLVM/Build/foo.c:1:1: note: "root" binds here > int atexit(int) {} > ^~~~~~~~~~~~~~~~~~ > 1 match. > ``` That only works because the logic inside the `hasName`matcher ================ Comment at: clang-tools-extra/clang-tidy/cert/ExitHandlerCheck.cpp:32 /// 'quick_exit' bool isExitFunction(StringRef FnName) { return FnName == "_Exit" || FnName == "exit" || FnName == "quick_exit"; ---------------- This should take a pointer to the function to run other checks, like checking its decl context. ================ Comment at: clang-tools-extra/clang-tidy/cert/ExitHandlerCheck.cpp:37 /// Only 'longjmp' is considered. bool isJumpFunction(StringRef FnName) { return FnName == "longjmp"; } ---------------- Ditto Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83717/new/ https://reviews.llvm.org/D83717 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits