diff options
author | Mike Rice <michael.p.rice@intel.com> | 2019-07-17 15:18:45 +0000 |
---|---|---|
committer | Mike Rice <michael.p.rice@intel.com> | 2019-07-17 15:18:45 +0000 |
commit | 552c2c09d354a3ad9c1c9647e0a3bb5099c31088 (patch) | |
tree | acc4e9a4ecab2104b4e0894c6a2ea50218a6cb45 /clang/test/OpenMP/for_loop_messages.cpp | |
parent | 11d3710c1cd25adf23a4690076e12d6ece267731 (diff) | |
download | bcm5719-llvm-552c2c09d354a3ad9c1c9647e0a3bb5099c31088.tar.gz bcm5719-llvm-552c2c09d354a3ad9c1c9647e0a3bb5099c31088.zip |
[OPENMP]Fix crash in LoopCounterRefChecker when MemberExpr is not Var or Field
checkDecl is only valid for VarDecls or FieldDecls, since getCanonicalDecl
expects only these. Prevent other Decl kinds (such as CXXMethodDecls and
EnumConstantDecls) from entering and asserting.
Differential Revision: https://reviews.llvm.org/D64842
llvm-svn: 366336
Diffstat (limited to 'clang/test/OpenMP/for_loop_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/for_loop_messages.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/OpenMP/for_loop_messages.cpp b/clang/test/OpenMP/for_loop_messages.cpp index 7c2663f6181..f5f6d0b7031 100644 --- a/clang/test/OpenMP/for_loop_messages.cpp +++ b/clang/test/OpenMP/for_loop_messages.cpp @@ -626,6 +626,8 @@ template <typename IT, int ST> class TC { int ii, iii, kk; public: + enum { myconstant = 42 }; + int ub(); int dotest_lt(IT begin, IT end) { #pragma omp parallel // expected-error@+3 3 {{the loop initializer expression depends on the current loop control variable}} @@ -634,6 +636,12 @@ public: for (ii = ii * 10 + 25; ii < ii / ii - 23; ii += 1) ; +// Check that member function calls and enum constants in the condition is +// handled. +#pragma omp for + for (ii = 0; ii < ub() + this->myconstant; ii += 1) // expected-no-error + ; + #pragma omp parallel // expected-error@+4 2 {{expected loop invariant expression or '<invariant1> * ii + <invariant2>' kind of expression}} // expected-error@+3 {{expected loop invariant expression or '<invariant1> * TC::ii + <invariant2>' kind of expression}} |