[llvm] [OFFLOAD] Implement excluding filters for debugging (PR #180538)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 9 07:17:41 PST 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h -- offload/include/Shared/Debug.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/offload/include/Shared/Debug.h b/offload/include/Shared/Debug.h
index 31b461295..723761b2f 100644
--- a/offload/include/Shared/Debug.h
+++ b/offload/include/Shared/Debug.h
@@ -271,10 +271,10 @@ struct DebugFilter {
struct DebugSettings {
bool Enabled = false;
uint32_t DefaultLevel = 1;
- // Types/Components in this list are not printed when debug is enabled
+ // Types/Components in this list are not printed when debug is enabled
// unless they are explicitly requested by the user in IncludeFilters.
llvm::SmallVector<StringRef> ExcludeFilters;
- // Types/Components in this list are printed when debug is enabled if
+ // Types/Components in this list are printed when debug is enabled if
// the debug level is equal or higher than the specified level.
llvm::SmallVector<DebugFilter> IncludeFilters;
};
@@ -315,11 +315,11 @@ struct DebugSettings {
Settings.Enabled = true;
// Messages with Type/Components added to the exclude list are not
- // not printed when debug is enabled unless they are explicitly
+ // not printed when debug is enabled unless they are explicitly
// requested by the user.
// Eventuall this should be configured from the upper layers but
// for now we can hardcode some excluded types here like:
- // Settings.ExcludeFilters.push_back(Type);
+ // Settings.ExcludeFilters.push_back(Type);
if (!EnvRef.getAsInteger(10, Settings.DefaultLevel))
return;
@@ -333,12 +333,12 @@ struct DebugSettings {
// Remove from ExcludeFilters if present
Settings.ExcludeFilters.erase(
- std::remove_if(Settings.ExcludeFilters.begin(),
- Settings.ExcludeFilters.end(),
- [&](StringRef OutType) {
- return OutType.equals_insensitive(Filter.Type);
- }),
- Settings.ExcludeFilters.end());
+ std::remove_if(Settings.ExcludeFilters.begin(),
+ Settings.ExcludeFilters.end(),
+ [&](StringRef OutType) {
+ return OutType.equals_insensitive(Filter.Type);
+ }),
+ Settings.ExcludeFilters.end());
Settings.IncludeFilters.push_back(Filter);
}
@@ -356,8 +356,7 @@ shouldPrintDebug(const char *Component, const char *Type, uint32_t &Level) {
return false;
for (const auto &Filter : Settings.ExcludeFilters) {
- if (Filter.equals_insensitive(Type) ||
- Filter.equals_insensitive(Component))
+ if (Filter.equals_insensitive(Type) || Filter.equals_insensitive(Component))
return false;
}
@@ -372,8 +371,7 @@ shouldPrintDebug(const char *Component, const char *Type, uint32_t &Level) {
for (const auto &DT : Settings.IncludeFilters) {
if (DT.Level < Level)
continue;
- if (DT.Type.equals_insensitive("all") ||
- DT.Type.equals_insensitive(Type) ||
+ if (DT.Type.equals_insensitive("all") || DT.Type.equals_insensitive(Type) ||
DT.Type.equals_insensitive(Component)) {
Level = DT.Level;
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/180538
More information about the llvm-commits
mailing list