summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-06-02 01:05:44 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-06-02 01:05:44 +0000
commit4b46f72c7f222e938118ba852ded3060b0a911e4 (patch)
treeaa9baed07619062abf801224e526f68136a0ab36 /clang/lib/Frontend
parentc38e947e506f152b75df8148e5c1e95eea3fe6b7 (diff)
downloadbcm5719-llvm-4b46f72c7f222e938118ba852ded3060b0a911e4.tar.gz
bcm5719-llvm-4b46f72c7f222e938118ba852ded3060b0a911e4.zip
PR32848: There isn't necessarily a FileChanged or FileSkipped for every InclusionDirective callback.
In particular, you don't get one if the inclusion directive encountered an error. Don't assert in that case. llvm-svn: 304506
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/Rewrite/InclusionRewriter.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
index d45cbc01df8..3564cebba8a 100644
--- a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
+++ b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
@@ -177,7 +177,9 @@ void InclusionRewriter::FileSkipped(const FileEntry &/*SkippedFile*/,
/// directives. It does not say whether the file has been included, but it
/// provides more information about the directive (hash location instead
/// of location inside the included file). It is assumed that the matching
-/// FileChanged() or FileSkipped() is called after this.
+/// FileChanged() or FileSkipped() is called after this (or neither is
+/// called if this #include results in an error or does not textually include
+/// anything).
void InclusionRewriter::InclusionDirective(SourceLocation HashLoc,
const Token &/*IncludeTok*/,
StringRef /*FileName*/,
@@ -187,9 +189,6 @@ void InclusionRewriter::InclusionDirective(SourceLocation HashLoc,
StringRef /*SearchPath*/,
StringRef /*RelativePath*/,
const Module *Imported) {
- assert(LastInclusionLocation.isInvalid() &&
- "Another inclusion directive was found before the previous one "
- "was processed");
if (Imported) {
auto P = ModuleIncludes.insert(
std::make_pair(HashLoc.getRawEncoding(), Imported));
OpenPOWER on IntegriCloud