aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-07 08:24:59 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-07 08:24:59 +0000
commitd6a637f8c8a93863509fc1bc555513ff6504957d (patch)
tree05345cbf414d8ca2ff156b5d8b69f2a1cdeb234a /lib/Sema/Sema.cpp
parentd58987c67d0fa02a71af98a9fa66ffd73c1501ed (diff)
Rework how virtual member functions are marked. If a class has no key function, we now wait until the end of the translation unit to mark its virtual member functions as references. This lays the groundwork for fixing PR5557.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 29efbd7bec..ef6147420b 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -728,18 +728,27 @@ void Sema::DeleteStmt(StmtTy *S) {
/// translation unit when EOF is reached and all but the top-level scope is
/// popped.
void Sema::ActOnEndOfTranslationUnit() {
- // C++: Perform implicit template instantiations.
- //
- // FIXME: When we perform these implicit instantiations, we do not carefully
- // keep track of the point of instantiation (C++ [temp.point]). This means
- // that name lookup that occurs within the template instantiation will
- // always happen at the end of the translation unit, so it will find
- // some names that should not be found. Although this is common behavior
- // for C++ compilers, it is technically wrong. In the future, we either need
- // to be able to filter the results of name lookup or we need to perform
- // template instantiations earlier.
- PerformPendingImplicitInstantiations();
-
+
+ while (1) {
+ // C++: Perform implicit template instantiations.
+ //
+ // FIXME: When we perform these implicit instantiations, we do not carefully
+ // keep track of the point of instantiation (C++ [temp.point]). This means
+ // that name lookup that occurs within the template instantiation will
+ // always happen at the end of the translation unit, so it will find
+ // some names that should not be found. Although this is common behavior
+ // for C++ compilers, it is technically wrong. In the future, we either need
+ // to be able to filter the results of name lookup or we need to perform
+ // template instantiations earlier.
+ PerformPendingImplicitInstantiations();
+
+ /// If ProcessPendingClassesWithUnmarkedVirtualMembers ends up marking
+ /// any virtual member functions it might lead to more pending template
+ /// instantiations, which is why we need to loop here.
+ if (!ProcessPendingClassesWithUnmarkedVirtualMembers())
+ break;
+ }
+
// Check for #pragma weak identifiers that were never declared
// FIXME: This will cause diagnostics to be emitted in a non-determinstic
// order! Iterating over a densemap like this is bad.