From 754612d2574aeeab1fbbd9f6fd3e2bcdb3f385a5 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 28 Aug 2019 14:09:13 +0100 Subject: [PATCH] C++: Split valuetext off into its own table --- cpp/ql/src/semmle/code/cpp/exprs/Expr.qll | 4 ++-- cpp/ql/src/semmlecode.cpp.dbscheme | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/exprs/Expr.qll b/cpp/ql/src/semmle/code/cpp/exprs/Expr.qll index 015b1fc3cdb..a887fb6c8e3 100644 --- a/cpp/ql/src/semmle/code/cpp/exprs/Expr.qll +++ b/cpp/ql/src/semmle/code/cpp/exprs/Expr.qll @@ -85,10 +85,10 @@ class Expr extends StmtParent, @expr { override string toString() { none() } /** Gets the value of this expression, if it is a constant. */ - string getValue() { exists(@value v | values(v,result,_) and valuebind(v,underlyingElement(this))) } + string getValue() { exists(@value v | values(v,result) and valuebind(v,underlyingElement(this))) } /** Gets the source text for the value of this expression, if it is a constant. */ - string getValueText() { exists(@value v | values(v,_,result) and valuebind(v,underlyingElement(this))) } + string getValueText() { exists(@value v | valuetext(v,result) and valuebind(v,underlyingElement(this))) } /** Holds if this expression has a value that can be determined at compile time. */ cached diff --git a/cpp/ql/src/semmlecode.cpp.dbscheme b/cpp/ql/src/semmlecode.cpp.dbscheme index cac7e921070..81a312e6daf 100644 --- a/cpp/ql/src/semmlecode.cpp.dbscheme +++ b/cpp/ql/src/semmlecode.cpp.dbscheme @@ -1237,11 +1237,15 @@ expr_cond_false( int false: @expr ref ); -// the second field is a string representation of the value -// the third field is the actual text in the source or the same as the second field +/** A string representation of the value. */ values( unique int id: @value, - string str: string ref, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, string text: string ref );