Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-check generating plist files #703

Closed
mkarpoff opened this issue Jun 28, 2017 · 11 comments
Closed

clang-check generating plist files #703

mkarpoff opened this issue Jun 28, 2017 · 11 comments

Comments

@mkarpoff
Copy link

In one of the recent (last couple of weeks) something changed and when I open a cpp file a new file is always generated. It always is a match for the cpp file IE. helper.cpp generates helper.plist. I did some digging and I think it is because clang-check isn't run on a tmp file but the original file itself. I ran clang-check using the arguments it runs with (Found those using ALEInfo) and the same bahaviour happens.

@w0rp
Copy link
Member

w0rp commented Jun 28, 2017

This has been mentioned before in other plugins: kumar8600/flycheck-clangcheck#5

I don't know much about clang-check, but maybe you can just .gitignore those files. I don't know if you can disable generation of plist files or not.

@mkarpoff
Copy link
Author

mkarpoff commented Jun 28, 2017

I did some digging and if you add the arguments -extra-arg -Xanalyzer -extra-arg -analyzer-output=text to clang-check it will the the errors without generating the plist files. This will pass the -analyzer-output=text to the static analyzer. These args need to be beside each other and in that order.

@gagbo
Copy link
Contributor

gagbo commented Jun 28, 2017

I don't understand this behaviour. Can you point me where you found the solution and confirm the issue ?

I couldn't reproduce the behaviour on a project of mine, and running clang-check filename --analyze -p path/to/build or clang-check --analyze filename -p path/to/build only output the errors as expected and did not create new files in the folder where the file was (and my terminal/vim session was in the same folder)

For info :

$ clang-check --version
LLVM (http://llvm.org/):
  LLVM version 5.0.0svn
  Optimized build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake

I built llvm from versioned source on Feb 6th

@mkarpoff
Copy link
Author

mkarpoff commented Jun 29, 2017

The issue occures when you don't have a build directory. This is the default implementation of clang-check in ale. It could be probably tuned for a case by case basis but that is very cumbersome especially if are editing multiple small projects.
The invokation for clang-check in ale is (from ALEInfo)

/bin/bash -c clang-check -analyze <filename>

@w0rp
Copy link
Member

w0rp commented Jun 29, 2017

You could create a build directory or .gitignore the plist files.

@w0rp
Copy link
Member

w0rp commented Jun 29, 2017

Maybe those arguments for disabling the plist files could be added if no build directory is detected.

@mkarpoff
Copy link
Author

Personal opinion so please take it with a grain of salt. I think making it so that if no build directory is detected it adds those arguments is the best way to approach this problem. I'll try and learn som vim script to see if I can figure out how to fix this but vim script is a language I've never worked with.

@gagbo
Copy link
Contributor

gagbo commented Jun 29, 2017

It doesn't look too difficult to do then. As of now all clang linters check for l:user_build_dir twice :

  • It starts by testing the presence of ale_c_build_dir, and fills the local variable if ale_c_build_dir was set for the buffer
  • if l:user_build_dir is still empty, it looks for a folder containing the compilation database json in one of the ale_c_build_dir_names
  • Then, if l:user_build_dir is still empty it uses the default behaviour (aka options for when no build directory is found)

So the block where to add these default options is clearly defined if I'm not mistaken :

Clang-check needs a little more work, since there is a ternary conditional operator instead of having a true if !empty(l:user_build_dir) block, but it should not be very hard to implement, I'll eventually do it when I have time, but if you want to play with a little vimscript and do proper PRs, this feels like a good example to try :)

@w0rp
Copy link
Member

w0rp commented Jun 29, 2017

Yeah, I think setting those options if the build directory isn't detected is the way to go. If we find one, then we won't generate the files because we're using the build directory. If we don't, then we won't generate those files because those options are set.

@w0rp w0rp added this to the Version 1.5 milestone Jul 17, 2017
w0rp added a commit that referenced this issue Jul 17, 2017
@w0rp
Copy link
Member

w0rp commented Jul 17, 2017

@mkarpoff I pushed a commit for this now with some tests. Give it a try, and let me know if it works properly. Now those arguments should be added if and only if there's no build directory set.

@mkarpoff
Copy link
Author

Looks good so far. Thankyou so much for the fix and for this plugin it is amazing.

rsrchboy added a commit to rsrchboy/ale that referenced this issue Jul 17, 2017
* upstream/master:
  Filter the completion results by the prefix we used
  dense-analysis#703 Add arguments to avoid generating plist files if no build directory is detected for clang-check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants