diff options
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index c03d41eb04..c0482767ca 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -385,7 +385,7 @@ static void checkUndefinedInternals(Sema &S) { // Collect all the still-undefined entities with internal linkage. SmallVector<UndefinedInternal, 16> undefined; - for (llvm::DenseMap<NamedDecl*,SourceLocation>::iterator + for (llvm::MapVector<NamedDecl*,SourceLocation>::iterator i = S.UndefinedInternals.begin(), e = S.UndefinedInternals.end(); i != e; ++i) { NamedDecl *decl = i->first; @@ -407,23 +407,9 @@ static void checkUndefinedInternals(Sema &S) { continue; } - // We build a FullSourceLoc so that we can sort with array_pod_sort. - FullSourceLoc loc(i->second, S.Context.getSourceManager()); - undefined.push_back(UndefinedInternal(decl, loc)); - } - - if (undefined.empty()) return; - - // Sort (in order of use site) so that we're not (as) dependent on - // the iteration order through an llvm::DenseMap. - llvm::array_pod_sort(undefined.begin(), undefined.end()); - - for (SmallVectorImpl<UndefinedInternal>::iterator - i = undefined.begin(), e = undefined.end(); i != e; ++i) { - NamedDecl *decl = i->decl; S.Diag(decl->getLocation(), diag::warn_undefined_internal) << isa<VarDecl>(decl) << decl; - S.Diag(i->useLoc, diag::note_used_here); + S.Diag(i->second, diag::note_used_here); } } @@ -736,6 +722,8 @@ void Sema::ActOnEndOfTranslationUnit() { } } + if (ExternalSource) + ExternalSource->ReadUndefinedInternals(UndefinedInternals); checkUndefinedInternals(*this); } @@ -1080,6 +1068,10 @@ void ExternalSemaSource::ReadKnownNamespaces( SmallVectorImpl<NamespaceDecl *> &Namespaces) { } +void ExternalSemaSource::ReadUndefinedInternals( + llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) { +} + void PrettyDeclStackTraceEntry::print(raw_ostream &OS) const { SourceLocation Loc = this->Loc; if (!Loc.isValid() && TheDecl) Loc = TheDecl->getLocation(); |