Fixed a bug in the expression code which caused
it to interpret a "this" variable that was merely
a pointer -- that is, not a class pointer -- as
meaning that the current context was inside a C++
method. This bug would prevent expressions from
evaluating correctly in regular C code if there
was a pointer variable named "this" in scope.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124117 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangUserExpression.cpp b/source/Expression/ClangUserExpression.cpp
index 4142c5c..73c7441 100644
--- a/source/Expression/ClangUserExpression.cpp
+++ b/source/Expression/ClangUserExpression.cpp
@@ -89,11 +89,14 @@
{
TypeFromUser target_ast_type(pointer_target_type, this_type->GetClangAST());
- if (target_ast_type.IsDefined())
+ if (target_ast_type.IsDefined() &&
+ ClangASTContext::IsCXXClassType(target_ast_type.GetOpaqueQualType()))
+ {
m_cplusplus = true;
- if (target_ast_type.IsConst())
- m_const_object = true;
+ if (target_ast_type.IsConst())
+ m_const_object = true;
+ }
}
}
else if (self_var.get())