teemperor updated this revision to Diff 214149.
teemperor added a reviewer: labath.
teemperor added a comment.
- Delete the checks instead of adding a type-info exception.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65932/new/
https://reviews.llvm.org/D65932
Files:
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.cpp
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.h
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/Makefile
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/TestDynamicCast.py
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/main.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
Index: lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -1329,17 +1329,11 @@
clang::NamedDecl *named_decl = DeclForGlobal(global_variable);
if (!named_decl) {
- if (IsObjCSelectorRef(llvm_value_ptr))
- return true;
-
- if (!global_variable->hasExternalLinkage())
- return true;
-
if (log)
LLDB_LOGF(log, "Found global variable \"%s\" without metadata",
global_variable->getName().str().c_str());
- return false;
+ return true;
}
std::string name(named_decl->getName().str());
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/main.cpp
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/main.cpp
@@ -0,0 +1,51 @@
+#include "ExtBase.h"
+
+class Base {
+public:
+ virtual char foo() {
+ return 'b';
+ }
+};
+
+class Derived : public Base {
+public:
+ char foo() override {
+ return 'd';
+ }
+};
+
+class NonOverrideDerived : public Base {
+};
+
+class ExtDerived : public ExtBase {
+public:
+ char bar() override {
+ return 'y';
+ }
+};
+
+int main() {
+ Derived d;
+ NonOverrideDerived d2;
+ Base *b = &d;
+ Base *real_base = new Base();
+ char c = dynamic_cast<Derived *>(b)->foo();
+
+ ExtDerived ext_d;
+ ExtBase *ext_b = &ext_d;
+ ExtBase *ext_real_base = new ExtBase();
+ c = dynamic_cast<ExtDerived *>(ext_b)->bar();
+
+
+ return 0; //% self.expect("expression dynamic_cast<class Derived *>(b) == (Derived*)b", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class Base *>(b) == (Base*)b", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class Derived *>(real_base) == nullptr", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class NonOverrideDerived *>(&d) == nullptr", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class ExtDerived *>(real_base) == nullptr", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class Derived *>(&d2) == nullptr", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class NonOverrideDerived *>(&d2) == (NonOverrideDerived *)&d2", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class Derived *>(&ext_d) == nullptr", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class ExtDerived *>(ext_b) == (class ExtDerived*)ext_b", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class ExtBase *>(ext_real_base) == (class ExtBase*)ext_real_base", substrs = ["bool", " = true"])
+ //% self.expect("expression dynamic_cast<class ExtDerived *>(ext_real_base) == nullptr", substrs = ["bool", " = true"])
+}
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/TestDynamicCast.py
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/TestDynamicCast.py
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals(), [])
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/Makefile
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp ExtBase.cpp
+include $(LEVEL)/Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.h
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.h
@@ -0,0 +1,3 @@
+class ExtBase {
+ virtual char bar();
+};
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.cpp
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.cpp
@@ -0,0 +1,5 @@
+#include "ExtBase.h"
+
+char ExtBase::bar() {
+ return 'x';
+}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits