Skip to content

Commit ef780c1

Browse files
committed
C++: NSDMI fixes
* Do not generate IR for field initializers from uninstantiated templates. * Add forgotten case to `TranslatedDeclarationEntry`
1 parent 346ab9d commit ef780c1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module Raw {
4747
not var.isFromUninstantiatedTemplate(_) and
4848
var instanceof StaticInitializedStaticLocalVariable
4949
or
50+
not var.isFromUninstantiatedTemplate(_) and
5051
var instanceof Field
5152
) and
5253
var.hasInitializer() and

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedDeclarationEntry.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ abstract class TranslatedDeclarationEntry extends TranslatedElement, TTranslated
3434
or
3535
result = entry.getDeclaration().(GlobalOrNamespaceVariable)
3636
or
37+
result = entry.getDeclaration().(Field)
38+
or
3739
not entry.getDeclaration() instanceof StaticInitializedStaticLocalVariable and
3840
not entry.getDeclaration() instanceof GlobalOrNamespaceVariable and
3941
not entry.getDeclaration() instanceof Field and

0 commit comments

Comments
 (0)