Skip to content

C++: Add inline namespace support #740

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 3 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions change-notes/1.20/analysis-cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
| Resource not released in destructor (`cpp/resource-not-released-in-destructor`) | Fewer false positive results | Fix false positives where a resource is released via a virtual method call. |

## Changes to QL libraries

There is a new `Namespace.isInline()` predicate, which holds if the namespace was declared as `inline namespace`.
5 changes: 5 additions & 0 deletions cpp/ql/src/semmle/code/cpp/Namespace.qll
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class Namespace extends NameQualifyingElement, @namespace {
/** Gets a child namespace of this namespace. */
Namespace getAChildNamespace() { namespacembrs(underlyingElement(this),unresolveElement(result)) }

/** Holds if the namespace is inline. */
predicate isInline() {
namespace_inline(underlyingElement(this))
}

/** Holds if this namespace may be from source. */
override predicate fromSource() { this.getADeclaration().fromSource() }

Expand Down
4 changes: 4 additions & 0 deletions cpp/ql/src/semmlecode.cpp.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,10 @@ namespaces(
string name: string ref
);

namespace_inline(
unique int id: @namespace ref
);

namespacembrs(
int parentid: @namespace ref,
unique int memberid: @namespacembr ref
Expand Down
Loading