Skip to content
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,499 changes: 2,499 additions & 0 deletions cpp/downgrades/9baef67d1ffc1551429dbe1c1130815693e28218/old.dbscheme

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: Add a predicate `getAnAttribute` to `Namespace`
compatibility: full
namespaceattributes.rel: delete
4 changes: 4 additions & 0 deletions cpp/ql/lib/change-notes/2025-06-16-namespace-attributes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: feature
---
* Added a predicate `getAnAttribute` to `Namespace` to retrieve a namespace attribute.
5 changes: 5 additions & 0 deletions cpp/ql/lib/semmle/code/cpp/Namespace.qll
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ class Namespace extends NameQualifyingElement, @namespace {

/** Gets a file which declares (part of) this namespace. */
File getAFile() { result = this.getADeclarationEntry().getLocation().getFile() }

/** Gets an attribute of this namespace. */
Attribute getAnAttribute() {
namespaceattributes(underlyingElement(this), unresolveElement(result))
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The predicate call isn’t assigned to the result variable, so the method won’t return any values. It should read:

result = namespaceattributes(underlyingElement(this), unresolveElement(result));
Suggested change
namespaceattributes(underlyingElement(this), unresolveElement(result))
result = namespaceattributes(underlyingElement(this), unresolveElement(result))

Copilot uses AI. Check for mistakes.
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions cpp/ql/lib/semmlecode.cpp.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,11 @@ varattributes(
int spec_id: @attribute ref
);

namespaceattributes(
int namespace_id: @namespace ref,
int spec_id: @attribute ref
);

stmtattributes(
int stmt_id: @stmt ref,
int spec_id: @attribute ref
Expand Down
Loading