Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix red code in MODULE.bazel #7217

Merged
merged 2 commits into from
Jan 13, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ public boolean isTopLevel() {
return parent == null || parent.getElementType() == BuildElementTypes.BUILD_FILE;
}

/** If the function is called as a member on something. */
public boolean isMemberFunction() {
// if there are more than one reference to something, it is safe to assume that this is a member function
return findChildByType(BuildElementTypes.REFERENCE_EXPRESSION) !=
findLastChildByType(BuildElementTypes.REFERENCE_EXPRESSION);
}

public boolean mightBeBuildRule() {
return isTopLevel() || getNameArgument() != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public void visitFuncallExpression(FuncallExpression node) {
if (spec == null) {
return;
}
if (node.isMemberFunction()) {
// if the function is a member function, it cannot be a rule
return;
}
String ruleName = node.getFunctionName();
RuleDefinition rule = spec.getRule(ruleName);
if (rule == null) {
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/com/google/idea/blaze/cpp/HeaderRootTrimmer.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ private static Set<ExecutionRootPath> collectExecutionRootPaths(
paths.addAll(target.getcIdeInfo().getTransitiveQuoteIncludeDirectories());
}
}

// Builtin includes should not be added to the switch builder, because CLion discovers builtin include paths during
// the compiler info collection, and therefore it would be safe to filter these header roots. But this would make
// the filter stricter, and it is unclear if this would affect any users.
Set<CToolchainIdeInfo> toolchains = new LinkedHashSet<>(toolchainLookupMap.values());
for (CToolchainIdeInfo toolchain : toolchains) {
paths.addAll(toolchain.getBuiltInIncludeDirectories());
Expand Down
Loading