@@ -612,32 +612,37 @@ std::string CppCheck::getLibraryDumpData() const {
612612 return out;
613613}
614614
615- std::string CppCheck::getClangFlags (Standards::Language lang) const {
615+ /* *
616+ * @brief Get the clang command line flags using the Settings
617+ * @param lang language guessed from filename
618+ * @return Clang command line flags
619+ */
620+ static std::string getClangFlags (const Settings& setting, Standards::Language lang) {
616621 std::string flags;
617622
618623 assert (lang != Standards::Language::None);
619624
620625 switch (lang) {
621626 case Standards::Language::C:
622627 flags = " -x c " ;
623- if (!mSettings .standards .stdValueC .empty ())
624- flags += " -std=" + mSettings .standards .stdValueC + " " ;
628+ if (!setting .standards .stdValueC .empty ())
629+ flags += " -std=" + setting .standards .stdValueC + " " ;
625630 break ;
626631 case Standards::Language::CPP:
627632 flags += " -x c++ " ;
628- if (!mSettings .standards .stdValueCPP .empty ())
629- flags += " -std=" + mSettings .standards .stdValueCPP + " " ;
633+ if (!setting .standards .stdValueCPP .empty ())
634+ flags += " -std=" + setting .standards .stdValueCPP + " " ;
630635 break ;
631636 case Standards::Language::None:
632637 break ;
633638 }
634639
635- for (const std::string &i: mSettings .includePaths )
640+ for (const std::string &i: setting .includePaths )
636641 flags += " -I" + i + " " ;
637642
638- flags += getDefinesFlags (mSettings .userDefines );
643+ flags += getDefinesFlags (setting .userDefines );
639644
640- for (const std::string &i: mSettings .userIncludes )
645+ for (const std::string &i: setting .userIncludes )
641646 flags += " --include " + cmdFileName (i) + " " ;
642647
643648 return flags;
@@ -668,7 +673,7 @@ unsigned int CppCheck::checkClang(const FileWithDetails &file)
668673#endif
669674
670675 const std::string args2 = " -fsyntax-only -Xclang -ast-dump -fno-color-diagnostics " +
671- getClangFlags (file.lang ()) +
676+ getClangFlags (mSettings , file.lang ()) +
672677 file.spath ();
673678 const std::string redirect2 = clangStderr.empty () ? " 2>&1" : (" 2> " + clangStderr);
674679 if (mSettings .verbose && !mSettings .quiet ) {
0 commit comments