summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-12-13 16:05:30 -0500
committerAlexey Bataev <a.bataev@hotmail.com>2019-12-13 16:51:46 -0500
commit8035bb4a6573f7d20f17044a68a1405691000525 (patch)
treebadc81c2fe3d9cd01ee8b5ad8e50c623ee6f44fb /clang/test/OpenMP
parente8af4fd42da3580f9bda5202f381bf92d07f4b9c (diff)
downloadbcm5719-llvm-8035bb4a6573f7d20f17044a68a1405691000525.tar.gz
bcm5719-llvm-8035bb4a6573f7d20f17044a68a1405691000525.zip
[OPENMP]Fix skipping of functions body.
When parsing the code with OpenMP and the function's body must be skipped, need to skip also OpenMP annotation tokens. Otherwise the counters for braces/parens are unbalanced and parsing fails.
Diffstat (limited to 'clang/test/OpenMP')
-rw-r--r--clang/test/OpenMP/crash-skipped-bodies-template-inst.cpp30
-rw-r--r--clang/test/OpenMP/openmp_check.cpp10
2 files changed, 30 insertions, 10 deletions
diff --git a/clang/test/OpenMP/crash-skipped-bodies-template-inst.cpp b/clang/test/OpenMP/crash-skipped-bodies-template-inst.cpp
new file mode 100644
index 00000000000..c7ba432d509
--- /dev/null
+++ b/clang/test/OpenMP/crash-skipped-bodies-template-inst.cpp
@@ -0,0 +1,30 @@
+// RUN: not %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:28:5 -fopenmp %s -o - 2>&1 | FileCheck %s
+template <class T>
+auto make_func() {
+ struct impl {
+ impl* func() {
+ int x;
+ if (x = 10) {
+ #pragma omp parallel
+ ;
+ }
+ // Check that body of this function is actually skipped.
+ // CHECK-NOT: crash-skipped-bodies-template-inst.cpp:7:{{[0-9]+}}: warning: using the result of an assignment as a condition without parentheses
+ return this;
+ }
+ };
+
+ int x;
+ if (x = 10) {}
+ // Check that this function is not skipped.
+ // CHECK: crash-skipped-bodies-template-inst.cpp:18:9: warning: using the result of an assignment as a condition without parentheses
+ return impl();
+}
+
+void foo() {
+ []() {
+ make_func<int>();
+ m
+ // CHECK: COMPLETION: make_func : [#auto#]make_func<<#class T#>>()
+ };
+}
diff --git a/clang/test/OpenMP/openmp_check.cpp b/clang/test/OpenMP/openmp_check.cpp
index cd4706b57e4..6a8dd17fc83 100644
--- a/clang/test/OpenMP/openmp_check.cpp
+++ b/clang/test/OpenMP/openmp_check.cpp
@@ -19,7 +19,6 @@ int nested(int a) {
#if __cplusplus <= 199711L
// expected-warning@-2 {{'auto' type specifier is a C++11 extension}}
// expected-error@-3 {{expected expression}}
- // expected-error@-4 {{expected ';' at end of declaration}}
#endif
#pragma omp parallel
@@ -29,14 +28,5 @@ int nested(int a) {
}
};
F();
-#if __cplusplus <= 199711L
- // expected-error@-2 {{C++ requires a type specifier for all declarations}}
-#endif
return a;
-#if __cplusplus <= 199711L
- // expected-error@-2 {{expected unqualified-id}}
-#endif
}
-#if __cplusplus <= 199711L
-// expected-error@-2 {{extraneous closing brace ('}')}}
-#endif
OpenPOWER on IntegriCloud