Skip to content

Commit

Permalink
Fix more clang sanitizer false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Mar 7, 2024
1 parent 0287447 commit 19e56a2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/slang/ast/expressions/OperatorExpressions.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ class SLANG_EXPORT ConditionalExpression : public Expression {
Expression(ExpressionKind::ConditionalOp, type, sourceRange),
conditions(conditions), left_(&left), right_(&right), isConst(isConst), isTrue(isTrue) {}

const Expression& left() const { SLANG_SUPPRESS return *left_; }
const Expression& left() const { return *left_; } // NOLINT
Expression& left() { return *left_; }

const Expression& right() const { SLANG_SUPPRESS return *right_; }
const Expression& right() const { return *right_; } // NOLINT
Expression& right() { return *right_; }

ConstantValue evalImpl(EvalContext& context) const;
Expand Down
3 changes: 2 additions & 1 deletion include/slang/util/BumpAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//------------------------------------------------------------------------------
#pragma once

#include <cstring>
#include <new>
#include <span>

Expand Down Expand Up @@ -59,7 +60,7 @@ class SLANG_EXPORT BumpAllocator {
return {};

auto dest = reinterpret_cast<T*>(allocate(len * sizeof(T), alignof(T)));
memcpy(dest, src.data(), len * sizeof(T));
std::memcpy(dest, src.data(), len * sizeof(T));

return std::span<T>(dest, len);
}
Expand Down
2 changes: 0 additions & 2 deletions include/slang/util/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@
// Compiler-specific macros for warnings and suppressions
#ifdef __clang__
# define SLANG_NO_SANITIZE(warningName) __attribute__((no_sanitize(warningName)))
# define SLANG_SUPPRESS [[clang::suppress]]
#else
# define SLANG_NO_SANITIZE(warningName)
# define SLANG_SUPPRESS
#endif

using namespace std::literals;
Expand Down
10 changes: 5 additions & 5 deletions source/ast/symbols/InstanceSymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,11 +647,11 @@ void InstanceSymbol::fromSyntax(Compilation& comp, const HierarchyInstantiationS
if (specificInstance) {
results.push_back(builder.create(*specificInstance));
}
else
SLANG_SUPPRESS {
for (auto instanceSyntax : syntax.instances)
results.push_back(builder.create(*instanceSyntax));
}
else {
// NOLINTNEXTLINE
for (auto instanceSyntax : syntax.instances)
results.push_back(builder.create(*instanceSyntax));
}
};

// If we came here from a bind directive we need to make use
Expand Down
2 changes: 1 addition & 1 deletion source/numeric/Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ std::string TimeScaleValue::toString() const {

std::strong_ordering TimeScaleValue::operator<=>(const TimeScaleValue& rhs) const {
// Unit enum is specified in reverse order, so check in the opposite direction.
if (auto cmp = rhs.unit <=> unit; cmp != 0)
if (auto cmp = rhs.unit <=> unit; cmp != 0) // NOLINT
return cmp;
return magnitude <=> rhs.magnitude;
}
Expand Down
1 change: 1 addition & 0 deletions source/text/Glob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ SLANG_EXPORT GlobRank svGlob(const fs::path& basePath, std::string_view pattern,

static std::string_view nextSegment(std::string_view& path) {
for (size_t i = 0; i < path.size(); i++) {
// NOLINTNEXTLINE
if (path[i] == fs::path::preferred_separator || path[i] == '/') {
auto result = path.substr(0, i);
path = path.substr(i + 1);
Expand Down

0 comments on commit 19e56a2

Please sign in to comment.