add a PPCallback handler for a skipped #include, patch by
Zhanyong Wan!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101813 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 8033e47..eb86645 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -1088,11 +1088,6 @@
return;
}
- // Ask HeaderInfo if we should enter this #include file. If not, #including
- // this file will have no effect.
- if (!HeaderInfo.ShouldEnterIncludeFile(File, isImport))
- return;
-
// The #included file will be considered to be a system header if either it is
// in a system include directory, or if the #includer is a system include
// header.
@@ -1100,6 +1095,15 @@
std::max(HeaderInfo.getFileDirFlavor(File),
SourceMgr.getFileCharacteristic(FilenameTok.getLocation()));
+ // Ask HeaderInfo if we should enter this #include file. If not, #including
+ // this file will have no effect.
+ if (!HeaderInfo.ShouldEnterIncludeFile(File, isImport)) {
+ if (Callbacks) {
+ Callbacks->FileSkipped(*File, FilenameTok, FileCharacter);
+ }
+ return;
+ }
+
// Look up the file, create a File ID for it.
FileID FID = SourceMgr.createFileID(File, FilenameTok.getLocation(),
FileCharacter);
@@ -1667,4 +1671,3 @@
return SkipExcludedConditionalBlock(CI.IfLoc, /*Foundnonskip*/true,
/*FoundElse*/CI.FoundElse);
}
-