Handle __builtin_addressof.

This commit is contained in:
Ziemowit Laski
2019-07-10 19:41:26 -07:00
parent 175ba7b3b0
commit 960a41be85
2 changed files with 13 additions and 1 deletions

View File

@@ -51,6 +51,9 @@ class BuiltInVarArgCopy extends BuiltInOperation, @vacopyexpr {
*/
class BuiltInNoOp extends BuiltInOperation, @noopexpr {
override string toString() { result = "__noop" }
/** Canonical QL class corresponding to this element. */
override string getCanonicalQLClass() { result = "BuiltInNoOp" }
}
/**
@@ -58,6 +61,9 @@ class BuiltInNoOp extends BuiltInOperation, @noopexpr {
*/
class BuiltInOperationOffsetOf extends BuiltInOperation, @offsetofexpr {
override string toString() { result = "__offsetof" }
/** Canonical QL class corresponding to this element. */
override string getCanonicalQLClass() { result = "BuiltInOperationOffsetOf" }
}
/**
@@ -65,6 +71,9 @@ class BuiltInOperationOffsetOf extends BuiltInOperation, @offsetofexpr {
*/
class BuiltInIntAddr extends BuiltInOperation, @intaddrexpr {
override string toString() { result = "__INTADDR__" }
/** Canonical QL class corresponding to this element. */
override string getCanonicalQLClass() { result = "BuiltInIntAddr" }
}
/**
@@ -239,6 +248,9 @@ class BuiltInOperationBuiltInAddressOf extends UnaryOperation, BuiltInOperation,
or result = this.getOperand().(ReferenceDereferenceExpr).getChild(0).(Access).getTarget()
}
/** Canonical QL class corresponding to this element. */
override string getCanonicalQLClass() { result = "BuiltInOperationBuiltInAddressOf" }
override string getOperator() { result = "__builtin_addressof" }
}

View File

@@ -195,7 +195,7 @@ clang.cpp:
# 5| params:
# 5| body: [Block]: { ... }
# 6| 0: [ReturnStmt]: return ...
# 6| 0: [???]: __builtin_addressof ...
# 6| 0: [BuiltInOperationBuiltInAddressOf]: __builtin_addressof ...
# 6| Type = [IntPointerType]: int *
# 6| ValueCategory = prvalue
# 6| 0: [VariableAccess]: globalInt