Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/IRGen/GenClangDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ clang::Decl *getDeclWithExecutableCode(clang::Decl *decl) {
} // end anonymous namespace

void IRGenModule::emitClangDecl(const clang::Decl *decl) {
// Ignore this decl if we've seen it before.
if (!GlobalClangDecls.insert(decl->getCanonicalDecl()).second)
return;

// Fast path for the case where `decl` doesn't contain executable code, so it
// can't reference any other declarations that we would need to emit.
if (getDeclWithExecutableCode(const_cast<clang::Decl *>(decl)) == nullptr) {
Expand All @@ -67,8 +71,6 @@ void IRGenModule::emitClangDecl(const clang::Decl *decl) {
return;
}

if (!GlobalClangDecls.insert(decl->getCanonicalDecl()).second)
return;
SmallVector<const clang::Decl *, 8> stack;
stack.push_back(decl);

Expand Down