We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[bug] YCM generator uses deprecated FlagsForFile method instead of Settings
<!--
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.

  To help us debug your issue please explain:
-->

### Environment Details (include every applicable attribute)
  * Operating System+version: macOS 10.14.5
  * Compiler+version: clang 10.0.1
  * Conan version: 1.31.4
  * Python version: 3.9.0

### Steps to reproduce (Include if Applicable)
Follow instructions at https://docs.conan.io/en/latest/integrations/ide/youcompleteme.html#youcompleteme-integration to configure `.ycm_extra_conf` and `conan_ycm_flags.json`:

conanfile.txt
```
 [generators]
 ycm
```

```bash
# from your base folder
$ cp build/conan_ycm_extra_conf.py .ycm_extra_conf.py
$ ln -s build/conan_ycm_flags.json conan_ycm_flags.json
```
Install `gtest` as a package, and then import it in a source file.


### Logs (Executed commands with output) (Include/Attach if Applicable)

<!--
  Your log content should be related to the bug description, it can be:
  - Conan command output
  - Server output (Artifactory, conan_server)
-->
YCM was unable to find the gtest package as installed by conan. YCM Debug Info:
```
Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/ycm_x9dk66na.log
-- Server Python interpreter: /usr/local/opt/python@3.9/bin/python3.9
-- Server Python version: 3.9.0
-- Server has Clang support compiled in: True
-- Clang version: clang version 10.0.0
-- Extra configuration file found and loaded
-- Extra configuration path: /Users/username/home/projects/project/.ycm_extra_conf.py
-- C-family completer debug information:
--   Clangd running
--   Clangd process ID: 56305
--   Clangd executable: ['/Users/username/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/Users/
username/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0', '-limit-results=500', '-log=verbose']
--   Clangd logfiles:
--     /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/clangd_stderr615mhccn.log
--   Clangd Server State: Initialized
--   Clangd Project Directory: /Users/username/home/projects/project
--   Clangd Settings: {}
--   Clangd Compilation Command: False
-- Server running at: http://127.0.0.1:50225
-- Server process ID: 56303
-- Server logfiles:
--   /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/ycmd_50225_stdout_nstboyjy.log
--   /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/ycmd_50225_stderr_ey11rfes.log
```
As can be seen, `clangd` is not using the flags `'-x', 'c++'` as defined in the default `flags` list in the generated `.ycm_extra_conf.py`, or the `gtest` package as installed by conan. The generated `conan_ycm_flags.json` file contains the following:

```
{
  "includes": [
    "-isystem/Users/username/.conan/data/gtest/1.10.0/_/_/package/03ad53d73db1da068548d1d6a87ac3219077b5c0/include",
    "-isystem/Users/username/.conan/data/rapidjson/1.1.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include"
  ],
  "defines": [],
  "flags": []
}
```
These flags are also not included in the compilation arguments.

