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

taken into account forcedincludes and propertysheets #40

Open
jcageman opened this issue Jul 5, 2017 · 2 comments
Open

taken into account forcedincludes and propertysheets #40

jcageman opened this issue Jul 5, 2017 · 2 comments

Comments

@jcageman
Copy link

jcageman commented Jul 5, 2017

Hi, i am making my own tool and came across the issue that people can also put forcedincludes in a project which are included in every file (precompiled headers for example). Your tool does not take those into account, but it gets even trickier when people start using propertysheets. You will get a value "$(INHERIT)" in the forced includes field, which is not resolved and you have to parse it yourself. To make your tool full-proof you have to parse the visual studio log files to get the exact compiler invocations. That is the only way i know how to do it.

@Wumpf
Copy link
Owner

Wumpf commented Jul 5, 2017

I was not aware of any other "forced include" than pre-compiled headers. But googling for it brought up the -FI preprocessor option. Is that what you're aiming at? I'm not sure what it is that I need/can handle there in any of the Toolbox' tools. It does not affect sorting and can't be removed without touching project settings which I don't want to do. It might be worth considering putting those in the IncludeGraph and telling the IWYU integration somehow of it. I'm reluctant to do so as it might be confusing in the IncludeGraph and I'm not sure how to get this with IWYU working (which rarely works at all)

For pre-compiled headers there is an option in "Trial and Error Include" to ignore the first include. For the sorting in the formatter I recommend setting up your "Precedence Regexes" preference in a way that always puts the PCH first.
I'm not sure which part of IncludeToolbox you mean by "your tool", since this is a collection of several ;-)

I also couldn't quite follow on this:

You will get a value "$(INHERIT)" in the forced includes field, which is not resolved and you have to parse it yourself.
Are you implying that I need to do macro resolving on the -FI field if I want to use it, or what do you mean?

Thanks for your feedback so far!

@jcageman
Copy link
Author

jcageman commented Jul 5, 2017

I am indeed aiming at the -FI preprocessor option. The reason i would need it is that without it some of my code does not compile (at my work we supply additional macro's for several uses with that method).

"$(INHERIT)" would indeed need macro resolving, but simply calling Evaluate() from VCConfiguration won't and will return empty result in my case. I ended up actually parsing the CL.command.1.tlog files for full compile argument information...

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

2 participants