Skip to content

Commit 71d03f3

Browse files
committed
Project import generated by Copybara.
GitOrigin-RevId: 318483224ad6164d9966f731d60cde37039bb2d4
0 parents  commit 71d03f3

File tree

622 files changed

+381353
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

622 files changed

+381353
-0
lines changed

.clang-format

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None # All
15+
AllowShortIfStatementsOnASingleLine: false # true
16+
AllowShortLoopsOnASingleLine: false # true
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: true
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
AfterExternBlock: false
33+
BeforeCatch: false
34+
BeforeElse: false
35+
IndentBraces: false
36+
SplitEmptyFunction: true
37+
SplitEmptyRecord: true
38+
SplitEmptyNamespace: true
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeBraces: Attach
41+
BreakBeforeInheritanceComma: true # false
42+
BreakBeforeTernaryOperators: true
43+
BreakConstructorInitializersBeforeComma: true # false
44+
BreakConstructorInitializers: BeforeComma # BeforeColon
45+
# BreakAfterJavaFieldAnnotations: false
46+
BreakStringLiterals: true
47+
ColumnLimit: 120 # 80
48+
CommentPragmas: '^ IWYU pragma:'
49+
CompactNamespaces: false
50+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
51+
ConstructorInitializerIndentWidth: 4
52+
ContinuationIndentWidth: 4
53+
Cpp11BracedListStyle: true
54+
DerivePointerAlignment: true
55+
DisableFormat: false
56+
ExperimentalAutoDetectBinPacking: false
57+
FixNamespaceComments: true
58+
# ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
59+
IndentCaseLabels: true
60+
IndentPPDirectives: None
61+
IndentWidth: 2
62+
IndentWrappedFunctionNames: false
63+
# JavaScriptQuotes: Leave
64+
# JavaScriptWrapImports: true
65+
KeepEmptyLinesAtTheStartOfBlocks: false
66+
MacroBlockBegin: ''
67+
MacroBlockEnd: ''
68+
MaxEmptyLinesToKeep: 1
69+
NamespaceIndentation: None
70+
# ObjCBlockIndentWidth: 2
71+
# ObjCSpaceAfterProperty: false
72+
# ObjCSpaceBeforeProtocolList: false
73+
PenaltyBreakAssignment: 2
74+
PenaltyBreakBeforeFirstCallParameter: 1
75+
PenaltyBreakComment: 300
76+
PenaltyBreakFirstLessLess: 120
77+
PenaltyBreakString: 1000
78+
PenaltyExcessCharacter: 1000000
79+
PenaltyReturnTypeOnItsOwnLine: 200
80+
PointerAlignment: Left
81+
ReflowComments: false # true
82+
SortIncludes: false # disabled, because we need case insensitive sort
83+
SortUsingDeclarations: false # true
84+
SpaceAfterCStyleCast: false
85+
SpaceAfterTemplateKeyword: true
86+
SpaceBeforeAssignmentOperators: true
87+
SpaceBeforeParens: ControlStatements
88+
SpaceInEmptyParentheses: false
89+
SpacesBeforeTrailingComments: 2
90+
SpacesInAngles: false
91+
SpacesInContainerLiterals: true
92+
SpacesInCStyleCastParentheses: false
93+
SpacesInParentheses: false
94+
SpacesInSquareBrackets: false
95+
Standard: Auto
96+
TabWidth: 100 # 8
97+
UseTab: Never
98+
...

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* text=auto
2+
3+
*.cpp text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
4+
*.hpp text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
5+
*.h text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
6+
*.c text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
7+
*.tl text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
8+
*.txt text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
9+
*.sh text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=lf
10+
*.php text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
11+
*.ps1 text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=crlf
12+
*.yml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
13+
*.py text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
14+
*.cmake text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
15+
*.md text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
16+
17+
*.tlo binary

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/*build*/
2+
**/.*.swp
3+
**/.DS_Store
4+
**/auto/
5+
auto/
6+
db_backup
7+
*.pyc
8+
docs

.travis.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
sudo: false
2+
dist: trusty
3+
4+
addons_shortcuts:
5+
addons_clang38: &clang38
6+
apt:
7+
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8' ]
8+
packages: [ 'g++-5', 'clang-3.8','libc++-dev', 'libc++abi-dev', 'gperf']
9+
addons_gcc5: &gcc5
10+
apt:
11+
sources: [ 'ubuntu-toolchain-r-test']
12+
packages: [ 'gcc-5','g++-5', 'gperf']
13+
14+
branches:
15+
only:
16+
- travis
17+
18+
language: cpp
19+
20+
matrix:
21+
include:
22+
- os: linux
23+
env: _CXX=g++-5 _CC=gcc-5 JOBS=1
24+
addons: *gcc5
25+
- os: linux
26+
env: _CXX=clang++-3.8 _CC=clang-3.8 JOBS=4
27+
addons: *clang38
28+
- os: osx
29+
env: JOBS=4
30+
compiler: clang
31+
32+
before_install:
33+
#- sudo apt-get -qq update
34+
#- sudo apt-get install -y libxml2-dev
35+
36+
addons:
37+
apt:
38+
packages:
39+
- gperf
40+
41+
42+
install:
43+
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
44+
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
45+
export OPENSSL_ROOT_DIR=/usr/local/opt/openssl/;
46+
brew link --force readline;
47+
ulimit -n 1000;
48+
fi
49+
- false || [ -z "$_CXX" ] || export CXX=${_CXX}
50+
- false || [ -z "$_CC" ] || export CC=${_CC}
51+
- echo ${PATH}
52+
- echo ${CXX}
53+
- ${CXX} --version
54+
- ${CXX} -v
55+
56+
script:
57+
- mkdir build
58+
- cd build
59+
- cmake .. && make -j${JOBS} VERBOSE=1
60+
- ./test/run_all_tests --filter -client

