Skip to content

Commit 291cc0a

Browse files
committed
C++: Anonymous namespaces provide internal linkage.
1 parent 2a7420c commit 291cc0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/TypeFlow.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,13 @@ private module Input implements TypeFlowInput<Location> {
120120
* calls to this function.
121121
*/
122122
private predicate isPrivate(Function func) {
123+
// static functions have internal linkage
123124
func.isStatic()
124125
or
125-
func.getNamespace().getParentNamespace*().isInline()
126+
// anonymous namespaces have internal linkage
127+
func.getNamespace().getParentNamespace*().isAnonymous()
126128
or
129+
// private member functions are only called internally from inside the class
127130
func.(MemberFunction).isPrivate()
128131
}
129132

0 commit comments

Comments
 (0)