[PATCH] D82629: [libclang] Fix crash when visiting a captured VLA.
Jan Korous via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 13:10:29 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e089e98a9d5: [libclang] Fix crash when visiting a captured VLA (authored by ckandeler, committed by jkorous).
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.276534.patch
Type: text/x-patch
Size: 1202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200708/e9ea9199/attachment.bin>
More information about the cfe-commits
mailing list