summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/expression.cpp17
-rw-r--r--src/analysis/expression.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/analysis/expression.cpp b/src/analysis/expression.cpp
index 4c7fa5e..f51a432 100644
--- a/src/analysis/expression.cpp
+++ b/src/analysis/expression.cpp
@@ -154,6 +154,8 @@ std::string getComponentRefVariable(Node *node)
return str;
IndirectRefNode *indirect = static_cast<IndirectRefNode*>(object);
Node *ref = skipNop(indirect->ref);
+ if (ref && !isValidVar(ref->label))
+ return str;
if (ref == PARM_DECL)
{
ParmDeclNode *decl = static_cast<ParmDeclNode*>(ref);
@@ -171,6 +173,8 @@ std::string getComponentRefVariable(Node *node)
}
if (ref == PARM_DECL || ref == VAR_DECL)
{
+ if (!isValidVar(field->label))
+ return str;
str.append(ref->label).append("->").append(field->label);
}
}
@@ -178,6 +182,13 @@ std::string getComponentRefVariable(Node *node)
return str;
}
+bool isValidVar(const std::string &str)
+{
+ if (str.size() > 6 && str.substr(0, 6) == "_vptr.")
+ return false;
+ return true;
+}
+
std::vector<std::string> getComponentRefParts(Node *node)
{
std::vector<std::string> str;
@@ -194,6 +205,8 @@ std::vector<std::string> getComponentRefParts(Node *node)
FieldDeclNode *fieldDecl = static_cast<FieldDeclNode*>(field);
IndirectRefNode *indirect = static_cast<IndirectRefNode*>(object);
Node *ref = skipNop(indirect->ref);
+ if (ref && !isValidVar(ref->label))
+ return str;
if (ref == PARM_DECL)
{
ParmDeclNode *parmDecl = static_cast<ParmDeclNode*>(ref);
@@ -219,6 +232,8 @@ std::vector<std::string> getComponentRefParts(Node *node)
if (arr->elementType != POINTER_TYPE)
return str;
}
+ if (!isValidVar(field->label))
+ return str;
str.push_back(std::string(ref->label).append("->").append(field->label));
}
}
@@ -244,6 +259,8 @@ std::vector<std::string> getComponentRefLeftParts(Node *node)
// return str;
IndirectRefNode *indirect = static_cast<IndirectRefNode*>(object);
Node *ref = skipNop(indirect->ref);
+ if (ref && !isValidVar(ref->label))
+ return str;
if (ref == PARM_DECL || ref == VAR_DECL)
{
str.push_back(ref->label);
diff --git a/src/analysis/expression.h b/src/analysis/expression.h
index 602a9ae..b07f296 100644
--- a/src/analysis/expression.h
+++ b/src/analysis/expression.h
@@ -105,6 +105,8 @@ namespace Analysis
Node *node1,
Node *node2,
WalkItem &wo);
+
+ bool isValidVar(const std::string &str);
}
#endif // ANALYSIS_EXPRESSION_H