C++: Move imports from instantiated pyrameterized modules into separate file

Rather than have IR.qll (which depends on the flavor) import EdgeKind.qll (which does not) with an non-relative import, I've moved these imports into internal.IRImports relative to IR.qll. These imports files can be shared across flavors within one language, but are different between C# and C++ due to the difference in paths.
This commit is contained in:
Dave Bartolomeo 2019-07-19 13:09:36 -07:00
Родитель 8d8c66fc49
Коммит 832807401b
37 изменённых файлов: 118 добавлений и 60 удалений

Просмотреть файл

@ -3,8 +3,9 @@ import Instruction
import IRBlock
import IRVariable
import Operand
import semmle.code.cpp.ir.implementation.EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind
private import internal.IRImports as Imports
import Imports::EdgeKind
import Imports::MemoryAccessKind
private newtype TIRPropertyProvider = MkIRPropertyProvider()

Просмотреть файл

@ -1,6 +1,7 @@
private import internal.IRInternal
import Instruction
import semmle.code.cpp.ir.implementation.EdgeKind
private import internal.IRBlockImports as Imports
import Imports::EdgeKind
private import Cached
/**

Просмотреть файл

@ -1,9 +1,10 @@
private import internal.IRInternal
import IRFunction
import semmle.code.cpp.ir.implementation.TempVariableTag
private import semmle.code.cpp.ir.internal.IRUtilities
private import semmle.code.cpp.ir.internal.TempVariableTag
private import semmle.code.cpp.ir.internal.TIRVariable
private import internal.IRVariableImports as Imports
import Imports::TempVariableTag
private import Imports::IRUtilities
private import Imports::TTempVariableTag
private import Imports::TIRVariable
IRUserVariable getIRUserVariable(Language::Function func, Language::Variable var) {
result.getVariable() = var and

Просмотреть файл

@ -3,11 +3,11 @@ import IRFunction
import IRBlock
import IRVariable
import Operand
import semmle.code.cpp.ir.implementation.EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind
import semmle.code.cpp.ir.implementation.Opcode
private import semmle.code.cpp.ir.implementation.Opcode
private import semmle.code.cpp.ir.internal.OperandTag
private import internal.InstructionImports as Imports
import Imports::EdgeKind
import Imports::MemoryAccessKind
import Imports::Opcode
private import Imports::OperandTag
module InstructionSanity {
/**

Просмотреть файл

@ -1,9 +1,10 @@
private import internal.IRInternal
import Instruction
import IRBlock
import semmle.code.cpp.ir.implementation.MemoryAccessKind
import semmle.code.cpp.ir.internal.Overlap
private import semmle.code.cpp.ir.internal.OperandTag
private import internal.OperandImports as Imports
import Imports::MemoryAccessKind
import Imports::Overlap
private import Imports::OperandTag
cached
private newtype TOperand =

Просмотреть файл

@ -1,7 +1,7 @@
private import semmle.code.cpp.ir.internal.IRLanguageInternal
private import internal.IRInternal
private import IR
import semmle.code.cpp.ir.IRConfiguration
private import semmle.code.cpp.Print
private import internal.PrintIRImports as Imports
import Imports::IRConfiguration
private newtype TPrintIRConfiguration = MkPrintIRConfiguration()
@ -131,7 +131,7 @@ class PrintableIRFunction extends PrintableIRNode, TPrintableIRFunction {
}
override string getLabel() {
result = getIdentityString(irFunc.getFunction())
result = Language::getIdentityString(irFunc.getFunction())
}
override int getOrder() {
@ -213,7 +213,7 @@ class PrintableInstruction extends PrintableIRNode, TPrintableInstruction {
result = instr.toString()
}
override Location getLocation() {
override Language::Location getLocation() {
result = instr.getLocation()
}

Просмотреть файл

@ -0,0 +1 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind

Просмотреть файл

@ -0,0 +1,2 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind

Просмотреть файл

@ -0,0 +1,4 @@
import semmle.code.cpp.ir.implementation.TempVariableTag as TempVariableTag
import semmle.code.cpp.ir.internal.IRUtilities as IRUtilities
import semmle.code.cpp.ir.internal.TempVariableTag as TTempVariableTag
import semmle.code.cpp.ir.internal.TIRVariable as TIRVariable

Просмотреть файл

@ -0,0 +1,4 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind
import semmle.code.cpp.ir.implementation.Opcode as Opcode
import semmle.code.cpp.ir.internal.OperandTag as OperandTag

Просмотреть файл

@ -0,0 +1,3 @@
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind
import semmle.code.cpp.ir.internal.Overlap as Overlap
import semmle.code.cpp.ir.internal.OperandTag as OperandTag

Просмотреть файл

@ -0,0 +1 @@
import semmle.code.cpp.ir.IRConfiguration as IRConfiguration

Просмотреть файл

@ -3,8 +3,9 @@ import Instruction
import IRBlock
import IRVariable
import Operand
import semmle.code.cpp.ir.implementation.EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind
private import internal.IRImports as Imports
import Imports::EdgeKind
import Imports::MemoryAccessKind
private newtype TIRPropertyProvider = MkIRPropertyProvider()

Просмотреть файл

@ -1,6 +1,7 @@
private import internal.IRInternal
import Instruction
import semmle.code.cpp.ir.implementation.EdgeKind
private import internal.IRBlockImports as Imports
import Imports::EdgeKind
private import Cached
/**

Просмотреть файл

@ -0,0 +1 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind

Просмотреть файл

@ -1,9 +1,10 @@
private import internal.IRInternal
import IRFunction
import semmle.code.cpp.ir.implementation.TempVariableTag
private import semmle.code.cpp.ir.internal.IRUtilities
private import semmle.code.cpp.ir.internal.TempVariableTag
private import semmle.code.cpp.ir.internal.TIRVariable
private import internal.IRVariableImports as Imports
import Imports::TempVariableTag
private import Imports::IRUtilities
private import Imports::TTempVariableTag
private import Imports::TIRVariable
IRUserVariable getIRUserVariable(Language::Function func, Language::Variable var) {
result.getVariable() = var and

Просмотреть файл

@ -3,11 +3,11 @@ import IRFunction
import IRBlock
import IRVariable
import Operand
import semmle.code.cpp.ir.implementation.EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind
import semmle.code.cpp.ir.implementation.Opcode
private import semmle.code.cpp.ir.implementation.Opcode
private import semmle.code.cpp.ir.internal.OperandTag
private import internal.InstructionImports as Imports
import Imports::EdgeKind
import Imports::MemoryAccessKind
import Imports::Opcode
private import Imports::OperandTag
module InstructionSanity {
/**

Просмотреть файл

@ -1,9 +1,10 @@
private import internal.IRInternal
import Instruction
import IRBlock
import semmle.code.cpp.ir.implementation.MemoryAccessKind
import semmle.code.cpp.ir.internal.Overlap
private import semmle.code.cpp.ir.internal.OperandTag
private import internal.OperandImports as Imports
import Imports::MemoryAccessKind
import Imports::Overlap
private import Imports::OperandTag
cached
private newtype TOperand =

Просмотреть файл

@ -1,7 +1,7 @@
private import semmle.code.cpp.ir.internal.IRLanguageInternal
private import internal.IRInternal
private import IR
import semmle.code.cpp.ir.IRConfiguration
private import semmle.code.cpp.Print
private import internal.PrintIRImports as Imports
import Imports::IRConfiguration
private newtype TPrintIRConfiguration = MkPrintIRConfiguration()
@ -131,7 +131,7 @@ class PrintableIRFunction extends PrintableIRNode, TPrintableIRFunction {
}
override string getLabel() {
result = getIdentityString(irFunc.getFunction())
result = Language::getIdentityString(irFunc.getFunction())
}
override int getOrder() {
@ -213,7 +213,7 @@ class PrintableInstruction extends PrintableIRNode, TPrintableInstruction {
result = instr.toString()
}
override Location getLocation() {
override Language::Location getLocation() {
result = instr.getLocation()
}

Просмотреть файл

@ -0,0 +1 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind

Просмотреть файл

@ -0,0 +1,2 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind

Просмотреть файл

@ -0,0 +1,4 @@
import semmle.code.cpp.ir.implementation.TempVariableTag as TempVariableTag
import semmle.code.cpp.ir.internal.IRUtilities as IRUtilities
import semmle.code.cpp.ir.internal.TempVariableTag as TTempVariableTag
import semmle.code.cpp.ir.internal.TIRVariable as TIRVariable

Просмотреть файл

@ -0,0 +1,4 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind
import semmle.code.cpp.ir.implementation.Opcode as Opcode
import semmle.code.cpp.ir.internal.OperandTag as OperandTag

Просмотреть файл

@ -0,0 +1,3 @@
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind
import semmle.code.cpp.ir.internal.Overlap as Overlap
import semmle.code.cpp.ir.internal.OperandTag as OperandTag

Просмотреть файл

@ -0,0 +1 @@
import semmle.code.cpp.ir.IRConfiguration as IRConfiguration

Просмотреть файл

@ -3,8 +3,9 @@ import Instruction
import IRBlock
import IRVariable
import Operand
import semmle.code.cpp.ir.implementation.EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind
private import internal.IRImports as Imports
import Imports::EdgeKind
import Imports::MemoryAccessKind
private newtype TIRPropertyProvider = MkIRPropertyProvider()

Просмотреть файл

@ -1,6 +1,7 @@
private import internal.IRInternal
import Instruction
import semmle.code.cpp.ir.implementation.EdgeKind
private import internal.IRBlockImports as Imports
import Imports::EdgeKind
private import Cached
/**

Просмотреть файл

@ -1,9 +1,10 @@
private import internal.IRInternal
import IRFunction
import semmle.code.cpp.ir.implementation.TempVariableTag
private import semmle.code.cpp.ir.internal.IRUtilities
private import semmle.code.cpp.ir.internal.TempVariableTag
private import semmle.code.cpp.ir.internal.TIRVariable
private import internal.IRVariableImports as Imports
import Imports::TempVariableTag
private import Imports::IRUtilities
private import Imports::TTempVariableTag
private import Imports::TIRVariable
IRUserVariable getIRUserVariable(Language::Function func, Language::Variable var) {
result.getVariable() = var and

Просмотреть файл

@ -3,11 +3,11 @@ import IRFunction
import IRBlock
import IRVariable
import Operand
import semmle.code.cpp.ir.implementation.EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind
import semmle.code.cpp.ir.implementation.Opcode
private import semmle.code.cpp.ir.implementation.Opcode
private import semmle.code.cpp.ir.internal.OperandTag
private import internal.InstructionImports as Imports
import Imports::EdgeKind
import Imports::MemoryAccessKind
import Imports::Opcode
private import Imports::OperandTag
module InstructionSanity {
/**

Просмотреть файл

@ -1,9 +1,10 @@
private import internal.IRInternal
import Instruction
import IRBlock
import semmle.code.cpp.ir.implementation.MemoryAccessKind
import semmle.code.cpp.ir.internal.Overlap
private import semmle.code.cpp.ir.internal.OperandTag
private import internal.OperandImports as Imports
import Imports::MemoryAccessKind
import Imports::Overlap
private import Imports::OperandTag
cached
private newtype TOperand =

Просмотреть файл

@ -1,7 +1,7 @@
private import semmle.code.cpp.ir.internal.IRLanguageInternal
private import internal.IRInternal
private import IR
import semmle.code.cpp.ir.IRConfiguration
private import semmle.code.cpp.Print
private import internal.PrintIRImports as Imports
import Imports::IRConfiguration
private newtype TPrintIRConfiguration = MkPrintIRConfiguration()
@ -131,7 +131,7 @@ class PrintableIRFunction extends PrintableIRNode, TPrintableIRFunction {
}
override string getLabel() {
result = getIdentityString(irFunc.getFunction())
result = Language::getIdentityString(irFunc.getFunction())
}
override int getOrder() {
@ -213,7 +213,7 @@ class PrintableInstruction extends PrintableIRNode, TPrintableInstruction {
result = instr.toString()
}
override Location getLocation() {
override Language::Location getLocation() {
result = instr.getLocation()
}

Просмотреть файл

@ -0,0 +1 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind

Просмотреть файл

@ -0,0 +1,2 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind

Просмотреть файл

@ -0,0 +1,4 @@
import semmle.code.cpp.ir.implementation.TempVariableTag as TempVariableTag
import semmle.code.cpp.ir.internal.IRUtilities as IRUtilities
import semmle.code.cpp.ir.internal.TempVariableTag as TTempVariableTag
import semmle.code.cpp.ir.internal.TIRVariable as TIRVariable

Просмотреть файл

@ -0,0 +1,4 @@
import semmle.code.cpp.ir.implementation.EdgeKind as EdgeKind
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind
import semmle.code.cpp.ir.implementation.Opcode as Opcode
import semmle.code.cpp.ir.internal.OperandTag as OperandTag

Просмотреть файл

@ -0,0 +1,3 @@
import semmle.code.cpp.ir.implementation.MemoryAccessKind as MemoryAccessKind
import semmle.code.cpp.ir.internal.Overlap as Overlap
import semmle.code.cpp.ir.internal.OperandTag as OperandTag

Просмотреть файл

@ -0,0 +1 @@
import semmle.code.cpp.ir.IRConfiguration as IRConfiguration