The issue appears to be caused by the fact that the [generator](https://github.com/conan-io/conan/blob/develop/conans/client/generators/ycm.py) uses the deprecated `FlagsForFile` method instead of it's replacement, `Settings`. This can be resolved by modifying line 143 from:

```python
def FlagsForFile( filename, **kwargs ):
```
to
```python
def Settings( filename, **kwargs):
```

As a new user of YCM and conan, this took an inordinate amount of time to troubleshoot, though it is relatively trivial.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conans/client/generators/ycm.py`
Content:
```
1 import json
2 
3 from conans.model import Generator
4 
5 
6 class YouCompleteMeGenerator(Generator):
7     template = '''
8 # This file is NOT licensed under the GPLv3, which is the license for the rest
9 # of YouCompleteMe.
10 #
11 # Here's the license text for this file:
12 #
13 # This is free and unencumbered software released into the public domain.
14 #
15 # Anyone is free to copy, modify, publish, use, compile, sell, or
16 # distribute this software, either in source code form or as a compiled
17 # binary, for any purpose, commercial or non-commercial, and by any
18 # means.
19 #
20 # In jurisdictions that recognize copyright laws, the author or authors
21 # of this software dedicate any and all copyright interest in the
22 # software to the public domain. We make this dedication for the benefit
23 # of the public at large and to the detriment of our heirs and
24 # successors. We intend this dedication to be an overt act of
25 # relinquishment in perpetuity of all present and future rights to this
26 # software under copyright law.
27 #
28 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31 # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
32 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34 # OTHER DEALINGS IN THE SOFTWARE.
35 #
36 # For more information, please refer to <http://unlicense.org/>
37 
38 import os
39 import json
40 import ycm_core
41 import logging
42 
43 
44 _logger = logging.getLogger(__name__)
45 
46 
47 def DirectoryOfThisScript():
48   return os.path.dirname( os.path.abspath( __file__ ) )
49 
50 
51 # These are the compilation flags that will be used in case there's no
52 # compilation database set (by default, one is not set).
53 # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
54 flags = [
55  '-x', 'c++'
56 ]
57 
58 conan_flags = json.loads(open("conan_ycm_flags.json", "r").read())
59 
60 flags.extend(conan_flags["flags"])
61 flags.extend(conan_flags["defines"])
62 flags.extend(conan_flags["includes"])
63 
64 
65 # Set this to the absolute path to the folder (NOT the file!) containing the
66 # compile_commands.json file to use that instead of 'flags'. See here for
67 # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
68 #
69 # You can get CMake to generate this file for you by adding:
70 #   set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
71 # to your CMakeLists.txt file.
72 #
73 # Most projects will NOT need to set this to anything; you can just change the
74 # 'flags' list of compilation flags. Notice that YCM itself uses that approach.
75 compilation_database_folder = os.path.join(DirectoryOfThisScript(), 'Debug')
76 
77 if os.path.exists( compilation_database_folder ):
78   database = ycm_core.CompilationDatabase( compilation_database_folder )
79   if not database.DatabaseSuccessfullyLoaded():
80       _logger.warn("Failed to load database")
81       database = None
82 else:
83   database = None
84 
85 SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
86 
87 def GetAbsolutePath(include_path, working_directory):
88     if os.path.isabs(include_path):
89         return include_path
90     return os.path.join(working_directory, include_path)
91 
92 
93 def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
94   if not working_directory:
95     return list( flags )
96   new_flags = []
97   make_next_absolute = False
98   path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
99   for flag in flags:
100     new_flag = flag
101 
102     if make_next_absolute:
103       make_next_absolute = False
104       new_flag = GetAbsolutePath(flag, working_directory)
105 
106     for path_flag in path_flags:
107       if flag == path_flag:
108         make_next_absolute = True
109         break
110 
111       if flag.startswith( path_flag ):
112         path = flag[ len( path_flag ): ]
113         new_flag = flag[:len(path_flag)] + GetAbsolutePath(path, working_directory)
114         break
115 
116     if new_flag:
117       new_flags.append( new_flag )
118   return new_flags
119 
120 
121 def IsHeaderFile( filename ):
122   extension = os.path.splitext( filename )[ 1 ]
123   return extension.lower() in [ '.h', '.hxx', '.hpp', '.hh' ]
124 
125 
126 def GetCompilationInfoForFile( filename ):
127   # The compilation_commands.json file generated by CMake does not have entries
128   # for header files. So we do our best by asking the db for flags for a
129   # corresponding source file, if any. If one exists, the flags for that file
130   # should be good enough.
131   if IsHeaderFile( filename ):
132     basename = os.path.splitext( filename )[ 0 ]
133     for extension in SOURCE_EXTENSIONS:
134       replacement_file = basename + extension
135       if os.path.exists( replacement_file ):
136         compilation_info = database.GetCompilationInfoForFile( replacement_file )
137         if compilation_info.compiler_flags_:
138           return compilation_info
139     return None
140   return database.GetCompilationInfoForFile( filename )
141 
142 
143 def FlagsForFile( filename, **kwargs ):
144   relative_to = None
145   compiler_flags = None
146 
147   if database:
148     # Bear in mind that compilation_info.compiler_flags_ does NOT return a
149     # python list, but a "list-like" StringVec object
150     compilation_info = GetCompilationInfoForFile( filename )
151     if compilation_info is None:
152       relative_to = DirectoryOfThisScript()
153       compiler_flags = flags
154     else:
155       relative_to = compilation_info.compiler_working_dir_
156       compiler_flags = compilation_info.compiler_flags_
157 
158   else:
159     relative_to = DirectoryOfThisScript()
160     compiler_flags = flags
161 
162   final_flags = MakeRelativePathsInFlagsAbsolute( compiler_flags, relative_to )
163   for flag in final_flags:
164       if flag.startswith("-W"):
165           final_flags.remove(flag)
166   _logger.info("Final flags for %s are %s" % (filename, ' '.join(final_flags)))
167 
168   return {{
169     'flags': final_flags + ["-I/usr/include", "-I/usr/include/c++/{cxx_version}"],
170     'do_cache': True
171   }}
172 '''
173 
174     @property
175     def filename(self):
176         pass
177 
178     @property
179     def content(self):
180         def prefixed(prefix, values):
181             return [prefix + x for x in values]
182 
183         conan_flags = {
184             "includes": prefixed("-isystem", self.deps_build_info.include_paths),
185             "defines": prefixed("-D", self.deps_build_info.defines),
186             "flags": self.deps_build_info.cxxflags
187         }
188 
189         cxx_version = ''
190         try:
191             cxx_version = str(self.settings.compiler.version).split('.')[0]
192         except Exception:
193             pass
194 
195         ycm_data = self.template.format(cxx_version=cxx_version)
196         return {"conan_ycm_extra_conf.py": ycm_data,
197                 "conan_ycm_flags.json": json.dumps(conan_flags, indent=2)}
198
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conans/client/generators/ycm.py b/conans/client/generators/ycm.py
--- a/conans/client/generators/ycm.py
+++ b/conans/client/generators/ycm.py
@@ -140,7 +140,7 @@
   return database.GetCompilationInfoForFile( filename )
 
 
-def FlagsForFile( filename, **kwargs ):
+def Settings( filename, **kwargs ):
   relative_to = None
   compiler_flags = None

{"golden_diff": "diff --git a/conans/client/generators/ycm.py b/conans/client/generators/ycm.py\n--- a/conans/client/generators/ycm.py\n+++ b/conans/client/generators/ycm.py\n@@ -140,7 +140,7 @@\n   return database.GetCompilationInfoForFile( filename )\n \n \n-def FlagsForFile( filename, **kwargs ):\n+def Settings( filename, **kwargs ):\n   relative_to = None\n   compiler_flags = None\n", "issue": "[bug] YCM generator uses deprecated FlagsForFile method instead of Settings\n<!--\r\n  Please don't forget to update the issue title.\r\n  Include all applicable information to help us reproduce your problem.\r\n\r\n  To help us debug your issue please explain:\r\n-->\r\n\r\n### Environment Details (include every applicable attribute)\r\n  * Operating System+version: macOS 10.14.5\r\n  * Compiler+version: clang 10.0.1\r\n  * Conan version: 1.31.4\r\n  * Python version: 3.9.0\r\n\r\n### Steps to reproduce (Include if Applicable)\r\nFollow instructions at https://docs.conan.io/en/latest/integrations/ide/youcompleteme.html#youcompleteme-integration to configure `.ycm_extra_conf` and `conan_ycm_flags.json`:\r\n\r\nconanfile.txt\r\n```\r\n [generators]\r\n ycm\r\n```\r\n\r\n```bash\r\n# from your base folder\r\n$ cp build/conan_ycm_extra_conf.py .ycm_extra_conf.py\r\n$ ln -s build/conan_ycm_flags.json conan_ycm_flags.json\r\n```\r\nInstall `gtest` as a package, and then import it in a source file.\r\n\r\n\r\n### Logs (Executed commands with output) (Include/Attach if Applicable)\r\n\r\n<!--\r\n  Your log content should be related to the bug description, it can be:\r\n  - Conan command output\r\n  - Server output (Artifactory, conan_server)\r\n-->\r\nYCM was unable to find the gtest package as installed by conan. YCM Debug Info:\r\n```\r\nPrinting YouCompleteMe debug information...\r\n-- Resolve completions: Up front\r\n-- Client logfile: /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/ycm_x9dk66na.log\r\n-- Server Python interpreter: /usr/local/opt/python@3.9/bin/python3.9\r\n-- Server Python version: 3.9.0\r\n-- Server has Clang support compiled in: True\r\n-- Clang version: clang version 10.0.0\r\n-- Extra configuration file found and loaded\r\n-- Extra configuration path: /Users/username/home/projects/project/.ycm_extra_conf.py\r\n-- C-family completer debug information:\r\n--   Clangd running\r\n--   Clangd process ID: 56305\r\n--   Clangd executable: ['/Users/username/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/Users/\r\nusername/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0', '-limit-results=500', '-log=verbose']\r\n--   Clangd logfiles:\r\n--     /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/clangd_stderr615mhccn.log\r\n--   Clangd Server State: Initialized\r\n--   Clangd Project Directory: /Users/username/home/projects/project\r\n--   Clangd Settings: {}\r\n--   Clangd Compilation Command: False\r\n-- Server running at: http://127.0.0.1:50225\r\n-- Server process ID: 56303\r\n-- Server logfiles:\r\n--   /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/ycmd_50225_stdout_nstboyjy.log\r\n--   /var/folders/_2/cyfwx31x0y1dh06whkrkrmh00000gn/T/ycmd_50225_stderr_ey11rfes.log\r\n```\r\nAs can be seen, `clangd` is not using the flags `'-x', 'c++'` as defined in the default `flags` list in the generated `.ycm_extra_conf.py`, or the `gtest` package as installed by conan. The generated `conan_ycm_flags.json` file contains the following:\r\n\r\n```\r\n{\r\n  \"includes\": [\r\n    \"-isystem/Users/username/.conan/data/gtest/1.10.0/_/_/package/03ad53d73db1da068548d1d6a87ac3219077b5c0/include\",\r\n    \"-isystem/Users/username/.conan/data/rapidjson/1.1.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include\"\r\n  ],\r\n  \"defines\": [],\r\n  \"flags\": []\r\n}\r\n```\r\nThese flags are also not included in the compilation arguments.\r\n\r\nThe issue appears to be caused by the fact that the [generator](https://github.com/conan-io/conan/blob/develop/conans/client/generators/ycm.py) uses the deprecated `FlagsForFile` method instead of it's replacement, `Settings`. This can be resolved by modifying line 143 from:\r\n\r\n```python\r\ndef FlagsForFile( filename, **kwargs ):\r\n```\r\nto\r\n```python\r\ndef Settings( filename, **kwargs):\r\n```\r\n\r\nAs a new user of YCM and conan, this took an inordinate amount of time to troubleshoot, though it is relatively trivial.\n", "before_files": [{"content": "import json\n\nfrom conans.model import Generator\n\n\nclass YouCompleteMeGenerator(Generator):\n    template = '''\n# This file is NOT licensed under the GPLv3, which is the license for the rest\n# of YouCompleteMe.\n#\n# Here's the license text for this file:\n#\n# This is free and unencumbered software released into the public domain.\n#\n# Anyone is free to copy, modify, publish, use, compile, sell, or\n# distribute this software, either in source code form or as a compiled\n# binary, for any purpose, commercial or non-commercial, and by any\n# means.\n#\n# In jurisdictions that recognize copyright laws, the author or authors\n# of this software dedicate any and all copyright interest in the\n# software to the public domain. We make this dedication for the benefit\n# of the public at large and to the detriment of our heirs and\n# successors. We intend this dedication to be an overt act of\n# relinquishment in perpetuity of all present and future rights to this\n# software under copyright law.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n#\n# For more information, please refer to <http://unlicense.org/>\n\nimport os\nimport json\nimport ycm_core\nimport logging\n\n\n_logger = logging.getLogger(__name__)\n\n\ndef DirectoryOfThisScript():\n  return os.path.dirname( os.path.abspath( __file__ ) )\n\n\n# These are the compilation flags that will be used in case there's no\n# compilation database set (by default, one is not set).\n# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.\nflags = [\n '-x', 'c++'\n]\n\nconan_flags = json.loads(open(\"conan_ycm_flags.json\", \"r\").read())\n\nflags.extend(conan_flags[\"flags\"])\nflags.extend(conan_flags[\"defines\"])\nflags.extend(conan_flags[\"includes\"])\n\n\n# Set this to the absolute path to the folder (NOT the file!) containing the\n# compile_commands.json file to use that instead of 'flags'. See here for\n# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html\n#\n# You can get CMake to generate this file for you by adding:\n#   set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )\n# to your CMakeLists.txt file.\n#\n# Most projects will NOT need to set this to anything; you can just change the\n# 'flags' list of compilation flags. Notice that YCM itself uses that approach.\ncompilation_database_folder = os.path.join(DirectoryOfThisScript(), 'Debug')\n\nif os.path.exists( compilation_database_folder ):\n  database = ycm_core.CompilationDatabase( compilation_database_folder )\n  if not database.DatabaseSuccessfullyLoaded():\n      _logger.warn(\"Failed to load database\")\n      database = None\nelse:\n  database = None\n\nSOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]\n\ndef GetAbsolutePath(include_path, working_directory):\n    if os.path.isabs(include_path):\n        return include_path\n    return os.path.join(working_directory, include_path)\n\n\ndef MakeRelativePathsInFlagsAbsolute( flags, working_directory ):\n  if not working_directory:\n    return list( flags )\n  new_flags = []\n  make_next_absolute = False\n  path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]\n  for flag in flags:\n    new_flag = flag\n\n    if make_next_absolute:\n      make_next_absolute = False\n      new_flag = GetAbsolutePath(flag, working_directory)\n\n    for path_flag in path_flags:\n      if flag == path_flag:\n        make_next_absolute = True\n        break\n\n      if flag.startswith( path_flag ):\n        path = flag[ len( path_flag ): ]\n        new_flag = flag[:len(path_flag)] + GetAbsolutePath(path, working_directory)\n        break\n\n    if new_flag:\n      new_flags.append( new_flag )\n  return new_flags\n\n\ndef IsHeaderFile( filename ):\n  extension = os.path.splitext( filename )[ 1 ]\n  return extension.lower() in [ '.h', '.hxx', '.hpp', '.hh' ]\n\n\ndef GetCompilationInfoForFile( filename ):\n  # The compilation_commands.json file generated by CMake does not have entries\n  # for header files. So we do our best by asking the db for flags for a\n  # corresponding source file, if any. If one exists, the flags for that file\n  # should be good enough.\n  if IsHeaderFile( filename ):\n    basename = os.path.splitext( filename )[ 0 ]\n    for extension in SOURCE_EXTENSIONS:\n      replacement_file = basename + extension\n      if os.path.exists( replacement_file ):\n        compilation_info = database.GetCompilationInfoForFile( replacement_file )\n        if compilation_info.compiler_flags_:\n          return compilation_info\n    return None\n  return database.GetCompilationInfoForFile( filename )\n\n\ndef FlagsForFile( filename, **kwargs ):\n  relative_to = None\n  compiler_flags = None\n\n  if database:\n    # Bear in mind that compilation_info.compiler_flags_ does NOT return a\n    # python list, but a \"list-like\" StringVec object\n    compilation_info = GetCompilationInfoForFile( filename )\n    if compilation_info is None:\n      relative_to = DirectoryOfThisScript()\n      compiler_flags = flags\n    else:\n      relative_to = compilation_info.compiler_working_dir_\n      compiler_flags = compilation_info.compiler_flags_\n\n  else:\n    relative_to = DirectoryOfThisScript()\n    compiler_flags = flags\n\n  final_flags = MakeRelativePathsInFlagsAbsolute( compiler_flags, relative_to )\n  for flag in final_flags:\n      if flag.startswith(\"-W\"):\n          final_flags.remove(flag)\n  _logger.info(\"Final flags for %s are %s\" % (filename, ' '.join(final_flags)))\n\n  return {{\n    'flags': final_flags + [\"-I/usr/include\", \"-I/usr/include/c++/{cxx_version}\"],\n    'do_cache': True\n  }}\n'''\n\n    @property\n    def filename(self):\n        pass\n\n    @property\n    def content(self):\n        def prefixed(prefix, values):\n            return [prefix + x for x in values]\n\n        conan_flags = {\n            \"includes\": prefixed(\"-isystem\", self.deps_build_info.include_paths),\n            \"defines\": prefixed(\"-D\", self.deps_build_info.defines),\n            \"flags\": self.deps_build_info.cxxflags\n        }\n\n        cxx_version = ''\n        try:\n            cxx_version = str(self.settings.compiler.version).split('.')[0]\n        except Exception:\n            pass\n\n        ycm_data = self.template.format(cxx_version=cxx_version)\n        return {\"conan_ycm_extra_conf.py\": ycm_data,\n                \"conan_ycm_flags.json\": json.dumps(conan_flags, indent=2)}\n", "path": "conans/client/generators/ycm.py"}], "after_files": [{"content": "import json\n\nfrom conans.model import Generator\n\n\nclass YouCompleteMeGenerator(Generator):\n    template = '''\n# This file is NOT licensed under the GPLv3, which is the license for the rest\n# of YouCompleteMe.\n#\n# Here's the license text for this file:\n#\n# This is free and unencumbered software released into the public domain.\n#\n# Anyone is free to copy, modify, publish, use, compile, sell, or\n# distribute this software, either in source code form or as a compiled\n# binary, for any purpose, commercial or non-commercial, and by any\n# means.\n#\n# In jurisdictions that recognize copyright laws, the author or authors\n# of this software dedicate any and all copyright interest in the\n# software to the public domain. We make this dedication for the benefit\n# of the public at large and to the detriment of our heirs and\n# successors. We intend this dedication to be an overt act of\n# relinquishment in perpetuity of all present and future rights to this\n# software under copyright law.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n#\n# For more information, please refer to <http://unlicense.org/>\n\nimport os\nimport json\nimport ycm_core\nimport logging\n\n\n_logger = logging.getLogger(__name__)\n\n\ndef DirectoryOfThisScript():\n  return os.path.dirname( os.path.abspath( __file__ ) )\n\n\n# These are the compilation flags that will be used in case there's no\n# compilation database set (by default, one is not set).\n# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.\nflags = [\n '-x', 'c++'\n]\n\nconan_flags = json.loads(open(\"conan_ycm_flags.json\", \"r\").read())\n\nflags.extend(conan_flags[\"flags\"])\nflags.extend(conan_flags[\"defines\"])\nflags.extend(conan_flags[\"includes\"])\n\n\n# Set this to the absolute path to the folder (NOT the file!) containing the\n# compile_commands.json file to use that instead of 'flags'. See here for\n# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html\n#\n# You can get CMake to generate this file for you by adding:\n#   set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )\n# to your CMakeLists.txt file.\n#\n# Most projects will NOT need to set this to anything; you can just change the\n# 'flags' list of compilation flags. Notice that YCM itself uses that approach.\ncompilation_database_folder = os.path.join(DirectoryOfThisScript(), 'Debug')\n\nif os.path.exists( compilation_database_folder ):\n  database = ycm_core.CompilationDatabase( compilation_database_folder )\n  if not database.DatabaseSuccessfullyLoaded():\n      _logger.warn(\"Failed to load database\")\n      database = None\nelse:\n  database = None\n\nSOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]\n\ndef GetAbsolutePath(include_path, working_directory):\n    if os.path.isabs(include_path):\n        return include_path\n    return os.path.join(working_directory, include_path)\n\n\ndef MakeRelativePathsInFlagsAbsolute( flags, working_directory ):\n  if not working_directory:\n    return list( flags )\n  new_flags = []\n  make_next_absolute = False\n  path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]\n  for flag in flags:\n    new_flag = flag\n\n    if make_next_absolute:\n      make_next_absolute = False\n      new_flag = GetAbsolutePath(flag, working_directory)\n\n    for path_flag in path_flags:\n      if flag == path_flag:\n        make_next_absolute = True\n        break\n\n      if flag.startswith( path_flag ):\n        path = flag[ len( path_flag ): ]\n        new_flag = flag[:len(path_flag)] + GetAbsolutePath(path, working_directory)\n        break\n\n    if new_flag:\n      new_flags.append( new_flag )\n  return new_flags\n\n\ndef IsHeaderFile( filename ):\n  extension = os.path.splitext( filename )[ 1 ]\n  return extension.lower() in [ '.h', '.hxx', '.hpp', '.hh' ]\n\n\ndef GetCompilationInfoForFile( filename ):\n  # The compilation_commands.json file generated by CMake does not have entries\n  # for header files. So we do our best by asking the db for flags for a\n  # corresponding source file, if any. If one exists, the flags for that file\n  # should be good enough.\n  if IsHeaderFile( filename ):\n    basename = os.path.splitext( filename )[ 0 ]\n    for extension in SOURCE_EXTENSIONS:\n      replacement_file = basename + extension\n      if os.path.exists( replacement_file ):\n        compilation_info = database.GetCompilationInfoForFile( replacement_file )\n        if compilation_info.compiler_flags_:\n          return compilation_info\n    return None\n  return database.GetCompilationInfoForFile( filename )\n\n\ndef Settings( filename, **kwargs ):\n  relative_to = None\n  compiler_flags = None\n\n  if database:\n    # Bear in mind that compilation_info.compiler_flags_ does NOT return a\n    # python list, but a \"list-like\" StringVec object\n    compilation_info = GetCompilationInfoForFile( filename )\n    if compilation_info is None:\n      relative_to = DirectoryOfThisScript()\n      compiler_flags = flags\n    else:\n      relative_to = compilation_info.compiler_working_dir_\n      compiler_flags = compilation_info.compiler_flags_\n\n  else:\n    relative_to = DirectoryOfThisScript()\n    compiler_flags = flags\n\n  final_flags = MakeRelativePathsInFlagsAbsolute( compiler_flags, relative_to )\n  for flag in final_flags:\n      if flag.startswith(\"-W\"):\n          final_flags.remove(flag)\n  _logger.info(\"Final flags for %s are %s\" % (filename, ' '.join(final_flags)))\n\n  return {{\n    'flags': final_flags + [\"-I/usr/include\", \"-I/usr/include/c++/{cxx_version}\"],\n    'do_cache': True\n  }}\n'''\n\n    @property\n    def filename(self):\n        pass\n\n    @property\n    def content(self):\n        def prefixed(prefix, values):\n            return [prefix + x for x in values]\n\n        conan_flags = {\n            \"includes\": prefixed(\"-isystem\", self.deps_build_info.include_paths),\n            \"defines\": prefixed(\"-D\", self.deps_build_info.defines),\n            \"flags\": self.deps_build_info.cxxflags\n        }\n\n        cxx_version = ''\n        try:\n            cxx_version = str(self.settings.compiler.version).split('.')[0]\n        except Exception:\n            pass\n\n        ycm_data = self.template.format(cxx_version=cxx_version)\n        return {\"conan_ycm_extra_conf.py\": ycm_data,\n                \"conan_ycm_flags.json\": json.dumps(conan_flags, indent=2)}\n", "path": "conans/client/generators/ycm.py"}]}