https://bugs.llvm.org/show_bug.cgi?id=52235

            Bug ID: 52235
           Summary: warning for expensive inline constructors
           Product: clang
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: tras...@gmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

(Please correct me if anything is wrong)

When ctors/dtors are defined inline they will be emitted into every object file
using them. It gets worse when debug info is enabled.
Then there's the potential issue of not being able to anchor the vtable in one
place and also the class type information.
https://blog.llvm.org/posts/2021-04-05-constructor-homing-for-debug-info/

Chrome already implemented such a warning as a plugin:
https://www.chromium.org/developers/coding-style/chromium-style-checker-errors#TOC-Constructor-Destructor-Errors
https://chromium.googlesource.com/chromium/src/tools/clang/+/refs/heads/main/plugins/FindBadConstructsConsumer.cpp

Not sure if it should be a warning or a clang-tidy check.
But it shouldn't be that expensive and would reach a larger audience as a
warning.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to