diff options
| author | Gabor Horvath <xazax.hun@gmail.com> | 2019-08-09 19:01:23 +0000 |
|---|---|---|
| committer | Gabor Horvath <xazax.hun@gmail.com> | 2019-08-09 19:01:23 +0000 |
| commit | 67a7530b472763a3a56c100f3a0c12fe26b0fabb (patch) | |
| tree | e259ddcaedf15cbf07b80e4c8bf25f91816a3181 /clang/test/Sema | |
| parent | fd85c894eb6889f2a1d1a175fc7d89e91ae1c9e1 (diff) | |
| download | bcm5719-llvm-67a7530b472763a3a56c100f3a0c12fe26b0fabb.tar.gz bcm5719-llvm-67a7530b472763a3a56c100f3a0c12fe26b0fabb.zip | |
Revert Even more warnings utilizing gsl::Owner/gsl::Pointer annotations
This reverts r368454 (git commit 7c3c8ba8daf40534e09f6fe8701b723e25e4e2dc)
llvm-svn: 368463
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/warn-lifetime-analysis-nocfg.cpp | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp b/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp index efa54fe662b..89cf39a9ca2 100644 --- a/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp +++ b/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp @@ -121,47 +121,24 @@ void initLocalGslPtrWithTempOwner() { namespace std { template <typename T> -struct basic_iterator { - basic_iterator operator++(); - T& operator*(); -}; - -template<typename T> -bool operator!=(basic_iterator<T>, basic_iterator<T>); +struct basic_iterator {}; template <typename T> struct vector { typedef basic_iterator<T> iterator; iterator begin(); - iterator end(); T *data(); - T &at(int n); -}; - -template<typename T> -struct basic_string_view { - basic_string_view(const T *); - const T *begin() const; }; template<typename T> struct basic_string { const T *c_str() const; - operator basic_string_view<T> () const; }; - template<typename T> struct unique_ptr { T *get() const; }; - -template<typename T> -struct optional { - optional(); - optional(const T&); - T &operator*(); -}; } void modelIterators() { @@ -191,29 +168,3 @@ int *danglingUniquePtrFromTemp() { int *danglingUniquePtrFromTemp2() { return std::unique_ptr<int>().get(); // expected-warning {{returning address of local temporary object}} } - -void danglingReferenceFromTempOwner() { - int &r = *std::optional<int>(); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}} - int &r2 = *std::optional<int>(5); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}} - int &r3 = std::vector<int>().at(3); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}} -} - -std::vector<int> getTempVec(); -std::optional<std::vector<int>> getTempOptVec(); - -int &usedToBeFalsePositive(std::vector<int> &v) { - std::vector<int>::iterator it = v.begin(); - int& value = *it; - return value; // ok -} - -int &doNotFollowReferencesForLocalOwner() { - std::unique_ptr<int> localOwner; - int &p = *localOwner.get(); - // In real world code localOwner is usually moved here. - return p; // ok -} - -const char *trackThroughMultiplePointer() { - return std::basic_string_view<char>(std::basic_string<char>()).begin(); // expected-warning {{returning address of local temporary object}} -} |