.ycm_extra_conf.py

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# This file is NOT licensed under the GPLv3, which is the license for the rest
2+
# of YouCompleteMe.
3+
#
4+
# Here's the license text for this file:
5+
#
6+
# This is free and unencumbered software released into the public domain.
7+
#
8+
# Anyone is free to copy, modify, publish, use, compile, sell, or
9+
# distribute this software, either in source code form or as a compiled
10+
# binary, for any purpose, commercial or non-commercial, and by any
11+
# means.
12+
#
13+
# In jurisdictions that recognize copyright laws, the author or authors
14+
# of this software dedicate any and all copyright interest in the
15+
# software to the public domain. We make this dedication for the benefit
16+
# of the public at large and to the detriment of our heirs and
17+
# successors. We intend this dedication to be an overt act of
18+
# relinquishment in perpetuity of all present and future rights to this
19+
# software under copyright law.
20+
#
21+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24+
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27+
# OTHER DEALINGS IN THE SOFTWARE.
28+
#
29+
# For more information, please refer to <http://unlicense.org/>
30+
31+
import os
32+
import ycm_core
33+
34+
# These are the compilation flags that will be used in case there's no
35+
# compilation database set (by default, one is not set).
36+
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
37+
flags = [
38+
"-stdlib=libc++",
39+
"-Wall",
40+
"-Wextra",
41+
"-Wno-unused-parameter",
42+
"-Wno-deprecated-declarations",
43+
"-std=c++14",
44+
"-x",
45+
"c++",
46+
"-I",
47+
".",
48+
"-I", "tdutils",
49+
"-I", "tdutils/generate",
50+
"-I", "tdactor",
51+
"-I", "tddb",
52+
"-I", "tdnet",
53+
"-I", "tdtl",
54+
"-I", "td/generate",
55+
"-I", "td/generate/auto",
56+
"-I", "td",
57+
"-isystem",
58+
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1",
59+
"-isystem",
60+
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0/include",
61+
"-isystem",
62+
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
63+
]
64+
65+
66+
# Set this to the absolute path to the folder (NOT the file!) containing the
67+
# compile_commands.json file to use that instead of 'flags'. See here for
68+
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
69+
#
70+
# You can get CMake to generate this file for you by adding:
71+
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
72+
# to your CMakeLists.txt file.
73+
#
74+
# Most projects will NOT need to set this to anything; you can just change the
75+
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
76+
compilation_database_folder = 'build'
77+
78+
if os.path.exists( compilation_database_folder ):
79+
database = ycm_core.CompilationDatabase( compilation_database_folder )
80+
else:
81+
database = None
82+
83+
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
84+
85+
def DirectoryOfThisScript():
86+
return os.path.dirname( os.path.abspath( __file__ ) )
87+
88+
89+
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
90+
if not working_directory:
91+
return list( flags )
92+
new_flags = []
93+
make_next_absolute = False
94+
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
95+
for flag in flags:
96+
new_flag = flag
97+
98+
if make_next_absolute:
99+
make_next_absolute = False
100+
if not flag.startswith( '/' ):
101+
new_flag = os.path.join( working_directory, flag )
102+
103+
for path_flag in path_flags:
104+
if flag == path_flag:
105+
make_next_absolute = True
106+
break
107+
108+
if flag.startswith( path_flag ):
109+
path = flag[ len( path_flag ): ]
110+
new_flag = path_flag + os.path.join( working_directory, path )
111+
break
112+
113+
if new_flag:
114+
new_flags.append( new_flag )
115+
return new_flags
116+
117+
118+
def IsHeaderFile( filename ):
119+
extension = os.path.splitext( filename )[ 1 ]
120+
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
121+
122+
123+
def GetCompilationInfoForFile( filename ):
124+
# The compilation_commands.json file generated by CMake does not have entries
125+
# for header files. So we do our best by asking the db for flags for a
126+
# corresponding source file, if any. If one exists, the flags for that file
127+
# should be good enough.
128+
if IsHeaderFile( filename ):
129+
basename = os.path.splitext( filename )[ 0 ]
130+
for extension in SOURCE_EXTENSIONS:
131+
replacement_file = basename + extension
132+
if os.path.exists( replacement_file ):
133+
compilation_info = database.GetCompilationInfoForFile(
134+
replacement_file )
135+
if compilation_info.compiler_flags_:
136+
return compilation_info
137+
return None
138+
return database.GetCompilationInfoForFile( filename )
139+
140+
141+
def FlagsForFile( filename, **kwargs ):
142+
if database:
143+
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
144+
# python list, but a "list-like" StringVec object
145+
compilation_info = GetCompilationInfoForFile( filename )
146+
if not compilation_info:
147+
return None
148+
149+
final_flags = MakeRelativePathsInFlagsAbsolute(
150+
compilation_info.compiler_flags_,
151+
compilation_info.compiler_working_dir_ )
152+
else:
153+
relative_to = DirectoryOfThisScript()
154+
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
155+
156+
return {
157+
'flags': final_flags,
158+
'do_cache': True
159+
}

0 commit comments

Comments
 (0)