[ROCProfiler SDK] Removing regex from the tool and output libraries (#170)

* Removing regex from the tool

* Adding alternative for regex regarding  handling

* Adding ROCpd

* Removing regex include

* Apply suggestion from @jomadsen_amdeng

Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>

* Apply suggestion from @jomadsen_amdeng

Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>

* Apply suggestion from @jomadsen_amdeng

Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>

* Adding Standalone Regex Header File

* Fixing Regex to handle grouping and

* Fixing Regex to handle grouping and

* Fixing Regex to handle grouping and

* Formatting Fix

* Update rocprofiler-sdk-restrictions.yml

* Separating regex.hpp to source and header & Adding Tests for parity with std::regex

* Update regex.cpp

* Using snake_case for naming and addressing some comments

* Adding more tests & README for regex implementation

* Updating rocprofiler sdk restrictions workflow

* Updating more tests & README for regex implementation

* Update README_regex.md

* Rename README_regex.md to README.md

---------

Co-authored-by: Ammar ELWazir <aelwazir@amd.com>
Co-authored-by: Elwazir, Ammar <Ammar.Elwazir@amd.com>
Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>
Bu işleme şunda yer alıyor:
systems-assistant[bot]
2025-08-27 12:30:12 -05:00
işlemeyi yapan: GitHub
ebeveyn 7055fbfc7f
işleme 2e50d88fe6
14 değiştirilmiş dosya ile 2127 ekleme ve 44 silme
+3 -13
Dosyayı Görüntüle
@@ -43,7 +43,6 @@
#include <cstring>
#include <ctime>
#include <fstream>
#include <regex>
#include <set>
#include <sstream>
#include <string>
@@ -56,16 +55,6 @@ namespace tool
{
namespace
{
const auto env_regexes =
new std::array<std::regex, 3>{std::regex{"(.*)%(env|ENV)\\{([A-Z0-9_]+)\\}%(.*)"},
std::regex{"(.*)\\$(env|ENV)\\{([A-Z0-9_]+)\\}(.*)"},
std::regex{"(.*)%q\\{([A-Z0-9_]+)\\}(.*)"}};
// env regex examples:
// - %env{USER}% Consistent with other output key formats (start+end with %)
// - $ENV{USER} Similar to CMake
// - %q{USER} Compatibility with NVIDIA
//
inline bool
not_is_space(int ch)
{
@@ -344,8 +333,9 @@ format_name(std::string_view _name, const config& _cfg)
if(!_cfg.demangle && !_cfg.truncate) return std::string{_name};
// truncating requires demangling first so always demangle
auto _demangled_name =
common::cxx_demangle(std::regex_replace(_name.data(), std::regex{"(\\.kd)$"}, ""));
if(auto kpos = _name.rfind(".kd"); kpos < _name.length() && kpos + 3 == _name.length())
_name = _name.substr(0, kpos);
auto _demangled_name = common::cxx_demangle(_name);
if(_cfg.truncate) return common::truncate_name(_demangled_name);