Skip to content

Commit e5c762f

Browse files
committed
Added option for additional parameter in iwyu integration.
Fixes #44.
1 parent 0e99acc commit e5c762f

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

IncludeToolbox/IncludeWhatYouUse/IWYU.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ static public string RunIncludeWhatYouUse(string fullFileName, EnvDTE.Project pr
281281
// --max_line_length: maximum line length for includes. Note that this only affects comments and alignment thereof,
282282
// the maximum line length can still be exceeded with long file names(default: 80).
283283
process.StartInfo.Arguments += "-Xiwyu --max_line_length=1024 ";
284+
285+
// Custom stuff.
286+
process.StartInfo.Arguments += settings.AdditionalParameters;
287+
process.StartInfo.Arguments += " ";
284288
}
285289

286290

IncludeToolbox/Options/IncludeWhatYouUseOptionsPage.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ public enum PrefixHeaderMode
8181
[Description("Do not suggest that a file add foo.h unless foo.h is already visible in the file's transitive includes. (--transitive_includes_only)")]
8282
public bool TransitiveIncludesOnly { get; set; } = false;
8383

84+
[Category("iwyu options")]
85+
[DisplayName("Additional Parameters")]
86+
[Description("This string is inserted after all other parameters and before the filename of the file iwyu is running on.")]
87+
public string AdditionalParameters { get; set; } = "";
88+
8489
#endregion
8590

8691
#region postprocessing
@@ -117,6 +122,7 @@ public override void SaveSettingsToStorage()
117122
settingsStore.SetBoolean(collectionName, nameof(PCHInCode), PCHInCode);
118123
settingsStore.SetInt32(collectionName, nameof(PrefixHeaderIncludes), (int)PrefixHeaderIncludes);
119124
settingsStore.SetBoolean(collectionName, nameof(TransitiveIncludesOnly), TransitiveIncludesOnly);
125+
settingsStore.SetString(collectionName, nameof(AdditionalParameters), AdditionalParameters);
120126

121127
settingsStore.SetBoolean(collectionName, nameof(ApplyProposal), ApplyProposal);
122128
settingsStore.SetBoolean(collectionName, nameof(RunIncludeFormatter), RunIncludeFormatter);
@@ -148,6 +154,8 @@ public override void LoadSettingsFromStorage()
148154
PrefixHeaderIncludes = (PrefixHeaderMode)settingsStore.GetInt32(collectionName, nameof(PrefixHeaderIncludes));
149155
if (settingsStore.PropertyExists(collectionName, nameof(TransitiveIncludesOnly)))
150156
TransitiveIncludesOnly = settingsStore.GetBoolean(collectionName, nameof(TransitiveIncludesOnly));
157+
if (settingsStore.PropertyExists(collectionName, nameof(AdditionalParameters)))
158+
AdditionalParameters = settingsStore.GetString(collectionName, nameof(AdditionalParameters));
151159

152160
if (settingsStore.PropertyExists(collectionName, nameof(ApplyProposal)))
153161
ApplyProposal = settingsStore.GetBoolean(collectionName, nameof(ApplyProposal));

0 commit comments

Comments
 (0)