llvm-project
637d3dc1 - [clang][ssaf] Fix UB caused by missing virtual dtor of FormatInfoEntry (#181838)

Commit
74 days ago
[clang][ssaf] Fix UB caused by missing virtual dtor of FormatInfoEntry (#181838) In the `llvm::Registry` the `Add` will create a `unique_ptr` of the desired derived type on the heap; then it puts it into the linked list of base pointers. Consequently, when destructing the registry, it needs to call the matching dtor for the object, so that must be virtual. In this patch, I fix it by marking it virtual, and also put a static assert to prevent future mistakes of this kind. FYI: The static assert must be in dependent context to ensure that `T` is complete by the time hitting the static assert. Fixes https://github.com/Quuxplusone/llvm-project/issues/51
Author
Parents
Loading