[analyzer] Just silence all warnings coming out of std::basic_string.
This means always walking the whole call stack for the end path node, but
we'll assume that's always fairly tractable.
<rdar://problem/15952973>
llvm-svn: 200980
diff --git a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
index 82b5078..3586921 100644
--- a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -155,11 +155,21 @@
// basic_string
template<class _CharT, class _Alloc = allocator<_CharT> >
class __attribute__ ((__type_visibility__("default"))) basic_string {
- _CharT localStorage[4];
+ bool isLong;
+ union {
+ _CharT localStorage[4];
+ _CharT *externalStorage;
+
+ void assignExternal(_CharT *newExternal) {
+ externalStorage = newExternal;
+ }
+ } storage;
typedef allocator_traits<_Alloc> __alloc_traits;
public:
+ basic_string();
+
void push_back(int c) {
// Fake error trigger.
// No warning is expected as we are suppressing warning coming
@@ -168,11 +178,24 @@
z = 5/z;
}
+ _CharT *getBuffer() {
+ return isLong ? storage.externalStorage : storage.localStorage;
+ }
+
basic_string &operator +=(int c) {
// Fake deallocate stack-based storage.
// No warning is expected as we are suppressing warnings within
- // allocators being used by std::basic_string.
- __alloc_traits::deallocate(&localStorage);
+ // std::basic_string.
+ __alloc_traits::deallocate(getBuffer());
+ }
+
+ basic_string &operator =(const basic_string &other) {
+ // Fake deallocate stack-based storage, then use the variable in the
+ // same union.
+ // No warning is expected as we are suppressing warnings within
+ // std::basic_string.
+ __alloc_traits::deallocate(getBuffer());
+ storage.assignExternal(new _CharT[4]);
}
};
}