C++: Expose PCH file creation as usage in QL

This commit is contained in:
Jeroen Ketema
2025-08-26 20:52:48 +02:00
parent e9b00f1e0d
commit e20ce57023
2 changed files with 24 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
import Customizations
import semmle.code.cpp.File
import semmle.code.cpp.PchFile
import semmle.code.cpp.Linkage
import semmle.code.cpp.Location
import semmle.code.cpp.Compilation

View File

@@ -0,0 +1,23 @@
/**
* Provides the `PchFile` class representing precompiled header (PCH) files created and
* used during the build process.
*/
import semmle.code.cpp.File
/**
* A precompiled header (PCH) file created during the build process.
*/
class PchFile extends @pch {
string toString() { result = "PCH for " + this.getHeaderFile() }
/**
* Gets the header file from with the PCH file was created.
*/
File getHeaderFile() { pch_creations(this, _, result) }
/**
* Gets a source file that includes the PCH.
*/
File getAUse() { pch_uses(this, _, result) }
}