Skip to content

Commit 8ef60d0

Browse files
djasper-ghcopybara-github
authored andcommitted
Make skipping the parse_headers action also conditional on a crosstool feature.
Not all crosstools might sufficiently validate layering_check otherwise, e.g. Clang needs a version that includes https://reviews.llvm.org/D132779. PiperOrigin-RevId: 483907290 Change-Id: I5a9994258f2345ea390b028fb15859c6c9484794
1 parent c940bb2 commit 8ef60d0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java

+1
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,7 @@ private CcCompilationOutputs createCcCompileActions() throws RuleErrorException
15661566
continue;
15671567
}
15681568
if (cppConfiguration.getParseHeadersSkippedIfCorrespondingSrcsFound()
1569+
&& featureConfiguration.isEnabled(CppRuleClasses.VALIDATES_LAYERING_CHECK_IN_TEXTUAL_HDRS)
15691570
&& compiledBasenames.contains(
15701571
Files.getNameWithoutExtension(artifact.getExecPathString()))) {
15711572
continue;

src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java

+9
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ public static ToolchainTypeRequirement ccToolchainTypeRequirement(RuleDefinition
168168
/** A string constant for the layering_check feature. */
169169
public static final String LAYERING_CHECK = "layering_check";
170170

171+
/**
172+
* A string constant that signifies whether the crosstool validates layering_check in
173+
* textual_hdrs. We use the compiler's definition of textual_hdrs also for all regular but
174+
* non-modular headers. This in turn means that the compiler can check layering in headers of the
175+
* same target, irrespective the PARSE_HEADERS feature and we can elide separate header actions.
176+
*/
177+
public static final String VALIDATES_LAYERING_CHECK_IN_TEXTUAL_HDRS =
178+
"validates_layering_check_in_textual_hdrs";
179+
171180
/** A string constant for the header_modules feature. */
172181
public static final String HEADER_MODULES = "header_modules";
173182

0 commit comments

Comments
 (0)