Skip to content

Commit 86f40c8

Browse files
authored
Update llvm version for C tokenizer (#14)
* update print statement * update llvm version
1 parent 1c1dd67 commit 86f40c8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

compare_hashes/compare_hashes.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,20 @@ int main(int argc, char* argv[]) {
207207
std::map<Submission,std::map<int,std::map<Submission, std::vector<Sequence> > > > suspicious;
208208

209209
int my_counter = 0;
210-
210+
int my_percent = 0;
211+
211212
// ---------------------------------------------------------------------------
212213
// walk over the structure containing all of the hashes identifying
213214
// common to many/all, provided code, suspicious matches, and unique code
214215
for (hashed_sequences::iterator itr = hash_counts.begin(); itr != hash_counts.end(); itr++) {
215216
int count = itr->second.size();
216217

217218
my_counter++;
218-
219-
std::cout << "hash walk " << hash_counts.size() << " " << my_counter << std::endl;
220-
219+
int percent = (int) (100 * (my_counter / float(hash_counts.size())));
220+
if (percent > my_percent) {
221+
std::cout << "hash walk " << percent << "% complete" << std::endl;
222+
my_percent = percent;
223+
}
221224
if (count > threshold) {
222225
// common to many/all
223226
for (std::map<std::string,std::vector<Sequence> >::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); itr2++) {

tokenizer/c/c_tokenizer.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
# copy the concatenated file to the temporary file location
1515
shutil.copy(sys.argv[1],tmp_cpp_file_name)
1616

17-
clang.cindex.Config.set_library_file("/usr/lib/llvm-3.8/lib/libclang-3.8.so.1")
17+
if (os.path.isfile("/usr/lib/llvm-6.0/lib/libclang.so.1")):
18+
clang.cindex.Config.set_library_file("/usr/lib/llvm-6.0/lib/libclang.so.1")
19+
elif (os.path.isfile("/usr/lib/llvm-3.8/lib/libclang-3.8.so.1")):
20+
clang.cindex.Config.set_library_file("/usr/lib/llvm-3.8/lib/libclang-3.8.so.1")
1821
idx = clang.cindex.Index.create()
1922

2023
# parse the input file

0 commit comments

Comments
 (0)