Skip to content

[compiler-rt][nsan] Remove unused checkValueConsistency template (NFC) - #207441

Merged
vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-nsan
Jul 4, 2026
Merged

vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-nsan

Conversation

@flash1729

Copy link
Copy Markdown
Member

checkValueConsistency is a static function template in nsan.cpp with no callers, so it trips -Wunused-template. Remove the dead code.

Part of #202945

    checkValueConsistency is a static function template in nsan.cpp with no
    callers, so it trips -Wunused-template. Remove the dead code. Part of llvm#202945
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Aditya Medhane (flash1729)

Changes

checkValueConsistency is a static function template in nsan.cpp with no callers, so it trips -Wunused-template. Remove the dead code.

Part of #202945


Full diff: https://github.com/llvm/llvm-project/pull/207441.diff

1 Files Affected:

  • (modified) compiler-rt/lib/nsan/nsan.cpp (-15)
diff --git a/compiler-rt/lib/nsan/nsan.cpp b/compiler-rt/lib/nsan/nsan.cpp
index 1c06340549aca..a05c84b09547d 100644
--- a/compiler-rt/lib/nsan/nsan.cpp
+++ b/compiler-rt/lib/nsan/nsan.cpp
@@ -328,21 +328,6 @@ static ValueType getValueType(u8 c) { return static_cast<ValueType>(c & 0x3); }
 
 static int getValuePos(u8 c) { return c >> kValueSizeSizeBits; }
 
-// Checks the consistency of the value types at the given type pointer.
-// If the value is inconsistent, returns ValueType::kUnknown. Else, return the
-// consistent type.
-template <typename FT>
-static bool checkValueConsistency(const u8 *shadow_type) {
-  const int pos = getValuePos(*shadow_type);
-  // Check that all bytes from the start of the value are ordered.
-  for (uptr i = 0; i < sizeof(FT); ++i) {
-    const u8 T = *(shadow_type - pos + i);
-    if (!(getValueType(T) == FTInfo<FT>::kValueType && getValuePos(T) == i))
-      return false;
-  }
-  return true;
-}
-
 // The instrumentation automatically appends `shadow_value_type_ids`, see
 // maybeAddSuffixForNsanInterface.
 extern "C" SANITIZER_INTERFACE_ATTRIBUTE void

@flash1729

Copy link
Copy Markdown
Member Author

cc @vgvassilev @alexander-shaposhnikov
deleted template seems to be unused since the initial nsan upstreaming in #94322

@alexander-shaposhnikov alexander-shaposhnikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@vgvassilev
vgvassilev merged commit db0f427 into llvm:main Jul 4, 2026
12 checks passed
@flash1729
flash1729 deleted the wunused-template-nsan branch August 7, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants