Skip to content

Commit

Permalink
Fix clang-sanitize build
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Feb 23, 2024
1 parent 80d0a3c commit aa15c24
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions include/slang/driver/SourceLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class SLANG_EXPORT SourceLoader {
/// in the library of that name; otherwise it will be included in the
/// default library and be considered a non-library unit.
void addSeparateUnit(std::span<const std::string> filePatterns,
std::vector<std::string> includePaths, std::vector<std::string> defines,
std::string libraryName);
const std::vector<std::string>& includePaths,
std::vector<std::string> defines, const std::string& libraryName);

/// Returns a list of all library map syntax trees that have been loaded and parsed.
const SyntaxTreeList& getLibraryMaps() const { return libraryMapTrees; }
Expand Down
5 changes: 1 addition & 4 deletions source/ast/symbols/CompilationUnitSymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,6 @@ void DefinitionSymbol::serializeTo(ASTSerializer& serializer) const {
if (timeScale)
serializer.write("timeScale", timeScale->toString());

auto scope = getParentScope();
SLANG_ASSERT(scope);

if (!sourceLibrary.isDefault)
serializer.write("sourceLibrary", sourceLibrary.name);
}
Expand Down Expand Up @@ -429,7 +426,7 @@ ConfigBlockSymbol& ConfigBlockSymbol::fromSyntax(const Scope& scope,
InstanceOverride io;
io.path = pathBuf.copy(comp);
io.rule = buildRule(*icr.ruleClause);
instOverrides.emplace_back(std::move(io));
instOverrides.emplace_back(io);
break;
}
default:
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 @@ -389,18 +389,18 @@ void InstanceSymbol::fromSyntax(Compilation& comp, const HierarchyInstantiationS
// node will be created in one go.
auto createInstances = [&](const Symbol* def,
const HierarchicalInstanceSyntax* specificInstance,
const ConfigRule* configRule) {
const ConfigRule* confRule) {
if (!def) {
UninstantiatedDefSymbol::fromSyntax(comp, syntax, specificInstance, context, results,
implicitNets, implicitNetNames, netType);
return;
}

auto addDiag = [&](DiagCode code) -> Diagnostic& {
if (configRule) {
if (confRule) {
SLANG_ASSERT(specificInstance);
auto& diag = context.addDiag(code, specificInstance->sourceRange());
diag.addNote(diag::NoteConfigRule, configRule->sourceRange);
diag.addNote(diag::NoteConfigRule, confRule->sourceRange);
return diag;
}
else {
Expand Down Expand Up @@ -458,8 +458,8 @@ void InstanceSymbol::fromSyntax(Compilation& comp, const HierarchyInstantiationS
if (syntax.parameters)
paramBuilder.setAssignments(*syntax.parameters);

auto instConfigRule = configRule;
if (!configRule && parentInst && parentInst->parentInstance)
auto instConfigRule = confRule;
if (!confRule && parentInst && parentInst->parentInstance)
instConfigRule = parentInst->parentInstance->configRule;

InstanceBuilder builder(context, definition, paramBuilder, parentOverrideNode,
Expand Down
7 changes: 4 additions & 3 deletions source/driver/SourceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ void SourceLoader::addLibraryMaps(std::string_view pattern, const fs::path& base
}

void SourceLoader::addSeparateUnit(std::span<const std::string> filePatterns,
std::vector<std::string> includePaths,
std::vector<std::string> defines, std::string libraryName) {
const std::vector<std::string>& includePaths,
std::vector<std::string> defines,
const std::string& libraryName) {
std::error_code ec;
SmallVector<fs::path> includeDirs;
for (auto& str : includePaths)
Expand All @@ -90,7 +91,7 @@ void SourceLoader::addSeparateUnit(std::span<const std::string> filePatterns,
unit.includePaths.emplace_back(std::move(path));

const bool isLibraryFile = unit.library != nullptr;
for (auto pattern : filePatterns) {
for (auto& pattern : filePatterns) {
addFilesInternal(pattern, {}, isLibraryFile, unit.library, &unit,
/* expandEnvVars */ false);
}
Expand Down

0 comments on commit aa15c24

Please sign in to comment.