From 654d2e8f6939c67c144b0ec931b166bfdf65b3b8 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Wed, 25 Sep 2024 13:40:27 +0200 Subject: [PATCH] C++: Merge the location tables --- cpp/ql/lib/semmle/code/cpp/Function.qll | 2 +- cpp/ql/lib/semmle/code/cpp/Location.qll | 24 +++--- cpp/ql/lib/semmle/code/cpp/Namespace.qll | 2 +- cpp/ql/lib/semmle/code/cpp/Specifier.qll | 2 +- cpp/ql/lib/semmle/code/cpp/Type.qll | 4 +- cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll | 4 +- .../ir/dataflow/internal/DataFlowPrivate.qll | 4 +- .../cpp/ir/dataflow/internal/DataFlowUtil.qll | 10 +-- .../cpp/ir/dataflow/internal/SsaInternals.qll | 2 +- .../aliased_ssa/IRConsistency.qll | 2 +- .../aliased_ssa/gvn/ValueNumbering.qll | 2 +- .../ir/implementation/raw/IRConsistency.qll | 2 +- .../implementation/raw/gvn/ValueNumbering.qll | 2 +- .../unaliased_ssa/IRConsistency.qll | 2 +- .../unaliased_ssa/gvn/ValueNumbering.qll | 2 +- .../cpp/ir/internal/ASTValueNumbering.qll | 2 +- .../code/cpp/ir/internal/IRCppLanguage.qll | 2 - .../cpp/rangeanalysis/new/RangeAnalysis.qll | 2 +- .../new/internal/semantic/analysis/Bound.qll | 2 +- cpp/ql/lib/semmlecode.cpp.dbscheme | 80 ++++++------------- .../src/jsf/4.07 Header Files/AV Rule 35.ql | 2 +- .../rangeanalysis/RangeAnalysis.ql | 2 +- .../includes/includes/locations.expected | 2 - 23 files changed, 60 insertions(+), 100 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/Function.qll b/cpp/ql/lib/semmle/code/cpp/Function.qll index f23b04e19d6b3..dae467bd8864f 100644 --- a/cpp/ql/lib/semmle/code/cpp/Function.qll +++ b/cpp/ql/lib/semmle/code/cpp/Function.qll @@ -860,7 +860,7 @@ class BuiltInFunction extends Function { /** Gets a dummy location for the built-in function. */ override Location getLocation() { suppressUnusedThis(this) and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } } diff --git a/cpp/ql/lib/semmle/code/cpp/Location.qll b/cpp/ql/lib/semmle/code/cpp/Location.qll index fd5d2d34c5d5c..255af3b33c16f 100644 --- a/cpp/ql/lib/semmle/code/cpp/Location.qll +++ b/cpp/ql/lib/semmle/code/cpp/Location.qll @@ -53,9 +53,7 @@ class Location extends @location { predicate fullLocationInfo( Container container, int startline, int startcolumn, int endline, int endcolumn ) { - locations_default(this, unresolveElement(container), startline, startcolumn, endline, endcolumn) or - locations_expr(this, unresolveElement(container), startline, startcolumn, endline, endcolumn) or - locations_stmt(this, unresolveElement(container), startline, startcolumn, endline, endcolumn) + locations(this, unresolveElement(container), startline, startcolumn, endline, endcolumn) } /** @@ -143,30 +141,30 @@ class Locatable extends Element { } * expressions, one for statements and one for other program elements. */ class UnknownLocation extends Location { - UnknownLocation() { this.getFile().getAbsolutePath() = "" } + UnknownLocation() { this.getFile().getAbsolutePath() = "" and locations(this, _, 0, 0, 0, 0) } } /** * A dummy location which is used when something doesn't have a location in * the source code but needs to have a `Location` associated with it. + * + * DEPRECATED: use `UnknownLocation` */ -class UnknownDefaultLocation extends UnknownLocation { - UnknownDefaultLocation() { locations_default(this, _, 0, 0, 0, 0) } -} +deprecated class UnknownDefaultLocation extends UnknownLocation { } /** * A dummy location which is used when an expression doesn't have a * location in the source code but needs to have a `Location` associated * with it. + * + * DEPRECATED: use `UnknownLocation` */ -class UnknownExprLocation extends UnknownLocation { - UnknownExprLocation() { locations_expr(this, _, 0, 0, 0, 0) } -} +deprecated class UnknownExprLocation extends UnknownLocation { } /** * A dummy location which is used when a statement doesn't have a location * in the source code but needs to have a `Location` associated with it. + * + * DEPRECATED: use `UnknownLocation` */ -class UnknownStmtLocation extends UnknownLocation { - UnknownStmtLocation() { locations_stmt(this, _, 0, 0, 0, 0) } -} +deprecated class UnknownStmtLocation extends UnknownLocation { } diff --git a/cpp/ql/lib/semmle/code/cpp/Namespace.qll b/cpp/ql/lib/semmle/code/cpp/Namespace.qll index 2e75a783c14fe..b8256da6fa4db 100644 --- a/cpp/ql/lib/semmle/code/cpp/Namespace.qll +++ b/cpp/ql/lib/semmle/code/cpp/Namespace.qll @@ -40,7 +40,7 @@ class Namespace extends NameQualifyingElement, @namespace { override Location getLocation() { if strictcount(this.getADeclarationEntry()) = 1 then result = this.getADeclarationEntry().getLocation() - else result instanceof UnknownDefaultLocation + else result instanceof UnknownLocation } /** Gets the simple name of this namespace. */ diff --git a/cpp/ql/lib/semmle/code/cpp/Specifier.qll b/cpp/ql/lib/semmle/code/cpp/Specifier.qll index 2f1976d220c4c..6543a0e8cf255 100644 --- a/cpp/ql/lib/semmle/code/cpp/Specifier.qll +++ b/cpp/ql/lib/semmle/code/cpp/Specifier.qll @@ -13,7 +13,7 @@ class Specifier extends Element, @specifier { /** Gets a dummy location for the specifier. */ override Location getLocation() { exists(this) and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } override string getAPrimaryQlClass() { result = "Specifier" } diff --git a/cpp/ql/lib/semmle/code/cpp/Type.qll b/cpp/ql/lib/semmle/code/cpp/Type.qll index 16d589e999557..7b09f1ed8d957 100644 --- a/cpp/ql/lib/semmle/code/cpp/Type.qll +++ b/cpp/ql/lib/semmle/code/cpp/Type.qll @@ -290,7 +290,7 @@ class Type extends Locatable, @type { override Location getLocation() { suppressUnusedThis(this) and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } } @@ -1714,7 +1714,7 @@ class AutoType extends TemplateParameter { override Location getLocation() { suppressUnusedThis(this) and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } } diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll index 91b57049a54e9..dded2bf578eca 100644 --- a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll +++ b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll @@ -91,13 +91,13 @@ class Expr extends StmtParent, @expr { */ private Location getExprLocationOverride() { // Base case: the parent has a better location than `this`. - this.getDbLocation() instanceof UnknownExprLocation and + this.getDbLocation() instanceof UnknownLocation and result = this.getParent().(Expr).getDbLocation() and not result instanceof UnknownLocation or // Recursive case: the parent has a location override that's better than // what `this` has. - this.getDbLocation() instanceof UnknownExprLocation and + this.getDbLocation() instanceof UnknownLocation and result = this.getParent().(Expr).getExprLocationOverride() and not result instanceof UnknownLocation } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll index ac6e898748aba..a663977093b47 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll @@ -182,7 +182,7 @@ abstract class InstructionNode0 extends Node0Impl { override Location getLocationImpl() { if exists(instr.getAst().getLocation()) then result = instr.getAst().getLocation() - else result instanceof UnknownDefaultLocation + else result instanceof UnknownLocation } final override predicate isGLValue() { exists(getInstructionType(instr, true)) } @@ -227,7 +227,7 @@ abstract class OperandNode0 extends Node0Impl { override Location getLocationImpl() { if exists(op.getDef().getAst().getLocation()) then result = op.getDef().getAst().getLocation() - else result instanceof UnknownDefaultLocation + else result instanceof UnknownLocation } final override predicate isGLValue() { exists(getOperandType(op, true)) } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll index f2263abf7f520..1939e4ef1cdef 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll @@ -867,7 +867,7 @@ class BodyLessParameterNodeImpl extends Node, TBodyLessParameterNodeImpl { result = unique( | | p.getLocation()) or count(p.getLocation()) != 1 and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } final override string toStringImpl() { @@ -1133,7 +1133,7 @@ private module RawIndirectNodes { final override Location getLocationImpl() { if exists(this.getOperand().getLocation()) then result = this.getOperand().getLocation() - else result instanceof UnknownDefaultLocation + else result instanceof UnknownLocation } override string toStringImpl() { @@ -1177,7 +1177,7 @@ private module RawIndirectNodes { final override Location getLocationImpl() { if exists(this.getInstruction().getLocation()) then result = this.getInstruction().getLocation() - else result instanceof UnknownDefaultLocation + else result instanceof UnknownLocation } override string toStringImpl() { @@ -1271,7 +1271,7 @@ class FinalParameterNode extends Node, TFinalParameterNode { result = unique( | | p.getLocation()) or not exists(unique( | | p.getLocation())) and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } override string toStringImpl() { result = stars(this) + p.toString() } @@ -1622,7 +1622,7 @@ class VariableNode extends Node, TGlobalLikeVariableNode { result = unique( | | v.getLocation()) or not exists(unique( | | v.getLocation())) and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } override string toStringImpl() { result = stars(this) + v.toString() } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll index 9672f27199d60..974a6668b672a 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll @@ -501,7 +501,7 @@ class FinalParameterUse extends UseImpl, TFinalParameterUse { result = unique( | | p.getLocation()) or not exists(unique( | | p.getLocation())) and - result instanceof UnknownDefaultLocation + result instanceof UnknownLocation } override BaseIRVariable getBaseSourceVariable() { result.getIRVariable().getAst() = p } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRConsistency.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRConsistency.qll index edc785dfabeec..46cf96bbf1040 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRConsistency.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRConsistency.qll @@ -45,7 +45,7 @@ module InstructionConsistency { private class MissingIRFunction extends OptionalIRFunction, TMissingIRFunction { override string toString() { result = "" } - override Language::Location getLocation() { result instanceof Language::UnknownDefaultLocation } + override Language::Location getLocation() { result instanceof Language::UnknownLocation } } private OptionalIRFunction getInstructionIRFunction(Instruction instr) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll index 2a46e16c52fe5..57f0504e318f1 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll @@ -26,7 +26,7 @@ class ValueNumber extends TValueNumber { l.getFile().getAbsolutePath(), l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn() ) - else result instanceof Language::UnknownDefaultLocation + else result instanceof Language::UnknownLocation } /** diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRConsistency.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRConsistency.qll index edc785dfabeec..46cf96bbf1040 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRConsistency.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRConsistency.qll @@ -45,7 +45,7 @@ module InstructionConsistency { private class MissingIRFunction extends OptionalIRFunction, TMissingIRFunction { override string toString() { result = "" } - override Language::Location getLocation() { result instanceof Language::UnknownDefaultLocation } + override Language::Location getLocation() { result instanceof Language::UnknownLocation } } private OptionalIRFunction getInstructionIRFunction(Instruction instr) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/gvn/ValueNumbering.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/gvn/ValueNumbering.qll index 2a46e16c52fe5..57f0504e318f1 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/gvn/ValueNumbering.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/gvn/ValueNumbering.qll @@ -26,7 +26,7 @@ class ValueNumber extends TValueNumber { l.getFile().getAbsolutePath(), l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn() ) - else result instanceof Language::UnknownDefaultLocation + else result instanceof Language::UnknownLocation } /** diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRConsistency.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRConsistency.qll index edc785dfabeec..46cf96bbf1040 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRConsistency.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRConsistency.qll @@ -45,7 +45,7 @@ module InstructionConsistency { private class MissingIRFunction extends OptionalIRFunction, TMissingIRFunction { override string toString() { result = "" } - override Language::Location getLocation() { result instanceof Language::UnknownDefaultLocation } + override Language::Location getLocation() { result instanceof Language::UnknownLocation } } private OptionalIRFunction getInstructionIRFunction(Instruction instr) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/ValueNumbering.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/ValueNumbering.qll index 2a46e16c52fe5..57f0504e318f1 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/ValueNumbering.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/ValueNumbering.qll @@ -26,7 +26,7 @@ class ValueNumber extends TValueNumber { l.getFile().getAbsolutePath(), l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn() ) - else result instanceof Language::UnknownDefaultLocation + else result instanceof Language::UnknownLocation } /** diff --git a/cpp/ql/lib/semmle/code/cpp/ir/internal/ASTValueNumbering.qll b/cpp/ql/lib/semmle/code/cpp/ir/internal/ASTValueNumbering.qll index 2dd51d391512c..4a40c90a1dd9d 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/internal/ASTValueNumbering.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/internal/ASTValueNumbering.qll @@ -76,7 +76,7 @@ class GVN extends TValueNumber { l.getFile().getAbsolutePath(), l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn() ) - else result instanceof UnknownDefaultLocation + else result instanceof UnknownLocation } final string getKind() { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll index 681e2838ffbee..de66d43163225 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll @@ -22,8 +22,6 @@ class Location = Cpp::Location; class UnknownLocation = Cpp::UnknownLocation; -class UnknownDefaultLocation = Cpp::UnknownDefaultLocation; - class File = Cpp::File; class AST = Cpp::Locatable; diff --git a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/RangeAnalysis.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/RangeAnalysis.qll index 6bd7615d37b70..845a71b2a5025 100644 --- a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/RangeAnalysis.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/RangeAnalysis.qll @@ -89,7 +89,7 @@ class ZeroBound extends Bound instanceof IRBound::ZeroBound { result = super.getInstruction(delta).getUnconvertedResultExpression() } - override Location getLocation() { result instanceof UnknownDefaultLocation } + override Location getLocation() { result instanceof UnknownLocation } } /** diff --git a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Bound.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Bound.qll index 27883aedf3e7c..4d873e8e3b3e1 100644 --- a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Bound.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Bound.qll @@ -61,7 +61,7 @@ class ZeroBound extends Bound, TBoundZero { result.(ConstantValueInstruction).getValue().toInt() = delta } - override Location getLocation() { result instanceof UnknownDefaultLocation } + override Location getLocation() { result instanceof UnknownLocation } } /** diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index 7ff6a6e53dbcf..90a5d525c477c 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -202,10 +202,10 @@ extractor_version( string frontend_version: string ref ) -@location = @location_stmt | @location_expr | @location_default ; +@location = @location_default ; /** - * The location of an element that is not an expression or a statement. + * The location of an element. * The location spans column `startcolumn` of line `startline` to * column `endcolumn` of line `endline` in file `file`. * For more information, see @@ -221,40 +221,6 @@ locations_default( int endColumn: int ref ); -/** - * The location of a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_stmt( - /** The location of a statement. */ - unique int id: @location_stmt, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of an expression. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_expr( - /** The location of an expression. */ - unique int id: @location_expr, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - /** An element for which line-count information is available. */ @sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; @@ -271,7 +237,7 @@ diagnostics( string error_tag: string ref, string error_message: string ref, string full_error_message: string ref, - int location: @location_default ref + int location: @location ref ); files( @@ -316,7 +282,7 @@ case @macroinvocation.kind of macroinvocations( unique int id: @macroinvocation, int macro_id: @ppd_define ref, - int location: @location_default ref, + int location: @location ref, int kind: int ref ); @@ -437,7 +403,7 @@ fun_decls( int function: @function ref, int type_id: @type ref, string name: string ref, - int location: @location_default ref + int location: @location ref ); fun_def(unique int id: @fun_decl ref); fun_specialized(unique int id: @fun_decl ref); @@ -476,7 +442,7 @@ var_decls( int variable: @variable ref, int type_id: @type ref, string name: string ref, - int location: @location_default ref + int location: @location ref ); var_def(unique int id: @var_decl ref); var_decl_specifiers( @@ -488,7 +454,7 @@ is_structured_binding(unique int id: @variable ref); type_decls( unique int id: @type_decl, int type_id: @type ref, - int location: @location_default ref + int location: @location ref ); type_def(unique int id: @type_decl ref); type_decl_top( @@ -498,8 +464,8 @@ type_decl_top( namespace_decls( unique int id: @namespace_decl, int namespace_id: @namespace ref, - int location: @location_default ref, - int bodylocation: @location_default ref + int location: @location ref, + int bodylocation: @location ref ); case @using.kind of @@ -511,7 +477,7 @@ case @using.kind of usings( unique int id: @using, int element_id: @element ref, - int location: @location_default ref, + int location: @location ref, int kind: int ref ); @@ -525,7 +491,7 @@ static_asserts( unique int id: @static_assert, int condition : @expr ref, string message : string ref, - int location: @location_default ref, + int location: @location ref, int enclosing : @element ref ); @@ -581,7 +547,7 @@ enumconstants( int index: int ref, int type_id: @type ref, string name: string ref, - int location: @location_default ref + int location: @location ref ); @variable = @localscopevariable | @globalvariable | @membervariable; @@ -927,7 +893,7 @@ attributes( int kind: int ref, string name: string ref, string name_space: string ref, - int location: @location_default ref + int location: @location ref ); case @attribute.kind of @@ -944,7 +910,7 @@ attribute_args( int kind: int ref, int attribute: @attribute ref, int index: int ref, - int location: @location_default ref + int location: @location ref ); case @attribute_arg.kind of @@ -1028,7 +994,7 @@ derivations( int sub: @type ref, int index: int ref, int super: @type ref, - int location: @location_default ref + int location: @location ref ); derspecifiers( @@ -1062,7 +1028,7 @@ frienddecls( unique int id: @frienddecl, int type_id: @type ref, int decl_id: @declaration ref, - int location: @location_default ref + int location: @location ref ); @declaredtype = @usertype ; @@ -1118,7 +1084,7 @@ frienddecls( comments( unique int id: @comment, string contents: string ref, - int location: @location_default ref + int location: @location ref ); commentbinding( @@ -1240,7 +1206,7 @@ namequalifiers( unique int id: @namequalifier, unique int qualifiableelement: @namequalifiableelement ref, int qualifyingelement: @namequalifyingelement ref, - int location: @location_default ref + int location: @location ref ); varbind( @@ -1509,7 +1475,7 @@ initialisers( unique int init: @initialiser, int var: @accessible ref, unique int expr: @expr ref, - int location: @location_expr ref + int location: @location ref ); braced_initialisers( @@ -1528,7 +1494,7 @@ expr_ancestor( exprs( unique int id: @expr, int kind: int ref, - int location: @location_expr ref + int location: @location ref ); expr_reuse( @@ -1991,7 +1957,7 @@ lambda_capture( int field: @membervariable ref, boolean captured_by_reference: boolean ref, boolean is_implicit: boolean ref, - int location: @location_default ref + int location: @location ref ); @funbindexpr = @routineexpr @@ -2019,7 +1985,7 @@ fold( stmts( unique int id: @stmt, int kind: int ref, - int location: @location_stmt ref + int location: @location ref ); case @stmt.kind of @@ -2187,7 +2153,7 @@ jumpinfo( preprocdirects( unique int id: @preprocdirect, int kind: int ref, - int location: @location_default ref + int location: @location ref ); case @preprocdirect.kind of 0 = @ppd_if diff --git a/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.ql b/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.ql index 704c5baa0672a..59a6838c23e3d 100644 --- a/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.ql +++ b/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.ql @@ -37,7 +37,7 @@ abstract class MaybePreprocessorDirective extends TMaybePreprocessorDirective { class NoPreprocessorDirective extends TNoPreprocessorDirective, MaybePreprocessorDirective { override string toString() { result = "" } - override Location getLocation() { result instanceof UnknownDefaultLocation } + override Location getLocation() { result instanceof UnknownLocation } } class SomePreprocessorDirective extends TSomePreprocessorDirective, MaybePreprocessorDirective { diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/rangeanalysis/RangeAnalysis.ql b/cpp/ql/test/experimental/library-tests/rangeanalysis/rangeanalysis/RangeAnalysis.ql index 1b77763682adb..240567b536c22 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/rangeanalysis/RangeAnalysis.ql +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/rangeanalysis/RangeAnalysis.ql @@ -15,5 +15,5 @@ query predicate instructionBounds( not valueNumber(b.getInstruction()) = valueNumber(i) and if reason instanceof CondReason then reasonLoc = reason.(CondReason).getCond().getLocation() - else reasonLoc instanceof UnknownDefaultLocation + else reasonLoc instanceof UnknownLocation } diff --git a/cpp/ql/test/library-tests/includes/includes/locations.expected b/cpp/ql/test/library-tests/includes/includes/locations.expected index 1b6b3b0689237..c61055c844131 100644 --- a/cpp/ql/test/library-tests/includes/includes/locations.expected +++ b/cpp/ql/test/library-tests/includes/includes/locations.expected @@ -1,7 +1,5 @@ | bar.h:0:0:0:0 | bar.h:0:0:0:0 | | file://:0:0:0:0 | file://:0:0:0:0 | -| file://:0:0:0:0 | file://:0:0:0:0 | -| file://:0:0:0:0 | file://:0:0:0:0 | | includes.c:0:0:0:0 | includes.c:0:0:0:0 | | includes.c:2:1:2:15 | includes.c:2:1:2:15 | | includes.c:4:1:4:16 | includes.c:4:1:4:16 |