[PATCH] D64409: [libclang] Fix hang in release / assertion in debug when evaluating value-dependent types.

Emilio Cobos Álvarez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 07:27:40 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL365490: [libclang] Fix hang in release / assertion in debug when evaluating value… (authored by emilio, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64409?vs=208658&id=208679#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64409/new/

https://reviews.llvm.org/D64409

Files:
  cfe/trunk/test/Index/evaluate-cursor.cpp
  cfe/trunk/tools/libclang/CIndex.cpp


Index: cfe/trunk/test/Index/evaluate-cursor.cpp
===================================================================
--- cfe/trunk/test/Index/evaluate-cursor.cpp
+++ cfe/trunk/test/Index/evaluate-cursor.cpp
@@ -21,6 +21,11 @@
 
 long long HUGE_NEG = -(1ll << 35);
 
+template <typename d> class e {
+  using f = d;
+  static const auto g = alignof(f);
+};
+
 // 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
@@ -42,3 +47,9 @@
 // CHECK-LONG: unsigned, Value: 1152921504606846976
 // CHECK-LONG: unsigned, Value: 9223372036854775808
 // CHECK-LONG: Value: -34359738368
+
+// RUN: c-index-test -evaluate-cursor-at=%s:18:20 \
+// RUN:    -evaluate-cursor-at=%s:20:20 \
+// RUN:    -evaluate-cursor-at=%s:26:21 \
+// RUN:    -std=c++11 %s | FileCheck -check-prefix=CHECK-DOES-NOT-CRASH %s
+// CHECK-DOES-NOT-CRASH: Not Evaluatable
Index: cfe/trunk/tools/libclang/CIndex.cpp
===================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -3782,6 +3782,8 @@
     return nullptr;
 
   expr = expr->IgnoreParens();
+  if (expr->isValueDependent())
+    return nullptr;
   if (!expr->EvaluateAsRValue(ER, ctx))
     return nullptr;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64409.208679.patch
Type: text/x-patch
Size: 1323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190709/4658a575/attachment-0001.bin>


More information about the cfe-commits mailing list