diff --git a/src/Integration.Vsix.UnitTests/CFamily/VcxProject/FileConfigTests.cs b/src/Integration.Vsix.UnitTests/CFamily/VcxProject/FileConfigTests.cs index 8465e4664..7f3434592 100644 --- a/src/Integration.Vsix.UnitTests/CFamily/VcxProject/FileConfigTests.cs +++ b/src/Integration.Vsix.UnitTests/CFamily/VcxProject/FileConfigTests.cs @@ -174,7 +174,7 @@ public void TryGet_HeaderFileOptions_ReturnsValidConfig() // Assert request.Should().NotBeNull(); Assert.AreEqual("\"C:\\path\\cl.exe\" /Yu\"pch.h\" /FI\"pch.h\" /EHsc /RTCu \"c:\\dummy\\file.h\"", request.CDCommand); - Assert.AreEqual("non_existent_file", request.CDFile); + Assert.AreEqual("c:\\dummy\\file.h", request.CDFile); // Arrange projectItemConfig.FileConfigProperties["CompileAs"] = "CompileAsC"; @@ -185,7 +185,7 @@ public void TryGet_HeaderFileOptions_ReturnsValidConfig() // Assert Assert.AreEqual("\"C:\\path\\cl.exe\" /FI\"FHeader.h\" /Yu\"pch.h\" /EHsc /RTCu /TC \"c:\\dummy\\file.h\"", request.CDCommand); - Assert.AreEqual("non_existent_file", request.CDFile); + Assert.AreEqual("c:\\dummy\\file.h", request.CDFile); // Arrange projectItemConfig.FileConfigProperties["CompileAs"] = "CompileAsCpp"; @@ -195,7 +195,7 @@ public void TryGet_HeaderFileOptions_ReturnsValidConfig() // Assert Assert.AreEqual("\"C:\\path\\cl.exe\" /FI\"FHeader.h\" /Yu\"pch.h\" /EHsc /RTCu /TP \"c:\\dummy\\file.h\"", request.CDCommand); - Assert.AreEqual("non_existent_file", request.CDFile); + Assert.AreEqual("c:\\dummy\\file.h", request.CDFile); } [TestMethod] diff --git a/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs b/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs index 1285eb00a..93e11de61 100644 --- a/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs +++ b/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs @@ -46,8 +46,7 @@ public static FileConfig TryGet(ILogger logger, ProjectItem dteProjectItem, stri return null; } - var isHeader = vcFile.ItemType == "ClInclude"; - CmdBuilder cmdBuilder = new CmdBuilder(isHeader); + CmdBuilder cmdBuilder = new CmdBuilder(vcFile.ItemType == "ClInclude"); var compilerPath = vcConfig.GetEvaluatedPropertyValue("ClCompilerPath"); if (string.IsNullOrEmpty(compilerPath)) @@ -76,9 +75,7 @@ public static FileConfig TryGet(ILogger logger, ProjectItem dteProjectItem, stri { CDDirectory = Path.GetDirectoryName(vcProject.ProjectFile), CDCommand = cmdBuilder.GetFullCmd(), - // A hack to communicate with the CFamily analyzer that this is a header file. - // A long-term solution should be investigated in CPP-5898. - CDFile = isHeader ? "non_existent_file" : absoluteFilePath, + CDFile = absoluteFilePath, EnvInclude = envINCLUDE, }; }