[llvm-bugs] [Bug 52235] New: warning for expensive inline constructors

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 20 09:18:11 PDT 2021


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: unassignedclangbugs at nondot.org
          Reporter: trass3r at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211020/0001318c/attachment-0001.html>


More information about the llvm-bugs mailing list