llvm.org GIT mirror llvm / 5eb7939
Fix several _killer_ bugs. This now actually WORKS for really complex testcases :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8157 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
2 changed file(s) with 8 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
88
99 #include "c++-exception.h"
1010 #include
11 #include
1211
1312 //===----------------------------------------------------------------------===//
1413 // Generic exception support
7473 // exception.
7574 //
7675 static void cxx_destructor(llvm_exception *LE) {
77 void *ObjectPtr = LE+1;
78 llvm_cxx_exception *E = (llvm_cxx_exception *)ObjectPtr - 1;
76 llvm_cxx_exception *E = get_cxx_exception(LE);
7977
8078 // The exception is no longer caught.
8179 assert(CaughtExceptionStack == LE &&
131129 // to see if TypeID matches and, if so, to adjust the exception object
132130 // pointer.
133131 //
134 llvm_cxx_exception *E = (llvm_cxx_exception*)UncaughtExceptionStack;
132 llvm_cxx_exception *E = get_cxx_exception(UncaughtExceptionStack);
135133
136134 // ThrownPtr is a pointer to the object being thrown...
137135 void *ThrownPtr = E+1;
169167
170168 // The exception is now caught.
171169 E->Next = CaughtExceptionStack;
172 CaughtExceptionStack = E->Next;
170 CaughtExceptionStack = E;
173171
174172 // Increment the handler count for this exception.
175173 E->HandlerCount++;
203201 assert(E && "There are no caught exceptions!");
204202
205203 // If this is the last handler using the exception, destroy it now!
206 if (--E->HandlerCount == 0) {
207 CaughtExceptionStack = E->Next; // Unlink from the stack
204 if (--E->HandlerCount == 0)
208205 E->ExceptionDestructor(E); // Release memory for the exception
209 }
210206 }
211207
212208 // __llvm_cxxeh_rethrow - This function turns the top-level caught exception
228224 CaughtExceptionStack = E->Next;
229225 E->Next = UncaughtExceptionStack;
230226 UncaughtExceptionStack = E;
231
232 // Decrement the number of handlers which are using the exception.
233 --E->HandlerCount;
234227
235228 // Return to the caller, which should perform the unwind now.
236229 }
88
99 #include "c++-exception.h"
1010 #include
11 #include
1211
1312 //===----------------------------------------------------------------------===//
1413 // Generic exception support
7473 // exception.
7574 //
7675 static void cxx_destructor(llvm_exception *LE) {
77 void *ObjectPtr = LE+1;
78 llvm_cxx_exception *E = (llvm_cxx_exception *)ObjectPtr - 1;
76 llvm_cxx_exception *E = get_cxx_exception(LE);
7977
8078 // The exception is no longer caught.
8179 assert(CaughtExceptionStack == LE &&
131129 // to see if TypeID matches and, if so, to adjust the exception object
132130 // pointer.
133131 //
134 llvm_cxx_exception *E = (llvm_cxx_exception*)UncaughtExceptionStack;
132 llvm_cxx_exception *E = get_cxx_exception(UncaughtExceptionStack);
135133
136134 // ThrownPtr is a pointer to the object being thrown...
137135 void *ThrownPtr = E+1;
169167
170168 // The exception is now caught.
171169 E->Next = CaughtExceptionStack;
172 CaughtExceptionStack = E->Next;
170 CaughtExceptionStack = E;
173171
174172 // Increment the handler count for this exception.
175173 E->HandlerCount++;
203201 assert(E && "There are no caught exceptions!");
204202
205203 // If this is the last handler using the exception, destroy it now!
206 if (--E->HandlerCount == 0) {
207 CaughtExceptionStack = E->Next; // Unlink from the stack
204 if (--E->HandlerCount == 0)
208205 E->ExceptionDestructor(E); // Release memory for the exception
209 }
210206 }
211207
212208 // __llvm_cxxeh_rethrow - This function turns the top-level caught exception
228224 CaughtExceptionStack = E->Next;
229225 E->Next = UncaughtExceptionStack;
230226 UncaughtExceptionStack = E;
231
232 // Decrement the number of handlers which are using the exception.
233 --E->HandlerCount;
234227
235228 // Return to the caller, which should perform the unwind now.
236229 }