@@ -236,6 +236,7 @@ static bool proceedCommand(std::vector<std::string> command, llvm::StringRef Dir
236
236
// This code change all the paths to be absolute paths
237
237
// FIXME: it is a bit fragile.
238
238
bool previousIsDashI = false ;
239
+ bool hasNoStdInc = false ;
239
240
for (std::string &A : command) {
240
241
if (previousIsDashI && !A.empty () && A[0 ] != ' /' ) {
241
242
A = Directory % " /" % A;
@@ -244,6 +245,9 @@ static bool proceedCommand(std::vector<std::string> command, llvm::StringRef Dir
244
245
} else if (A == " -I" ) {
245
246
previousIsDashI = true ;
246
247
continue ;
248
+ } else if (A == " -nostdinc" ) {
249
+ hasNoStdInc = true ;
250
+ continue ;
247
251
}
248
252
previousIsDashI = false ;
249
253
if (A.empty ()) continue ;
@@ -268,17 +272,21 @@ static bool proceedCommand(std::vector<std::string> command, llvm::StringRef Dir
268
272
command = clang::tooling::getClangSyntaxOnlyAdjuster ()(command, file);
269
273
command = clang::tooling::getClangStripOutputAdjuster ()(command, file);
270
274
#endif
271
- command.push_back (" -isystem" );
272
- command.push_back (" /builtins" );
275
+ if (!hasNoStdInc) {
276
+ command.push_back (" -isystem" );
277
+ command.push_back (" /builtins" );
278
+ }
273
279
command.push_back (" -Qunused-arguments" );
274
280
command.push_back (" -Wno-unknown-warning-option" );
275
281
clang::tooling::ToolInvocation Inv (command, new BrowserAction (WasInDatabase), FM);
276
282
277
- // Map the builtins includes
278
- const EmbeddedFile *f = EmbeddedFiles;
279
- while (f->filename ) {
280
- Inv.mapVirtualFile (f->filename , {f->content , f->size } );
281
- f++;
283
+ if (!hasNoStdInc) {
284
+ // Map the builtins includes
285
+ const EmbeddedFile *f = EmbeddedFiles;
286
+ while (f->filename ) {
287
+ Inv.mapVirtualFile (f->filename , {f->content , f->size } );
288
+ f++;
289
+ }
282
290
}
283
291
bool result = Inv.run ();
284
292
if (!result) {
0 commit comments