summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-01-26 00:35:08 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-01-26 00:35:08 +0000
commit8334af8c2a88e59860e7aef2ec44a64df402cae1 (patch)
treed91e9f6c046ceeb6e8867ac147bc69fe1b862791 /clang/lib/Sema
parent9a8ff813f34b39438b8042a6d784a4f2305b9fcc (diff)
downloadbcm5719-llvm-8334af8c2a88e59860e7aef2ec44a64df402cae1.tar.gz
bcm5719-llvm-8334af8c2a88e59860e7aef2ec44a64df402cae1.zip
Preserve Sema::UndefinedInternals across PCH boundaries. Fixes
-Wundefined-internal warnings with PCH. llvm-svn: 173538
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/MultiplexExternalSemaSource.cpp6
-rw-r--r--clang/lib/Sema/Sema.cpp24
-rw-r--r--clang/lib/Sema/SemaLookup.cpp2
3 files changed, 15 insertions, 17 deletions
diff --git a/clang/lib/Sema/MultiplexExternalSemaSource.cpp b/clang/lib/Sema/MultiplexExternalSemaSource.cpp
index bee69c46e59..8df830aefff 100644
--- a/clang/lib/Sema/MultiplexExternalSemaSource.cpp
+++ b/clang/lib/Sema/MultiplexExternalSemaSource.cpp
@@ -200,6 +200,12 @@ void MultiplexExternalSemaSource::ReadKnownNamespaces(
for(size_t i = 0; i < Sources.size(); ++i)
Sources[i]->ReadKnownNamespaces(Namespaces);
}
+
+void MultiplexExternalSemaSource::ReadUndefinedInternals(
+ llvm::MapVector<NamedDecl*, SourceLocation> &Undefined){
+ for(size_t i = 0; i < Sources.size(); ++i)
+ Sources[i]->ReadUndefinedInternals(Undefined);
+}
bool MultiplexExternalSemaSource::LookupUnqualified(LookupResult &R, Scope *S){
for(size_t i = 0; i < Sources.size(); ++i)
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index c03d41eb043..c0482767caf 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/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();
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 4bdc1dc253b..a4228a50581 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -3857,7 +3857,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
KnownNamespaces[ExternalKnownNamespaces[I]] = true;
}
- for (llvm::DenseMap<NamespaceDecl*, bool>::iterator
+ for (llvm::MapVector<NamespaceDecl*, bool>::iterator
KNI = KnownNamespaces.begin(),
KNIEnd = KnownNamespaces.end();
KNI != KNIEnd; ++KNI)
OpenPOWER on IntegriCloud