p-ranav / fccf

fccf: A command-line tool that quickly searches through C/C++ source code in a directory based on a search string and prints relevant code snippets that match the query.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to skip forward class declarations.

mibli opened this issue · comments

Currently searching especially in large code bases can make the fccf process a lot of files.

Use case: User wants to search for a class Bunny in the code.
Execution: fccf -C Bunny
Expected behavior:

// ./Animals/Fun/Bunny.cpp (Line: 24 to 29)
struct Bunny {
  bool plushy;
  Color eyeColor;
  Color furColor;
}

Actual Behavior:

// ./Animals/Predators/Wolf.cpp (Line: 20 to 20)
class Bunny

// ./Farm/Fur/BunnyFarm.cpp (Line: 20 to 20)
class Bunny

... etc

It would be nice to have -C skip forward declarations, or have an option to skip them. If there's such an option I haven't found it. Not only it would help get user what he wants, but it would reduce search times significantly.
On a large code base (~3mln LoC) that optimizes with forward class declarations, looking up a class can take up to 10 minutes. If these wouldn't be matched, it would take up to few seconds.

The point is it to be different than --isl, because --isl still has to precompile the code as far as I understand.