Skip to content

feat: add IWYU pragmas for public/private headers (#1386) - #1483

Merged
SGSSGene merged 39 commits into
jbeder:masterfrom
harleywilsoneng:feat/iwyu-pragmas-1386
Aug 12, 2026
Merged

feat: add IWYU pragmas for public/private headers (#1386)#1483
SGSSGene merged 39 commits into
jbeder:masterfrom
harleywilsoneng:feat/iwyu-pragmas-1386

Conversation

@harleywilsoneng

Copy link
Copy Markdown
Contributor

Summary

Adds Include What You Use pragmas across yaml-cpp public headers, following the same pattern as googletest:

  • yaml-cpp/yaml.h marks its transitive includes with // IWYU pragma: export
  • Internal headers mark // IWYU pragma: private, include "yaml-cpp/yaml.h" plus friend "yaml-cpp/.*"

This lets IWYU redirect #include "yaml-cpp/node/node.h" to the umbrella header so users get impl.h and other required definitions, avoiding link errors.

Fixes #1386.

Test plan

  • Headers compile unchanged (comments only)
  • Run IWYU on a sample TU using YAML::Node and confirm it suggests yaml-cpp/yaml.h

Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>
Signed-off-by: harleywilsoneng <harleywilsoneng@users.noreply.github.com>

@SGSSGene SGSSGene left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you very much for this contribution!
Personally not using IWYU but pretty sure people would love to use it.

(Also reminds me, we should remove the code for #pragma once, that creates some noise in the files).

@SGSSGene
SGSSGene merged commit 5bef9aa into jbeder:master Aug 12, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Include What You Use pragmas to help IWYU find the correct headers to include.

2 participants