diff options
author | bloodstalker <thabogre@gmail.com> | 2018-11-11 19:22:51 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-11-11 19:22:51 +0000 |
commit | 4f5417b9bee0baa3069786a2edcd70047e454ae9 (patch) | |
tree | a18a8f065b3a8dfa603422ce518d49db274c6f6f | |
parent | readme update (diff) | |
download | cgrep-4f5417b9bee0baa3069786a2edcd70047e454ae9.tar.gz cgrep-4f5417b9bee0baa3069786a2edcd70047e454ae9.zip |
update
-rw-r--r-- | cgrep.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -54,6 +54,7 @@ cl::opt<bool> CO_MACRO("macro", cl::desc("match macro definitions"), cl::init(fa cl::opt<bool> CO_HEADER("header", cl::desc("match headers in header inclusions"), cl::init(false), cl::cat(CGrepCat), cl::Optional); cl::opt<bool> CO_ALL("all", cl::desc("turns on all switches other than nameddecl"), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt<bool> CO_NAMEDDECL("nameddecl", cl::desc("matches all named declrations"), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done +cl::opt<bool> CO_AWK("awk", cl::desc("outputs location in a gawk freidnly format"), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt<bool> CO_SYSHDR("syshdr", cl::desc("match identifiers in system header as well"), cl::init(false), cl::cat(CGrepCat), cl::Optional); //done cl::opt<bool> 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: |