aboutsummaryrefslogtreecommitdiffstats
path: root/cgrep.cpp
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-11-11 19:22:51 +0000
committerbloodstalker <thabogre@gmail.com>2018-11-11 19:22:51 +0000
commit4f5417b9bee0baa3069786a2edcd70047e454ae9 (patch)
treea18a8f065b3a8dfa603422ce518d49db274c6f6f /cgrep.cpp
parentreadme update (diff)
downloadcgrep-4f5417b9bee0baa3069786a2edcd70047e454ae9.tar.gz
cgrep-4f5417b9bee0baa3069786a2edcd70047e454ae9.zip
update
Diffstat (limited to 'cgrep.cpp')
-rw-r--r--cgrep.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/cgrep.cpp b/cgrep.cpp
index d34dc58..410f5d8 100644
--- a/cgrep.cpp
+++ b/cgrep.cpp
@@ -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: