File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ class CppParser : public AbstractParser
103103 bool isParsed (const clang::tooling::CompileCommand& command_);
104104 bool isSourceFile (const std::string& file_) const ;
105105 bool isNonSourceFlag (const std::string& arg_) const ;
106+ bool isObjectiveCpp (const clang::tooling::CompileCommand& command_) const ;
106107 bool parseByJson (const std::string& jsonFile_, std::size_t threadNum_);
107108 int parseWorker (const clang::tooling::CompileCommand& command_);
108109
Original file line number Diff line number Diff line change @@ -170,6 +170,16 @@ bool CppParser::isNonSourceFlag(const std::string& arg_) const
170170 return arg_.find (" -Wl," ) == 0 ;
171171}
172172
173+ bool CppParser::isObjectiveCpp (const clang::tooling::CompileCommand& command_) const
174+ {
175+ for (std::size_t i = 1 ; i < command_.CommandLine .size (); ++i)
176+ {
177+ if (command_.CommandLine [i - 1 ] == " -x" && command_.CommandLine [i] == " objective-c++" )
178+ return true ;
179+ }
180+ return false ;
181+ }
182+
173183std::map<std::string, std::string> CppParser::extractInputOutputs (
174184 const clang::tooling::CompileCommand& command_) const
175185{
@@ -755,7 +765,7 @@ bool CppParser::parseByJson(
755765 std::remove_if (compileCommands.begin (), compileCommands.end (),
756766 [&](const clang::tooling::CompileCommand& c)
757767 {
758- return !isSourceFile (c.Filename );
768+ return !isSourceFile (c.Filename ) || isObjectiveCpp (c) ;
759769 }),
760770 compileCommands.end ());
761771
You can’t perform that action at this time.
0 commit comments