Skip to content
Snippets Groups Projects
Commit d78ae542 authored by Richard Smith's avatar Richard Smith
Browse files

PR32848: There isn't necessarily a FileChanged or FileSkipped for every...

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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304506 91177308-0d34-0410-b5e6-96231b3b80d8
parent 5767b70d
No related branches found
No related tags found
No related merge requests found
......@@ -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));
......
// RUN: not %clang_cc1 -E -frewrite-includes %s -o - 2>&1 | FileCheck %s
#include "this file does not exist.foo"
#include "this file also does not exist.foo"
CHECK: fatal error: {{.*}} file not found
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment