Skip to content

Commit d58d1bc

Browse files
Revert hack for passing MainFileIsHeader
1 parent 2fcdbd1 commit d58d1bc

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/Integration.Vsix.UnitTests/CFamily/VcxProject/FileConfigTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public void TryGet_HeaderFileOptions_ReturnsValidConfig()
174174
// Assert
175175
request.Should().NotBeNull();
176176
Assert.AreEqual("\"C:\\path\\cl.exe\" /Yu\"pch.h\" /FI\"pch.h\" /EHsc /RTCu \"c:\\dummy\\file.h\"", request.CDCommand);
177-
Assert.AreEqual("non_existent_file", request.CDFile);
177+
Assert.AreEqual("c:\\dummy\\file.h", request.CDFile);
178178

179179
// Arrange
180180
projectItemConfig.FileConfigProperties["CompileAs"] = "CompileAsC";
@@ -185,7 +185,7 @@ public void TryGet_HeaderFileOptions_ReturnsValidConfig()
185185

186186
// Assert
187187
Assert.AreEqual("\"C:\\path\\cl.exe\" /FI\"FHeader.h\" /Yu\"pch.h\" /EHsc /RTCu /TC \"c:\\dummy\\file.h\"", request.CDCommand);
188-
Assert.AreEqual("non_existent_file", request.CDFile);
188+
Assert.AreEqual("c:\\dummy\\file.h", request.CDFile);
189189

190190
// Arrange
191191
projectItemConfig.FileConfigProperties["CompileAs"] = "CompileAsCpp";
@@ -195,7 +195,7 @@ public void TryGet_HeaderFileOptions_ReturnsValidConfig()
195195

196196
// Assert
197197
Assert.AreEqual("\"C:\\path\\cl.exe\" /FI\"FHeader.h\" /Yu\"pch.h\" /EHsc /RTCu /TP \"c:\\dummy\\file.h\"", request.CDCommand);
198-
Assert.AreEqual("non_existent_file", request.CDFile);
198+
Assert.AreEqual("c:\\dummy\\file.h", request.CDFile);
199199
}
200200

201201
[TestMethod]

src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public static FileConfig TryGet(ILogger logger, ProjectItem dteProjectItem, stri
4646
return null;
4747
}
4848

49-
var isHeader = vcFile.ItemType == "ClInclude";
50-
CmdBuilder cmdBuilder = new CmdBuilder(isHeader);
49+
CmdBuilder cmdBuilder = new CmdBuilder(vcFile.ItemType == "ClInclude");
5150

5251
var compilerPath = vcConfig.GetEvaluatedPropertyValue("ClCompilerPath");
5352
if (string.IsNullOrEmpty(compilerPath))
@@ -76,9 +75,7 @@ public static FileConfig TryGet(ILogger logger, ProjectItem dteProjectItem, stri
7675
{
7776
CDDirectory = Path.GetDirectoryName(vcProject.ProjectFile),
7877
CDCommand = cmdBuilder.GetFullCmd(),
79-
// A hack to communicate with the CFamily analyzer that this is a header file.
80-
// A long-term solution should be investigated in CPP-5898.
81-
CDFile = isHeader ? "non_existent_file" : absoluteFilePath,
78+
CDFile = absoluteFilePath,
8279
EnvInclude = envINCLUDE,
8380
};
8481
}

0 commit comments

Comments
 (0)