File tree 2 files changed +12
-1
lines changed
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
103
103
bool isParsed (const clang::tooling::CompileCommand& command_);
104
104
bool isSourceFile (const std::string& file_) const ;
105
105
bool isNonSourceFlag (const std::string& arg_) const ;
106
+ bool isObjectiveCpp (const clang::tooling::CompileCommand& command_) const ;
106
107
bool parseByJson (const std::string& jsonFile_, std::size_t threadNum_);
107
108
int parseWorker (const clang::tooling::CompileCommand& command_);
108
109
Original file line number Diff line number Diff line change @@ -170,6 +170,16 @@ bool CppParser::isNonSourceFlag(const std::string& arg_) const
170
170
return arg_.find (" -Wl," ) == 0 ;
171
171
}
172
172
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
+
173
183
std::map<std::string, std::string> CppParser::extractInputOutputs (
174
184
const clang::tooling::CompileCommand& command_) const
175
185
{
@@ -755,7 +765,7 @@ bool CppParser::parseByJson(
755
765
std::remove_if (compileCommands.begin (), compileCommands.end (),
756
766
[&](const clang::tooling::CompileCommand& c)
757
767
{
758
- return !isSourceFile (c.Filename );
768
+ return !isSourceFile (c.Filename ) || isObjectiveCpp (c) ;
759
769
}),
760
770
compileCommands.end ());
761
771
You can’t perform that action at this time.
0 commit comments