aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--README.md25
-rw-r--r--bruiser/README.md61
-rw-r--r--bruiser/autogen/wasm/ft/autowasm.c12
-rw-r--r--bruiser/lua-scripts/wasmtest.lua15
m---------cgrep0
-rw-r--r--m0/mutator-lvl0.cpp40
-rw-r--r--makefile10
-rw-r--r--obfuscator/README.md1
-rw-r--r--obfuscator/obfuscator.cpp3
-rw-r--r--safercpp/safercpp-arr.cpp14
11 files changed, 105 insertions, 79 deletions
diff --git a/.gitmodules b/.gitmodules
index c8ee260..1bda361 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -10,3 +10,6 @@
[submodule "bruiser/tablegen"]
path = bruiser/tablegen
url = https://github.com/bloodstalker/luatablegen
+[submodule "cgrep"]
+ path = cgrep
+ url = https://github.com/bloodstalker/cgrep
diff --git a/README.md b/README.md
index 933af31..1639a17 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@
- [Overview](#overview)
- [bruiser](#bruiser)
+ - [cgrep](#cgrep)
- [delf](#delf)
- [dwasm](#dwasm)
- [luatablegen](#luatablegen)
@@ -59,6 +60,13 @@ Essentially bruiser is a Lua REPL plus:
* Through the ASMRewriter functionality you can manipulate the machine code and push it back in the object. For more detail you can look at the wiki or check out bruiser's README.md.<br/>
* Luarocks: You can use your Luarocks modules/libraries in bruiser too. Just make sure `luarocks` is in your path and bruiser will take care of the rest.<br/>
+### cgrep
+cgrep is grep for c/c++ source files. simple as that.<br/>
+cgrep is added here as a submodule for more exposure. You can find the main repo [here](https://github.com/bloodstalker/cgrep).<br/>
+
+### obfuscator
+obfuscator is a C/C++ source code obfuscator.<br/>
+
### delf
`delf` is a custom ELF dump script developed for bruiser. bruiser uses it to interact with ELF files.<br/>
You can also use the script as a standalone to dump info on the ELF file to stdout.<br/>
@@ -73,9 +81,6 @@ dwasm is also hosted on a mirror repo [here](https://github.com/bloodstalker/dwa
`luatablegen` is a python script that takes a json file including the details of a C structure, and generates C source and header files, a lua file including some convinience fields for the lua table and a markdown file including a summary of the table fields and their expected arg types and return types.<br/>
luatablegen is also hosted on a mirror repo [here](https://github.com/bloodstalker/luatablegen).<br/>
-### obfuscator
-Is a C/C++ source code obfuscator.<br/>
-
### m0
Run static checks on the source code, which at the time of writing, includes SaferCpp, Misra-c:2004 and most of MSC2012 and MSC98 rules.<br/>
m0's reports are generated in XML,JSON and simple text(AWK-friendly:`RS="\n";FS=":"`. Look at `ReportPrintPretty.sh` under `extra-tools`.).<br/>
@@ -102,11 +107,11 @@ Excluding SaferCpp and other 3rd party code/libraries, everything else under pro
## How to get project mutator
Before you run make, make sure you have all the dependencies:<br/>
-* You need LLVM 4.0<(5 or 6 to be on the safe side).<br/>
+* You need LLVM 5, 6 or 8.<br/>
* For `safercpp` you will need to have LLVM RTTI also.<br/>
-* For `bruiser` you will need the python 3.5< dev package(source code and libpython), libcapstone, libkeystone and libffi.<br/>
+* For `bruiser` you will need the python 3.5 or higher's dev package(source code and libpython), libcapstone, libkeystone and libffi.<br/>
* The other libraries used are either submodules or copied inside.<br/>
-* `load.py` needs capstone. You can get it through pip.<br/>
+* `load.py` needs capstone. You can get it through pip(`pip install capstone`).<br/>
For More details you can look at the `Building` section.<br/>
Assuming you already have the dependencies:<br/>
@@ -117,12 +122,10 @@ git clone https://github.com/bloodstalker/mutator
git submodule init
git submodule update
make
-make install
```
-NOTE: `make install` currently wont copy binaries to /usr/local/bin or similar directories since mutator is in its early stages and I don't want to pollute your directories.<br/>
-mutator is also being hosted using [IPFS](https://github.com/ipfs/ipfs). To get it from IPFS just run:<br/>
+mutator is also being hosted using [IPFS](https://github.com/ipfs/ipfs) but it's never up-to-date. To get it from IPFS just run:<br/>
```bash
git clone https://ipfs.io/ipfs/QmdBBG76K5rNSWB4iK4ZhTtiZAkSsyDpiWzcPsPfnHY2ZA/mutator
@@ -141,7 +144,6 @@ Currently there is only the master branch which is the dev branch. All the as-of
### Dev Plans
* Bruiser: have bruiser support nested function calls and calls to external SOs.<br/>
-* Obfuscator: suppor for SHAKE128 and SHAKE256.<br/>
### Test Plans
@@ -155,6 +157,7 @@ Currently there is only the master branch which is the dev branch. All the as-of
## Announcements
+* Introducing cgrep, grep for c/c++ source files.<br/>
* I will be taking a one month break from mutator to learn/work on some other things.<br/>
* Project mutator will be re-licensed to GPL-3.0.<br/>
* bruiser has a working poc demo for asmrewriter.<br/>
@@ -180,7 +183,7 @@ Currently there is only the master branch which is the dev branch. All the as-of
If capstone and keystone are not included inside your distro's reposotory and you're lazy like me, take a look under `extra-tools`. There are two scripts(one for each) to get those for the Travis image. You can use those.<br/>
The other requirements are either directly included or have to be included through `git submodule update`.<br/>
-#### Linux and Mac
+#### Linux
First clone the repo and then initialize and update the submodule in it:<br/>
diff --git a/bruiser/README.md b/bruiser/README.md
index 44023e0..6d1b8d9 100644
--- a/bruiser/README.md
+++ b/bruiser/README.md
@@ -1,24 +1,55 @@
## bruiser
### What is it?
-Bruiser is implemented as an interactive commandline interface. It features an embedded Lua 5.3.4 interpreter plus the history and auto-completion and suggestion features we have all come to expect from shell-like tools.<br/>
+bruiser is a object-file manipulation tool implemented in C/C++ which provides its functionality through Lua.<br/>
Regarding the actual functionality:<br/>
-Xobj: pull in funtions from ELF objects, call them and get the result back.<br/>
-ASMrewriter: Allows manipulation of machine code.<br/>
-It will feature non-blind selective mutations. You can ask it to list information regrading the source codes it is run on. The eventuality of this idea is to help with maintaining code or in giving the viewer an overview of the code. The final feature is the name-sake. It looks at the code and decides how to break it. For more explanation please read on.<br/>
+Object file libraries: Object file manipulation libraries are implemented in C and wrapped for use in Lua.<br/>
+Xobj: Pull in funtions from ELF objects, call them and get the result back(basically ffi).<br/>
+ASMrewriter: Currently returns a table containing all the jumps in the x86-64 machine code.<br/>
+Ramdump: Get the memory of a running process.<br/>
For working demos you can skip to the end of the README.<br/>
### Building
-Running `make` from bruiser's make or `make bruiser` from the main makefile in the root directory of mutator will take care of that given that you already have all the requirements taken care of.<br/>
-It is generally a good idea to run `make deepclean` on bruiser's makefile on every pull since I occasionally have to make changes to Lua's sources or makefile.<br/>
+
+## Requirements
+* libffi<br/>
+* libcapstone<br/>
+* libkeystone<br/>
+* python 3.5(or higher) development packages<br/>
+* LLVM/Clang(5.0,6.0 or 8.0. 7.0 not supported)<br/>
+Other dependencies(lua, [faultreiber](https://github.com/bloodstalker/faultreiber), [luatablegen](https://github.com/bloodstalker/luatablegen), [linenoise](https://github.com/antirez/linenoise)) are self-contained.<br/>
+
+## Make
+Running `make` from bruiser's make or `make bruiser` from the main makefile in the root directory of mutator will take care of building bruiser given that you already taken care of all the requirements.<br/>
+It is generally a good idea to run `make deepclean` on bruiser's makefile on every pull since I occasionally have to make changes to Lua's sources, makefile or we need to re-generate the code-gen files.<br/>
+
+### User Engagement
+bruiser provides base-line functionality and libraries. The eventual goal is for users to use the baseline and provide more useful and abstracted functionalities in the form of lua libraries built on top of the bruiser environment and python plugins.<br/>
+So without user engagement bruiser is meaningless. Feel free to make suggestions on how I can make it more friendly for other people to get involved.<br/>
+
+### supported object file formats
+bruiser currently supports the following object formats:<br/>
+* WASM
+buirser will eventually support the following formats:<br/>
+* ELF
+* PE
+* Macho
+
+### Python pipe
+bruiser has a built-in python pipe. There are two reasons for it being there:<br/>
+* one, this way i can test some ideas in python instead of a hard c/c++ implementation which is faster.<br/>
+* two, eventually the python pipe is intended to act the same way as in gdb.<br/>
### How does it work?
-To put it simply, bruiser is an interactive lua interpreter that uses linenoise for shell-like features(history, tab-completion, auto-suggestion). You get the full power of lua plus the bruiser functions whcih are implemented as lua scripts that call back to the cpp code to get things done.<br/>
-To put this into perspective, think you run `list vars` in bruiser. It gets you the list of vars but that's it. You can't save them to a file or do anything else with them. With the old way of doing things I had to add a command that did that and then you could do it but what if you wanted to do something else? What then? Well you get the idea. That would also mean that bruiser's language would be made up gradually which would result in something ugly and warrant a lot of rewrites.<br/>
-With the new way of doing things, the user is only limited by their imagination and lua, not me, and there is no learning curve for learning a garbage language that I would have to come up with.<br/>
-Also, there is no reason to implement any extra features to be able to automate your use of bruiser. Just run a lua script and tell bruiser to run that.<br/>
-bruiser has a built-in pipe to Python so adding plugin python scripts are simple.(currently the pipe works only one-way)<br/>
+bruiser's main code is implemented in C++. The lower-level-interfacing parts are usually implemented in C. The object-file manipulation libraries are generated through two code-generators which make the code base more maintable.<br/>
+Currently bruiser used two code-generators, [faultreiber](https://github.com/bloodstalker/faultreiber) and [luatablegen](https://github.com/bloodstalker/luatablegen). faultreiber generates a binary file-format parser library for a given format. luatablegen wraps all the structures related to that file format for Lua. Both code generators can use the same XML file which provides them with the definition of the file format. As a disclaimer, I implemented both faultriber and luatablegen for bruiser but they are general-purpose and can work without the use of each other.<br/>
+bruiser also features a built-in Python3 pipe which currently allows you to call your python functions from bruiser(i.e. Lua). Eventually the python pipe will turn into a plugin-enabler for bruiser.<br/>
+
+#### Lua Defaults
+You can think of this as the bruiser dot file.<br/>
+Upon start-up, bruiser will look to find a file called `defaults.lua` in the same directory as the bruiser executable to run before running any user provided lua code, both in interactive and non-interactive modes. The path to the lua default file can be changed from the default value by the `LuaDefault` option passed to bruiser on startup.<br/>
+The current lua default script provided will run `luarocks path --bin` and add `paht` and `cpath` so that you can use your Lua modules from bruiser.<br/>
### Lua vs Luajit
For the first incarnation, bruiser will only support lua and not luajit. luajit is way faster than lua which will play an important role in bruiser's overall performance but luajit is generally less stable than lua and usually behind in terms of what new features of lua the language it supports.<br/>
@@ -27,11 +58,15 @@ The plan is to add both and for the user to be able to pick which one to use whe
### Warning
The current implementation loads all lua libraries which also includes it's `os` library. To give you an idea, `os.execute()` is very similar to `system()` in C. This decision has been made to speed up testing and the dev process.<br/>
Also like `mutatord` and `mutatorclient`, bruiser does not need any sudo access.<br/>
+briuser's executable expects to stay where it is originally built in, don't move it. use symlinks, aliases, ... whatever to suit your needs.<br/>
### Useful Lua Scripts
The dir named `lua-scripts` houses demos, examples and useful lua scripts for bruiser.<br/>
If you happen to write a Lua script for bruiser that you think other people will find useful, then please add it to `lua-scripts` on your fork and make a PR.<br/>
+### Run All Demos
+Run `run.sh` inside bruiser's directory. This will run all the demos buirser currently has, which at the time of writng include the xobj demo, the jump table demo, the disassembly demo and the wasm object demo.<br/>
+
### Examples
First you should clone the mutator repo and run `git submodule init` and `git submodule update` to get the third-party repos that enable mutator to run.<br/>
To build bruiser you can either run the makefile in bruiser's directory, then run `make` or just run the makefile at mutator's root directory and run `make bruiser`.<br/>
@@ -86,7 +121,3 @@ The ASMRewriter functionality allows you to look through the machine code and ma
For working examples which demonstrate how much the implementation has improved you can run `lua-scripts/demo2.lua` and `lua-scripts/df-demo.lua`. `demo2.lua` requires `ansicolor`. `df-demo.lua` uses the dwarf fortress executable as an example so you will have to first get that and then change the path in the lua file.<br/>
For more detailed information on the modules and the methods they provide, you can look at the wiki.<br/>
-
-#### Lua Defaults
-Upon start-up, bruiser will look to find a file called `defaults.lua` in the same directory as the bruiser executable to run before running any user provided lua code, both in interactive and non-interactive modes. The path to the lua default file could be changed from the default value by the `LuaDefault` option passed to bruiser on startup.<br/>
-The default script provided will run `luarocks path --bin` and add `paht` and `cpath` so that you can use your Lua modules from bruiser.<br/>
diff --git a/bruiser/autogen/wasm/ft/autowasm.c b/bruiser/autogen/wasm/ft/autowasm.c
index 043f220..42bf474 100644
--- a/bruiser/autogen/wasm/ft/autowasm.c
+++ b/bruiser/autogen/wasm/ft/autowasm.c
@@ -229,12 +229,12 @@ int main(int argc, char **argv) {
}
#endif
- //printf("sizeof magic:%d\n", sizeof(magic_number));
- //printf("sizeof version:%d\n", sizeof(version));
- //printf("current void count:%d\n", lib_ret->current_void_count);
- //printf("void_train first:0x%x\n", lib_ret->void_train[0]);
- //printf("void_train first:0x%x\n", lib_ret->void_train[1]);
- //printf("void_train self address:0x%x\n", lib_ret->void_train);
+ // printf("sizeof magic:%d\n", sizeof(magic_number));
+ // printf("sizeof version:%d\n", sizeof(version));
+ // printf("current void count:%d\n", lib_ret->current_void_count);
+ // printf("void_train first:0x%x\n", lib_ret->void_train[0]);
+ // printf("void_train first:0x%x\n", lib_ret->void_train[1]);
+ // printf("void_train self address:0x%x\n", lib_ret->void_train);
// free(lib_ret->void_train[0]);
// release_all(lib_ret->void_train, lib_ret->current_void_count);
// free(lib_ret->void_train[2]);
diff --git a/bruiser/lua-scripts/wasmtest.lua b/bruiser/lua-scripts/wasmtest.lua
index df59773..b863081 100644
--- a/bruiser/lua-scripts/wasmtest.lua
+++ b/bruiser/lua-scripts/wasmtest.lua
@@ -720,6 +720,7 @@ function libwasm.demo_setters(wasm_path)
local new_entry1 = W_Element_Segment(1, new_init1, 4, nil)
--FIXME--setting elems through the lua-implementation of the constructor will segfault
--on access. doing the same constructor in c should fix this.
+ --TODO maybe passing a single elem as a lua table fixes this?
new_entry1:set_elems({10,20,30,40})
print(new_entry1:index())
print(new_entry1:num_length())
@@ -796,7 +797,7 @@ function libwasm.demo_setters(wasm_path)
io.write(colors("%{green}".."code_section:count:pass\n"))
end
- --FIXME-entries
+ a["code_section"]:set_count(3)
local l_entry1 = W_Local_Entry(1 ,1)
local l_entry2 = W_Local_Entry(1 ,1)
local l_entry3 = W_Local_Entry(1 ,1)
@@ -806,9 +807,11 @@ function libwasm.demo_setters(wasm_path)
body1:set_code({12,13,11})
body2:set_code({12,13,11})
body3:set_code({12,13,11})
- body1:set_locals(l_entry1)
- --body2:set_locals(l_entry2)
- --body3:set_locals(l_entry3)
+ --FIXME-library requires you to pass a table for locals even if
+ --the count is one
+ body1:set_locals({l_entry1})
+ body2:set_locals({l_entry2})
+ body3:set_locals({l_entry3})
local new_bodies = {}
new_bodies[1] = body1
new_bodies[2] = body2
@@ -910,8 +913,8 @@ end
--libwasm.dev("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
--libwasm.demo_getters("/home/bloodstalker/extra/faultreiber/test/read.wasm")
-libwasm.demo_getters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/test/read.wasm")
---libwasm.demo_setters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
+--libwasm.demo_getters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/test/read.wasm")
+libwasm.demo_setters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
--libwasm.dump_all("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
return libwasm
diff --git a/cgrep b/cgrep
new file mode 160000
+Subproject d799662f0ee5b98937eb5d88228706f3bd04e4b
diff --git a/m0/mutator-lvl0.cpp b/m0/mutator-lvl0.cpp
index d8dfc46..f6663dd 100644
--- a/m0/mutator-lvl0.cpp
+++ b/m0/mutator-lvl0.cpp
@@ -5436,41 +5436,19 @@ class SFCPPARR02SUB : public MatchFinder::MatchCallback
if (MR.Nodes.getNodeAs<clang::DeclRefExpr>("sfcpp02sub") != nullptr)
{
const DeclRefExpr* DRE = MR.Nodes.getNodeAs<clang::DeclRefExpr>("sfcpp02sub");
-
SourceManager *const SM = MR.SourceManager;
-
SourceLocation SL = DRE->DEVI_GETLOCSTART();
CheckSLValidity(SL);
- //SL = Devi::SourceLocationHasMacro(SL, Rewrite, "start");
SL = SM->getSpellingLoc(SL);
-
- if (Devi::IsTheMatchInSysHeader(CheckSystemHeader, MR, SL))
- {
- return void();
- }
-
- if (!Devi::IsTheMatchInMainFile(MainFileOnly, MR, SL))
- {
- return void();
- }
-
+ if (Devi::IsTheMatchInSysHeader(CheckSystemHeader, MR, SL)) {return void();}
+ if (!Devi::IsTheMatchInMainFile(MainFileOnly, MR, SL)) {return void();}
const NamedDecl* ND = DRE->getFoundDecl();
-
SourceLocation OriginSL = ND->DEVI_GETLOCSTART();
CheckSLValidity(OriginSL);
- //OriginSL = Devi::SourceLocationHasMacro(OriginSL, Rewrite, "start");
OriginSL = SM->getSpellingLoc(OriginSL);
-
StringRef OriginFileName [[maybe_unused]] = SM->getFilename(OriginSL);
-#if 0
- std::cout << "GarbageOut" << ":" << "Origin:" << DRE->getFoundDecl()->getName().str() << "\n";
- std::cout << "GarbageOut" << ":" << "Origin:" << ExtOriginFileName.str() << ":" << "Proto:" << OriginFileName.str() << "\n";
- std::cout << "GarbageOut" << ":" << "Origin:" << ExtOriginSL.printToString(*SM) << ":" << "Proto:" << OriginSL.printToString(*SM) << "\n";
-#endif
-
- if (OriginSL == ExtOriginSL && OriginFileName == ExtOriginFileName)
- {
+ if (OriginSL == ExtOriginSL && OriginFileName == ExtOriginFileName) {
std::cout << "SaferCPP01" << ":" << "Native Array used - pointer points to an array:" << SL.printToString(*MR.SourceManager) << ":" << DRE->getFoundDecl()->getName().str() << "\n";
}
@@ -5508,29 +5486,17 @@ class SFCPPARR02 : public MatchFinder::MatchCallback
if (MR.Nodes.getNodeAs<clang::DeclRefExpr>("sfcpparrdeep") != nullptr)
{
const DeclRefExpr* DRE = MR.Nodes.getNodeAs<clang::DeclRefExpr>("sfcpparrdeep");
-
ASTContext *const ASTC = MR.Context;
-
SourceManager *const SM = MR.SourceManager;
-
SourceLocation SL = DRE->DEVI_GETLOCSTART();
CheckSLValidity(SL);
SL = SM->getSpellingLoc(SL);
-
const NamedDecl* ND = DRE->getFoundDecl();
-
StringRef NDName = ND->getName();
-
SubHandler.setOriginSourceLocation(SM->getSpellingLoc(ND->DEVI_GETLOCSTART()));
SubHandler.setOriginFileName(SM->getFilename(SM->getSpellingLoc(ND->DEVI_GETLOCSTART())));
-
Matcher.addMatcher(declRefExpr(to(varDecl(hasName(NDName.str())))).bind("sfcpp02sub"), &SubHandler);
-
Matcher.matchAST(*ASTC);
-
-#if 0
- std::cout << "GarbageOutOrigin" << ":" << "GarbageOutOrigin:" << SL.printToString(*MR.SourceManager) << ":" << NDName.str() << "\n";
-#endif
}
}
diff --git a/makefile b/makefile
index 2db454b..30e15b8 100644
--- a/makefile
+++ b/makefile
@@ -10,12 +10,13 @@ TARGETS=mutatorserver
SFCPP01=safercpp-arr
BRUISER=bruiser
OBSC=obfuscator
+CGREP=cgrep
.DEFAULT: all
-.PHONY:all clean install help $(BRUISER) $(OBSC) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01)
+.PHONY:all clean install help $(BRUISER) $(OBSC) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01) $(CGREP)
-all: $(TARGET0) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01) $(BRUISER) $(OBSC)
+all: $(TARGET0) $(TARGETC) $(TARGETD) $(TARGETS) $(SFCPP01) $(BRUISER) $(OBSC) $(CGREP)
$(TARGET1):
$(CXX) $^ $(LD_FLAGS) -o $@
@@ -35,6 +36,9 @@ $(BRUISER):
$(OBSC):
$(MAKE) -C obfuscator CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
+$(CGREP):
+ $(MAKE) -C cgrep CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
+
$(TARGETC):
$(MAKE) -C daemon mutatorclient
@@ -52,11 +56,13 @@ clean:
$(MAKE) -C bruiser clean
$(MAKE) -C obfuscator clean
$(MAKE) -C m0 clean
+ $(MAKE) -C cgrep clean
deepclean: clean
$(MAKE) -C bruiser deepclean
$(MAKE) -C m0 deepclean
$(MAKE) -C obfuscator deepclean
+ $(MAKE) -C cgrep deepclean
install:
chmod +x ./mutator.sh
diff --git a/obfuscator/README.md b/obfuscator/README.md
index 5ab0937..31492d3 100644
--- a/obfuscator/README.md
+++ b/obfuscator/README.md
@@ -1,6 +1,7 @@
# obfuscator
obfuscator is a C/C++ source-code obfuscation tool.<br/>
+obfuscator can use SHAKE128 and SHAKE256 to generate hash digests.<br/>
## Status
You can find a list of the implemented features and the ones that will be implemented below.<br/>
diff --git a/obfuscator/obfuscator.cpp b/obfuscator/obfuscator.cpp
index b56ded9..4ea03e1 100644
--- a/obfuscator/obfuscator.cpp
+++ b/obfuscator/obfuscator.cpp
@@ -399,8 +399,7 @@ class ClassDecl : public MatchFinder::MatchCallback {
/**
* @brief PPCallbacks for replacing Macro identifiers with their hash digest Along with changing the Header filenames.
*/
-class PPInclusion : public PPCallbacks
-{
+class PPInclusion : public PPCallbacks {
public:
explicit PPInclusion (SourceManager *SM, Rewriter *Rewrite) : SM(*SM), Rewrite(*Rewrite) {}
diff --git a/safercpp/safercpp-arr.cpp b/safercpp/safercpp-arr.cpp
index 99bd3a5..0cae89b 100644
--- a/safercpp/safercpp-arr.cpp
+++ b/safercpp/safercpp-arr.cpp
@@ -6836,6 +6836,7 @@ class MyPPCallbacks : public PPCallbacks
public:
MyPPCallbacks(Rewriter& Rewriter_ref, CompilerInstance &CI_ref) : m_Rewriter_ref(Rewriter_ref), CI(CI_ref) {}
+#if __clang_major__ <= 6
void InclusionDirective(
SourceLocation hash_loc,
const Token &include_token,
@@ -6846,6 +6847,19 @@ public:
StringRef search_path,
StringRef relative_path,
const clang::Module *imported) override {
+#elif __clang_major__ >= 8
+ virtual void InclusionDirective (
+ SourceLocation hash_loc,
+ const Token &include_token,
+ StringRef file_name,
+ bool is_angled,
+ CharSourceRange filename_range,
+ const FileEntry *file,
+ StringRef search_path,
+ StringRef relative_path,
+ const clang::Module *imported,
+ SrcMgr::CharacteristicKind file_type) override {
+#endif
if (current_fii_shptr()) {
if (!(current_fii_shptr()->m_first_include_directive_loc_is_valid)) {