14 changes: 14 additions & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,20 @@ INLINE u32 GetNumberOfCPUsCached() {
return NumberOfCPUsCached;
}

template <typename T>
class ArrayRef {
public:
ArrayRef() {}
ArrayRef(T *begin, T *end) : begin_(begin), end_(end) {}

T *begin() { return begin_; }
T *end() { return end_; }

private:
T *begin_ = nullptr;
T *end_ = nullptr;
};

} // namespace __sanitizer

inline void *operator new(__sanitizer::operator_new_size_type size,
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/test/hwasan/TestCases/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ int x = 1;

int main(int argc, char **argv) {
// RSYM: is located 0 bytes to the right of 4-byte global variable x {{.*}} in {{.*}}global.c.tmp
// RNOSYM: is located to the right of a global variable in ({{.*}}global.c.tmp+{{.*}})
// RNOSYM: is located to the right of a 4-byte global variable in ({{.*}}global.c.tmp+{{.*}})
// LSYM: is located 4 bytes to the left of 4-byte global variable x {{.*}} in {{.*}}global.c.tmp
// LNOSYM: is located to the left of a global variable in ({{.*}}global.c.tmp+{{.*}})
// LNOSYM: is located to the left of a 4-byte global variable in ({{.*}}global.c.tmp+{{.*}})
// CHECK-NOT: can not describe
(&x)[atoi(argv[1])] = 1;
}
2 changes: 2 additions & 0 deletions llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ source_set("sources") {
"hwasan_dynamic_shadow.h",
"hwasan_exceptions.cpp",
"hwasan_flags.h",
"hwasan_globals.cpp",
"hwasan_globals.h",
"hwasan_interceptors.cpp",
"hwasan_interceptors_vfork.S",
"hwasan_interface_internal.h",
Expand Down