Details
Diff Detail
Event Timeline
test/CodeGenCXX/sanitize-dtor-callback.cpp | ||
---|---|---|
5 | Why all this c++11 complexity? It does not seem to affect the test at all. It's OK to only test c++11. | |
44 | Please make this a regular check, and a CHECK-LABEL for the function name. Does not have to be "main". Also, STD11-LABEL - without "CHECK". This case is not handled in the implementation, there is no sanitizer call in the .ll output. This uncovers another problem - destructors are not emitted in the c++ declaration order. I'm not sure what the order is, you'll need either to reorder the checks or split into multiple files. |
test/CodeGenCXX/sanitize-default-dtor-callback.cpp | ||
---|---|---|
39 | This is not what's happening here. Just read the bitcode (FileCheck input): define linkonce_odr void @_ZN21Defaulted_Non_TrivialD1Ev(%struct.Defaulted_Non_Trivial* %this) unnamed_addr #0 comdat align 2 { call void @__sanitizer_dtor_callback(i8* %11, i64 1) #1 ret void } define linkonce_odr void @_ZN6SimpleD1Ev(%struct.Simple* %this) unnamed_addr #0 comdat align 2 { ret void } define linkonce_odr void @_ZN6SimpleD2Ev(%struct.Simple* %this) unnamed_addr #0 comdat align 2 { call void @__sanitizer_dtor_callback(i8* %11, i64 1) #1 ret void } The CHECKs are matching code from 2 or 3 different functions. |
LGTM with a nit
test/CodeGenCXX/sanitize-no-dtor-callback.cpp | ||
---|---|---|
18 ↗ | (On Diff #29833) | This (and below) comments are wrong, just remove them. |
This is not what's happening here. Just read the bitcode (FileCheck input):
define linkonce_odr void @_ZN21Defaulted_Non_TrivialD1Ev(%struct.Defaulted_Non_Trivial* %this) unnamed_addr #0 comdat align 2 {
...
}
define linkonce_odr void @_ZN6SimpleD1Ev(%struct.Simple* %this) unnamed_addr #0 comdat align 2 {
...
call void @_ZN6SimpleD2Ev(%struct.Simple* %this1) #1
...
call void @__sanitizer_dtor_callback(i8* %11, i64 1) #1
}
define linkonce_odr void @_ZN6SimpleD2Ev(%struct.Simple* %this) unnamed_addr #0 comdat align 2 {
...
}
The CHECKs are matching code from 2 or 3 different functions.
I suggest adding CHECK-LABEL and CHECK: ret void for all destructors that are emitted for this file to avoid this.
Also, it looks like we insert instrumentation in 2 different destructors of struct Simple, and one of them calls the other. This poisons the object twice.