Repository: conan-io/conan

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.


Discussion:

Resolving patch:
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 @@ def GetCompilationInfoForFile( filename ):
   return database.GetCompilationInfoForFile( filename )
 
 
-def FlagsForFile( filename, **kwargs ):
+def Settings( filename, **kwargs ):
   relative_to = None
   compiler_flags = None
 


Test patch: