From 96381d1cb8ba07b27f52c019efd41ce5d00ea352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=20Schr=C3=B6der?= Date: Wed, 28 Oct 2020 01:44:36 +0100 Subject: Fix spelling mistakes --- README.md | 18 +++++++++--------- cgrep.cpp | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 3a12352..177dbdd 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ The makefile assumes clang is called `clang` and llvm-config is called `llvm-con make CXX=clang-9 LLVM_CONF=llvm-config-9 ``` -For windows builds, cygwin builds are supported. Get llvm and clang along with their sources and build like usual. If you run into problems while bulding on cygwin, you can take a look at the `appveyor.yml` file under the repository root. +For windows builds, cygwin builds are supported. Get llvm and clang along with their sources and build like usual. If you run into problems while building on cygwin, you can take a look at the `appveyor.yml` file under the repository root. ## Usage @@ -86,11 +86,11 @@ cgrep -A 1 -B 1 --func --declrefexpr --regex n[aA]m --nocolor --nodecl ./myaweso In order for cgrep to work, you need to have a compilation database, tools like `cmake` can generate one for you.
You can, by all means, run cgrep without a compilation database but whether that works or not really depends on your source file. Can you build your source file with clang without passing it any options? -If the answer to that is yes, then you can just run cgrep without a compilation databse like so:
+If the answer to that is yes, then you can just run cgrep without a compilation database like so:
```bash cgrep -A 1 -B 1 --func --declrefexpr --regex n[aA]m --nocolor --nodecl ./myawesomecode.cpp -- ``` -the `--` at the end is an explicit way of saying that you will not be providing a compialtion database. Newer versions of clang will try to still go through with the compilation even if there is no compilaiton database found. +the `--` at the end is an explicit way of saying that you will not be providing a compilation database. Newer versions of clang will try to still go through with the compilation even if there is no compilation database found. Otherwise you need a compilation database.
Please do note that the regex will pass through both C++ and the regex engine, so if you would want to escape `\`, the regex you pass as the command line arg would be `\\\\` instead of the normal `\\`.
@@ -112,14 +112,14 @@ For an up-to-date list, you can run `cgrep --help` or look at the man page. ```bash -A= - Same as grep, how many lines after the matched line to print. Defaults to 0. - -B= - Same as grep, howm many lines before the matched line to print. Defaults to 0. + -B= - Same as grep, how many lines before the matched line to print. Defaults to 0. --all - Turns on all switches other than nameddecl. - --awk - Outputs location in a gawk freidnly format, not meant for human consumption. Defaults to false. + --awk - Outputs location in a gawk friendly format, not meant for human consumption. Defaults to false. --call - Match function calls. - --class - Match class declrations. + --class - Match class declarations. --cxxcall - Match member function calls. --declrefexpr - Matches declrefexpr. - --dir= - recursively goes through all the files and directories. assumes compilation databases are present for all source files. + --dir= - Recursively goes through all the files and directories. Assumes compilation databases are present for all source files. --extra-arg= - Additional argument to append to the compiler command line --extra-arg-before= - Additional argument to prepend to the compiler command line --func - Match functions. @@ -128,8 +128,8 @@ For an up-to-date list, you can run `cgrep --help` or look at the man page. --mainfile - Match identifiers in the main file only. Defaults to true. --memfunc - Match member functions. --memvar - Match member variables. - --nameddecl - Matches all named declrations. - --nocolor - For terminals that don't supprt ANSI escape sequences. The default is to false. + --nameddecl - Matches all named declarations. + --nocolor - For terminals that don't support ANSI escape sequences. The default is to false. --nodecl - For switches that are not declarations, don't print declarations. Defaults to false. -p= - Build path --recorddecl - Match a record declaration. diff --git a/cgrep.cpp b/cgrep.cpp index 9f685ad..91e6641 100644 --- a/cgrep.cpp +++ b/cgrep.cpp @@ -40,7 +40,7 @@ namespace { static llvm::cl::OptionCategory CGrepCat("cgrep options"); cl::opt CO_RECURSIVE( "dir", - cl::desc("recursively goes through all the files and directories. assumes " + cl::desc("Recursively goes through all the files and directories. Assumes " "compilation databases are present for all source files."), cl::init(""), cl::cat(CGrepCat), cl::Optional); cl::opt CO_REGEX("regex", cl::desc("The regex to match against."), @@ -66,7 +66,7 @@ cl::opt CO_CXXCALL("cxxcall", cl::desc("Match member function calls."), cl::opt CO_CFIELD("cfield", cl::desc("Match C field declarations."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done -cl::opt CO_CLASS("class", cl::desc("Match class declrations."), +cl::opt CO_CLASS("class", cl::desc("Match class declarations."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt CO_STRUCT("struct", cl::desc("Match structures."), @@ -98,7 +98,7 @@ 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::desc("Matches all named declarations."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt CO_DECLREFEXPR("declrefexpr", cl::desc("Matches declrefexpr."), @@ -106,11 +106,11 @@ cl::opt CO_DECLREFEXPR("declrefexpr", cl::desc("Matches declrefexpr."), cl::Optional); // done cl::opt CO_AWK("awk", - cl::desc("Outputs location in a gawk freidnly format, not meant for " + cl::desc("Outputs location in a gawk friendly format, not meant for " "human consumption. Defaults to false."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt CO_NOCOLOR("nocolor", - cl::desc("For terminals that don't supprt ANSI escape " + cl::desc("For terminals that don't support ANSI escape " "sequences. The default is to false."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done @@ -134,7 +134,7 @@ cl::opt CO_A("A", "line to print. Defaults to 0."), cl::init(0), cl::cat(CGrepCat), cl::Optional); // done cl::opt CO_B("B", - cl::desc("Same as grep, howm many lines before the matched " + cl::desc("Same as grep, how many lines before the matched " "line to print. Defaults to 0."), cl::init(0), cl::cat(CGrepCat), cl::Optional); // done } // namespace @@ -228,7 +228,7 @@ bool regex_handler(std::string rx_str, std::string identifier_name) { * @param MR match result * @param SR source range for the matched result * @param SM sourcemanager - * @param isdecl is the matched result a delaration + * @param isdecl is the matched result a declaration * @param DTN the matched result cast to a dynamically typed node */ void output_handler(const MatchFinder::MatchResult &MR, SourceRange SR, @@ -295,7 +295,7 @@ void output_handler(const MatchFinder::MatchResult &MR, SourceRange SR, /** * @brief Gets the list of all directories and sub-directories starting from a * base directory. - * @param _path where the the base directory is. + * @param _path where the base directory is. * @return Returns the list of all found dirs. */ std::vector listDirs(std::string path) { -- cgit v1.2.3