[PATCH] D78214: [libclang]: visit C++17 if init statements
Benjamin Kramer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 2 13:46:35 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08e181264318: [libclang]: visit C++17 if init statements (authored by milianw, committed by bkramer).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78214/new/
https://reviews.llvm.org/D78214
Files:
clang/test/Index/cxx17-if-with-initializer.cpp
clang/tools/libclang/CIndex.cpp
Index: clang/tools/libclang/CIndex.cpp
===================================================================
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2680,6 +2680,7 @@
AddStmt(If->getElse());
AddStmt(If->getThen());
AddStmt(If->getCond());
+ AddStmt(If->getInit());
AddDecl(If->getConditionVariable());
}
void EnqueueVisitor::VisitInitListExpr(const InitListExpr *IE) {
Index: clang/test/Index/cxx17-if-with-initializer.cpp
===================================================================
--- /dev/null
+++ clang/test/Index/cxx17-if-with-initializer.cpp
@@ -0,0 +1,17 @@
+// Test is line- and column-sensitive; see below.
+
+void foo() {
+ if (bool bar = true; bar) {
+ }
+}
+
+// RUN: c-index-test -test-load-source all -std=c++17 %s | FileCheck -check-prefix=CHECK-LOAD %s
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:3:6: FunctionDecl=foo:3:6 (Definition) Extent=[3:1 - 6:2]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:3:12: CompoundStmt= Extent=[3:12 - 6:2]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:3: IfStmt= Extent=[4:3 - 5:4]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:7: DeclStmt= Extent=[4:7 - 4:23]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:12: VarDecl=bar:4:12 (Definition) Extent=[4:7 - 4:22]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:18: CXXBoolLiteralExpr= Extent=[4:18 - 4:22]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:24: UnexposedExpr=bar:4:12 Extent=[4:24 - 4:27]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:24: DeclRefExpr=bar:4:12 Extent=[4:24 - 4:27]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:29: CompoundStmt= Extent=[4:29 - 5:4]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78214.261664.patch
Type: text/x-patch
Size: 1648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200502/83390fe5/attachment.bin>
More information about the cfe-commits
mailing list