Add basic support for C++ files

Include C++ files when indexing and tokenizing files.

Unfortunately due to how C++ utilizes namespaces and classes, this
currently introduces a large amount of false positives for unqualified
identifiers that look the same.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
This commit is contained in:
Chen-Yu Tsai 2018-04-10 07:44:10 +00:00
parent 883281e446
commit 0ab49d012f
2 changed files with 3 additions and 3 deletions

View file

@ -65,7 +65,7 @@ def query (cmd, *args):
path = args[1]
ext = os.path.splitext(path)[1]
if ext == '.c' or ext == '.h':
if ext in ['.c', '.cc', '.cpp', '.h']:
tokens = scriptLines ('tokenize-file', version, path)
even = True
for tok in tokens:

View file

@ -75,7 +75,7 @@ def updateDefinitions (blobs):
filename = db.file.get (blob)
ext = os.path.splitext(filename)[1]
if not (ext == '.c' or ext == '.h'): continue
if ext not in ['.c', '.cc', '.cpp', '.h']: continue
lines = scriptLines ('parse-defs', hash, filename)
for l in lines:
@ -98,7 +98,7 @@ def updateReferences (blobs):
filename = db.file.get (blob)
ext = os.path.splitext(filename)[1]
if not (ext == '.c' or ext == '.h'): continue
if ext not in ['.c', '.cc', '.cpp', '.h']: continue
tokens = scriptLines ('tokenize-file', '-b', hash)
even = True