From 4f5417b9bee0baa3069786a2edcd70047e454ae9 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sun, 11 Nov 2018 22:52:51 +0330 Subject: update --- cgrep.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cgrep.cpp b/cgrep.cpp index d34dc58..410f5d8 100644 --- a/cgrep.cpp +++ b/cgrep.cpp @@ -54,6 +54,7 @@ cl::opt CO_MACRO("macro", cl::desc("match macro definitions"), cl::init(fa cl::opt CO_HEADER("header", cl::desc("match headers in header inclusions"), cl::init(false), cl::cat(CGrepCat), cl::Optional); cl::opt CO_ALL("all", cl::desc("turns on all switches other than nameddecl"), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt CO_NAMEDDECL("nameddecl", cl::desc("matches all named declrations"), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done +cl::opt CO_AWK("awk", cl::desc("outputs location in a gawk freidnly format"), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt CO_SYSHDR("syshdr", cl::desc("match identifiers in system header as well"), cl::init(false), cl::cat(CGrepCat), cl::Optional); //done cl::opt CO_MAINFILE("mainfile", cl::desc("mathc identifiers in the main file only"), cl::init(true), cl::cat(CGrepCat), cl::Optional); //done } @@ -80,6 +81,14 @@ bool regex_handler(std::string rx_str, std::string identifier_name) { std::smatch result; return std::regex_search(identifier_name, result, rx); } + +std::string output_handler(SourceLocation SL, SourceManager &SM) { + return SL.printToString(SM); +} + +std::string output_handler(SourceRange SR, SourceManager &SM) { + return SR.getBegin().printToString(SM); +} /*************************************************************************************************/ class FunctionHandler : public MatchFinder::MatchCallback { public: -- cgit v1.2.3