We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8675952 commit d3a2144Copy full SHA for d3a2144
llvm/include/llvm/Support/JSON.h
@@ -482,6 +482,12 @@ class Value {
482
friend class Object;
483
484
template <typename T, typename... U> void create(U &&... V) {
485
+#if defined(ADDRESS_SANITIZER) || defined(__SANITIZE_ADDRESS__)
486
+ // Unpoisoning to prevent overwriting poisoned object (e.g., annotated short string).
487
+ // Objects that have had their memory poisoned may cause an ASan error if their memory is reused
488
+ // without calling their destructor. Unpoisoning the memory prevents this error from occurring.
489
+ __asan_unpoison_memory_region(&Union, sizeof(T));
490
+#endif
491
new (reinterpret_cast<T *>(&Union)) T(std::forward<U>(V)...);
492
}
493
template <typename T> T &as() const {
0 commit comments