[OpenMP] DSAChecker bug fix for combined directives.

The DSAChecker code in SemaOpenMP looks at the captured statement
associated with an OpenMP directive.  A combined directive such as
'target parallel' has nested capture statements, which have to be
fully traversed before executing the DSAChecker.  This is a patch
to perform the traversal for such combined directives.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29026

llvm-svn: 292794
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index a4622e1..c902118 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -2268,7 +2268,11 @@
 
     // Check default data sharing attributes for referenced variables.
     DSAAttrChecker DSAChecker(DSAStack, *this, cast<CapturedStmt>(AStmt));
-    DSAChecker.Visit(cast<CapturedStmt>(AStmt)->getCapturedStmt());
+    int ThisCaptureLevel = getOpenMPCaptureLevels(Kind);
+    Stmt *S = AStmt;
+    while (--ThisCaptureLevel >= 0)
+      S = cast<CapturedStmt>(S)->getCapturedStmt();
+    DSAChecker.Visit(S);
     if (DSAChecker.isErrorFound())
       return StmtError();
     // Generate list of implicitly defined firstprivate variables.