forked from qt-creator/qt-creator
Clang: Fix command line builder
Add "-nostdinc++" only for C++. Change-Id: I21228fca80045b040877328f41ca0edb4f227fcc Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -54,7 +54,7 @@ public:
|
||||
addToolChainArguments(toolChainArguments);
|
||||
addLanguage(projectInfo, sourceType);
|
||||
addLanguageVersion(projectInfo);
|
||||
addNoStdIncAndNoStdLibInc();
|
||||
addNoStdIncAndNoStdLibInc(projectInfo.language);
|
||||
addCompilerMacros(projectInfo.compilerMacros);
|
||||
addProjectIncludeSearchPaths(
|
||||
sortedIncludeSearchPaths(projectInfo.projectIncludeSearchPaths));
|
||||
@@ -272,10 +272,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void addNoStdIncAndNoStdLibInc()
|
||||
void addNoStdIncAndNoStdLibInc(Utils::Language language)
|
||||
{
|
||||
commandLine.emplace_back("-nostdinc");
|
||||
commandLine.emplace_back("-nostdinc++");
|
||||
if (language == Utils::Language::Cxx)
|
||||
commandLine.emplace_back("-nostdinc++");
|
||||
}
|
||||
|
||||
public:
|
||||
|
@@ -137,9 +137,13 @@ TYPED_TEST(CommandLineBuilder, CHeader)
|
||||
|
||||
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
|
||||
|
||||
ASSERT_THAT(
|
||||
builder.commandLine,
|
||||
ElementsAre("clang", "-x", "c-header", "-std=c11", "-nostdinc", "-nostdinc++", toNativePath("/source/file.c").path()));
|
||||
ASSERT_THAT(builder.commandLine,
|
||||
ElementsAre("clang",
|
||||
"-x",
|
||||
"c-header",
|
||||
"-std=c11",
|
||||
"-nostdinc",
|
||||
toNativePath("/source/file.c").path()));
|
||||
}
|
||||
|
||||
TYPED_TEST(CommandLineBuilder, CSource)
|
||||
@@ -150,7 +154,7 @@ TYPED_TEST(CommandLineBuilder, CSource)
|
||||
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.c"};
|
||||
|
||||
ASSERT_THAT(builder.commandLine,
|
||||
ElementsAre("clang", "-x", "c", "-std=c11", "-nostdinc", "-nostdinc++", "/source/file.c"));
|
||||
ElementsAre("clang", "-x", "c", "-std=c11", "-nostdinc", "/source/file.c"));
|
||||
}
|
||||
|
||||
TYPED_TEST(CommandLineBuilder, ObjectiveCHeader)
|
||||
@@ -167,7 +171,6 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCHeader)
|
||||
"objective-c-header",
|
||||
"-std=c11",
|
||||
"-nostdinc",
|
||||
"-nostdinc++",
|
||||
toNativePath("/source/file.c").path()));
|
||||
}
|
||||
|
||||
@@ -185,7 +188,6 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCSource)
|
||||
"objective-c",
|
||||
"-std=c11",
|
||||
"-nostdinc",
|
||||
"-nostdinc++",
|
||||
"/source/file.c"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user