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,436 changes: 2,436 additions & 0 deletions cpp/downgrades/c16b29b27f71247023321cc0d0360998b318837c/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,4 @@
description: Link PCH creations and uses
compatibility: full
pch_uses.rel: delete
pch_creations.rel: delete
5 changes: 5 additions & 0 deletions cpp/ql/lib/change-notes/2025-08-27-pch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
category: feature
---
* Added a new class `PchFile` representing precompiled header (PCH) files used during project compilation.

1 change: 1 addition & 0 deletions cpp/ql/lib/cpp.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions cpp/ql/lib/semmle/code/cpp/PchFile.qll
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* 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 {
/**
* Gets a textual representation of this element.
*/
string toString() { result = "PCH for " + this.getHeaderFile() }

/**
* Gets the header file from which 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) }
}
13 changes: 13 additions & 0 deletions cpp/ql/lib/semmlecode.cpp.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,19 @@ extractor_version(
string frontend_version: string ref
)

pch_uses(
int pch: @pch ref,
int compilation: @compilation ref,
int id: @file ref
)

#keyset[pch, compilation]
pch_creations(
int pch: @pch,
int compilation: @compilation ref,
int from: @file ref
)

/** An element for which line-count information is available. */
@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable;

Expand Down
Loading