[PATCH] D82629: [libclang] Fix crash when visiting a captured VLA.
Christian Kandeler via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 05:54:17 PDT 2020
ckandeler updated this revision to Diff 274071.
ckandeler added a comment.
Fixed formatting issues.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82629/new/
https://reviews.llvm.org/D82629
Files:
clang/test/Index/evaluate-cursor.cpp
clang/tools/libclang/CIndex.cpp
Index: clang/tools/libclang/CIndex.cpp
===================================================================
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -3272,7 +3272,7 @@
}
// Visit init captures
for (auto InitExpr : E->capture_inits()) {
- if (Visit(InitExpr))
+ if (InitExpr && Visit(InitExpr))
return true;
}
Index: clang/test/Index/evaluate-cursor.cpp
===================================================================
--- clang/test/Index/evaluate-cursor.cpp
+++ clang/test/Index/evaluate-cursor.cpp
@@ -29,6 +29,12 @@
constexpr static int calc_val() { return 1 + 2; }
const auto the_value = calc_val() + sizeof(char);
+void vlaTest() {
+ int msize = 4;
+ float arr[msize];
+ [&arr] {};
+}
+
// RUN: c-index-test -evaluate-cursor-at=%s:4:7 \
// RUN: -evaluate-cursor-at=%s:8:7 \
// RUN: -evaluate-cursor-at=%s:8:11 -std=c++11 %s | FileCheck %s
@@ -65,3 +71,7 @@
// CHECK-EXPR: Value: 3
// CHECK-EXPR: unsigned, Value: 4
// CHECK-EXPR: unsigned, Value: 1
+
+// RUN: c-index-test -evaluate-cursor-at=%s:35:5 \
+// RUN: -std=c++11 %s | FileCheck -check-prefix=VLA %s
+// VLA: Not Evaluatable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82629.274071.patch
Type: text/x-patch
Size: 1202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200629/db40cac3/attachment-0001.bin>
More information about the cfe-commits
mailing list