[compiler-rt] 45974f4 - [NFC][sanitizer] Add C++ guard into a header
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 14:24:53 PDT 2023
Author: Vitaly Buka
Date: 2023-08-14T14:24:04-07:00
New Revision: 45974f4dd4d3066d069f855d383f63af72765c54
URL: https://github.com/llvm/llvm-project/commit/45974f4dd4d3066d069f855d383f63af72765c54
DIFF: https://github.com/llvm/llvm-project/commit/45974f4dd4d3066d069f855d383f63af72765c54.diff
LOG: [NFC][sanitizer] Add C++ guard into a header
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h b/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h
index 6649ff5844f5c0..efa5a58a7211ee 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h
@@ -21,6 +21,8 @@ asm("memcpy = __sanitizer_internal_memcpy");
asm("memmove = __sanitizer_internal_memmove");
asm("memset = __sanitizer_internal_memset");
+# if defined(__cplusplus)
+
// The builtins should not be redefined in source files that make use of C++
// standard libraries, in particular where C++STL headers with inline functions
// are used. The redefinition in such cases would lead to ODR violations.
@@ -46,6 +48,7 @@ using unordered_set = Define_SANITIZER_COMMON_NO_REDEFINE_BUILTINS_in_cpp_file;
using vector = Define_SANITIZER_COMMON_NO_REDEFINE_BUILTINS_in_cpp_file;
} // namespace std
+# endif // __cpluplus
#endif // !_WIN32
#endif // SANITIZER_REDEFINE_BUILTINS_H
More information about the llvm-commits
mailing list