Skip to content

Commit

Permalink
handle comments in config files
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbs96 committed Aug 25, 2024
1 parent fe2f54d commit 82d5a96
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Config/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,14 @@ bool PhasarConfig::loadConfigFileInto(llvm::StringRef FileName,
llvm::SmallVector<llvm::StringRef, 0> ConfigLines;
llvm::SplitString(*ConfigFile, ConfigLines, "\n");

llvm::transform(ConfigLines, std::inserter(Lines, Lines.end()),
[](llvm::StringRef Str) { return Str.trim().str(); });
llvm::transform(
ConfigLines, std::inserter(Lines, Lines.end()), [](llvm::StringRef Str) {
if (auto Comment = Str.find("//"); Comment != llvm::StringRef::npos) {
Str = Str.slice(0, Comment);
}
return Str.trim().str();
});

return true;
}

Expand Down

0 comments on commit 82d5a96

Please sign in to comment.