8000 C++: Revert "Merge pull request #12125 from jketema/unique-function" by MathiasVP · Pull Request #15304 · github/codeql · GitHub
[go: up one dir, main page]

Skip to content

C++: Revert "Merge pull request #12125 from jketema/unique-function" #15304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Revert "Merge pull request #12125 from jketema/unique-function"
This reverts commit 9c039c4, reversing
changes made to ecd2003.
  • Loading branch information
MathiasVP committed Jan 12, 2024
commit 84d08b0417b88ec41f1a375b98d9a2ccd55bbcb4
4 changes: 0 additions & 4 deletions cpp/ql/lib/semmle/code/cpp/Element.qll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import semmle.code.cpp.Location
private import semmle.code.cpp.Enclosing
private import semmle.code.cpp.internal.ResolveClass
private import semmle.code.cpp.internal.ResolveGlobalVariable
private import semmle.code.cpp.internal.ResolveFunction

/**
* Get the `Element` that represents this `@element`.
Expand All @@ -31,14 +30,11 @@ pragma[inline]
@element unresolveElement(Element e) {
not result instanceof @usertype and
not result instanceof @variable and
not result instanceof @function and
result = e
or
e = resolveClass(result)
or
e = resolveGlobalVariable(result)
or
e = resolveFunction(result)
}

/**
Expand Down
3 changes: 0 additions & 3 deletions cpp/ql/lib/semmle/code/cpp/Function.qll
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import semmle.code.cpp.exprs.Call
import semmle.code.cpp.metrics.MetricFunction
import semmle.code.cpp.Linkage
private import semmle.code.cpp.internal.ResolveClass
private import semmle.code.cpp.internal.ResolveFunction

/**
* A C/C++ function [N4140 8.3.5]. Both member functions and non-member
Expand All @@ -26,8 +25,6 @@ private import semmle.code.cpp.internal.ResolveFunction
* in more detail in `Declaration.qll`.
*/
class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
Function() { isFunction(underlyingElement(this)) }

override string getName() { functions(underlyingElement(this), result, _) }

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ private predicate loopConditionAlwaysUponEntry(ControlFlowNode loop, Expr condit
* should be in this relation.
*/
pragma[noinline]
private predicate isFunction(@element el) {
el instanceof @function
private predicate isFunction(Element el) {
el instanceof Function
or
el.(Expr).getParent() = el
}
Expand All @@ -122,7 +122,7 @@ private predicate isFunction(@element el) {
*/
pragma[noopt]
private predicate callHasNoTarget(@funbindexpr fc) {
exists(@function f |
exists(Function f |
funbind(fc, f) and
not isFunction(f)
)
Expand Down
57 changes: 0 additions & 57 deletions cpp/ql/lib/semmle/code/cpp/internal/ResolveFunction.qll

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ private predicate isGlobalWithMangledNameAndWithoutDefinition(@mangledname name,
* a unique global variable `complete` with the same name that does have a definition.
*/
private predicate hasTwinWithDefinition(@globalvariable incomplete, @globalvariable complete) {
not variable_instantiation(incomplete, complete) and
exists(@mangledname name |
not variable_instantiation(incomplete, complete) and
isGlobalWithMangledNameAndWithoutDefinition(name, incomplete) and
isGlobalWithMangledNameAndWithDefinition(name, complete)
)
Expand Down
0