From 82d5a96ebb73c31bbdbdce0b6f963a05326df35c Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Sun, 25 Aug 2024 11:47:24 +0200 Subject: [PATCH] handle comments in config files --- lib/Config/Configuration.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Config/Configuration.cpp b/lib/Config/Configuration.cpp index 8e9708f94..73e02d2b1 100644 --- a/lib/Config/Configuration.cpp +++ b/lib/Config/Configuration.cpp @@ -136,8 +136,14 @@ bool PhasarConfig::loadConfigFileInto(llvm::StringRef FileName, llvm::SmallVector 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; }