logic: Fixed C language setting not propagated to Parser and added all supported language standards for C/C++

This commit is contained in:
Eberhard Graether
2016-09-15 00:07:47 +02:00
parent b1b2262581
commit 73ef7c1bcb
5 changed files with 47 additions and 40 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ Parser::Arguments CxxProject::getParserArguments() const
utility::append(args.frameworkSearchPaths, m_projectSettings->getAbsoluteFrameworkSearchPaths());
utility::append(args.frameworkSearchPaths, appSettings->getFrameworkSearchPathsExpanded());
args.language = m_projectSettings->getLanguage();
args.language = languageTypeToString(m_projectSettings->getLanguage());
args.languageStandard = m_projectSettings->getStandard();
args.compilationDatabasePath = m_projectSettings->getCompilationDatabasePath();
+43 -13
View File
@@ -43,22 +43,52 @@ std::vector<std::string> CxxProjectSettings::getLanguageStandards() const
switch (getLanguage())
{
case LANGUAGE_CPP:
standards.push_back("1z");
standards.push_back("14");
standards.push_back("1y");
standards.push_back("11");
standards.push_back("0x");
standards.push_back("03");
standards.push_back("98");
standards.push_back("c++1z");
standards.push_back("gnu++1z");
standards.push_back("c++14");
standards.push_back("gnu++14");
standards.push_back("c++1y");
standards.push_back("gnu++1y");
standards.push_back("c++11");
standards.push_back("gnu++11");
standards.push_back("c++0x");
standards.push_back("gnu++0x");
standards.push_back("c++03");
standards.push_back("c++98");
standards.push_back("gnu++98");
break;
case LANGUAGE_C:
standards.push_back("1x");
standards.push_back("11");
standards.push_back("9x");
standards.push_back("99");
standards.push_back("90");
standards.push_back("89");
standards.push_back("c1x");
standards.push_back("gnu1x");
standards.push_back("iso9899:201x");
standards.push_back("c11");
standards.push_back("gnu11");
standards.push_back("iso9899:2011");
standards.push_back("c9x");
standards.push_back("gnu9x");
standards.push_back("iso9899:199x");
standards.push_back("c99");
standards.push_back("gnu99");
standards.push_back("iso9899:1999");
standards.push_back("iso9899:199409");
standards.push_back("c90");
standards.push_back("gnu90");
standards.push_back("iso9899:1990");
standards.push_back("c89");
standards.push_back("gnu89");
break;
default:
+1 -22
View File
@@ -135,15 +135,8 @@ std::vector<std::string> CxxParser::getCommandlineArguments(const Arguments& arg
{
std::vector<std::string> args = getCommandlineArgumentsEssential(arguments);
// The option '-x c++' treats subsequent input files as C++.
args.push_back("-x");
std::string language = getLanguageArgument(arguments.language);
args.push_back(language);
// Set language standard
std::string standard = "-std=";
standard += language;
standard += arguments.languageStandard;
std::string standard = "-std=" + arguments.languageStandard;
args.push_back(standard);
return args;
@@ -232,17 +225,3 @@ ParserClient* CxxParser::getParserClient()
{
return m_client;
}
std::string CxxParser::getLanguageArgument(const std::string& language) const
{
std::string result = language;
boost::algorithm::to_lower(result);
if (result != "c++" && result != "c")
{
result = "c++";
}
return result;
}
@@ -36,8 +36,6 @@ private:
FileRegister* getFileRegister();
ParserClient* getParserClient();
std::string getLanguageArgument(const std::string& language) const;
friend class TaskParseCxx;
std::shared_ptr<FileRegister> m_fileRegister;
+2 -2
View File
@@ -2885,7 +2885,7 @@ public:
Parser::Arguments args;
args.language = "c++";
args.languageStandard = "1z";
args.languageStandard = "c++1z";
parser.parseFiles(filePaths, args);
@@ -3222,7 +3222,7 @@ private:
m_args.logErrors = logErrors;
m_args.language = "c++";
m_args.languageStandard = "1z";
m_args.languageStandard = "c++1z";
TestFileManager fm;
std::shared_ptr<FileRegister> fr = std::make_shared<FileRegister>(&fm, false);