Created
March 4, 2013 01:58
-
-
Save rizzatti/5079386 to your computer and use it in GitHub Desktop.
Workaround for header files and compilation database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import ycm_core | |
from clang_helpers import PrepareClangFlags | |
DATABASE_FOLDER = '/Users/zeh/code/zed/build' | |
DATABASE = ycm_core.CompilationDatabase(DATABASE_FOLDER) | |
EXTRA_FLAGS = [ | |
'-isystem', | |
'/usr/lib/c++/v1', | |
'-isystem', | |
'usr/include/c++/4.2.1', | |
'-isystem', | |
'/usr/include/c++/4.2.1/ext', | |
] | |
def FlagsForFile(filename): | |
isHeader = filename.endswith('.hpp') | |
filename = re.sub(r"(_p)?\.hpp$", ".cpp", filename) | |
info = DATABASE.GetCompilationInfoForFile(filename) | |
flags = PrepareClangFlags(info.compiler_flags_, filename) | |
if isHeader: | |
flags.extend(EXTRA_FLAGS) | |
return { | |
'flags': flags, | |
'do_cache': True | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment