diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-01-26 23:51:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-01-26 23:51:00 +0000 |
commit | fee90811c665893bc27a9bfa8b116548afe1b89b (patch) | |
tree | dcbc675091e8bf4227fea5a345ee209dc6d0cfbb /include/clang/Analysis/Support | |
parent | 97053091c0e4df12ffb662b284b6ab329ca1c40f (diff) |
Teach RegionStore to handle initialization of incomplete arrays in structures using a compound value. Fixes <rdar://problem/7515938>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/Support')
-rw-r--r-- | include/clang/Analysis/Support/Optional.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/clang/Analysis/Support/Optional.h b/include/clang/Analysis/Support/Optional.h index 40f38be020..b98d382700 100644 --- a/include/clang/Analysis/Support/Optional.h +++ b/include/clang/Analysis/Support/Optional.h @@ -20,7 +20,7 @@ namespace clang { template<typename T> class Optional { - const T x; + T x; unsigned hasVal : 1; public: explicit Optional() : hasVal(false) {} @@ -30,9 +30,17 @@ public: return y ? Optional(*y) : Optional(); } + Optional &operator=(const T &y) { + x = y; + hasVal = true; + return *this; + } + const T* getPointer() const { assert(hasVal); return &x; } + const T& getValue() const { assert(hasVal); return x; } operator bool() const { return hasVal; } + bool hasValue() const { return hasVal; } const T* operator->() const { return getPointer(); } const T& operator*() const { assert(hasVal); return x; } }; |