Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
114ab9f6
Commit
114ab9f6
authored
15 years ago
by
Mike Stump
Browse files
Options
Downloads
Patches
Plain Diff
Fixup reference binding for catch parameters.
Fixup throws and rethrows to use invoke as appropriate. llvm-svn: 90513
parent
b7176a13
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clang/lib/CodeGen/CGException.cpp
+21
-6
21 additions, 6 deletions
clang/lib/CodeGen/CGException.cpp
with
21 additions
and
6 deletions
clang/lib/CodeGen/CGException.cpp
+
21
−
6
View file @
114ab9f6
...
...
@@ -210,7 +210,13 @@ static void CopyObject(CodeGenFunction &CGF, QualType ObjectType,
void
CodeGenFunction
::
EmitCXXThrowExpr
(
const
CXXThrowExpr
*
E
)
{
if
(
!
E
->
getSubExpr
())
{
Builder
.
CreateCall
(
getReThrowFn
(
*
this
))
->
setDoesNotReturn
();
if
(
getInvokeDest
())
{
llvm
::
BasicBlock
*
Cont
=
createBasicBlock
(
"invoke.cont"
);
Builder
.
CreateInvoke
(
getReThrowFn
(
*
this
),
Cont
,
getInvokeDest
())
->
setDoesNotReturn
();
EmitBlock
(
Cont
);
}
else
Builder
.
CreateCall
(
getReThrowFn
(
*
this
))
->
setDoesNotReturn
();
Builder
.
CreateUnreachable
();
// Clear the insertion point to indicate we are in unreachable code.
...
...
@@ -237,9 +243,18 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) {
llvm
::
Constant
*
TypeInfo
=
CGM
.
GenerateRTTI
(
ThrowType
);
llvm
::
Constant
*
Dtor
=
llvm
::
Constant
::
getNullValue
(
Int8PtrTy
);
llvm
::
CallInst
*
ThrowCall
=
Builder
.
CreateCall3
(
getThrowFn
(
*
this
),
ExceptionPtr
,
TypeInfo
,
Dtor
);
ThrowCall
->
setDoesNotReturn
();
if
(
getInvokeDest
())
{
llvm
::
BasicBlock
*
Cont
=
createBasicBlock
(
"invoke.cont"
);
llvm
::
InvokeInst
*
ThrowCall
=
Builder
.
CreateInvoke3
(
getThrowFn
(
*
this
),
Cont
,
getInvokeDest
(),
ExceptionPtr
,
TypeInfo
,
Dtor
);
ThrowCall
->
setDoesNotReturn
();
EmitBlock
(
Cont
);
}
else
{
llvm
::
CallInst
*
ThrowCall
=
Builder
.
CreateCall3
(
getThrowFn
(
*
this
),
ExceptionPtr
,
TypeInfo
,
Dtor
);
ThrowCall
->
setDoesNotReturn
();
}
Builder
.
CreateUnreachable
();
// Clear the insertion point to indicate we are in unreachable code.
...
...
@@ -383,7 +398,8 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
setInvokeDest
(
TerminateHandler
);
bool
WasPointer
=
true
;
if
(
!
CatchType
.
getTypePtr
()
->
isPointerType
())
{
WasPointer
=
false
;
if
(
!
isa
<
ReferenceType
>
(
CatchParam
->
getType
()))
WasPointer
=
false
;
CatchType
=
getContext
().
getPointerType
(
CatchType
);
}
ExcObject
=
Builder
.
CreateBitCast
(
ExcObject
,
ConvertType
(
CatchType
));
...
...
@@ -428,7 +444,6 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
Builder
.
CreateInvoke
(
getEndCatchFn
(
*
this
),
Cont
,
TerminateHandler
,
Args
.
begin
(),
Args
.
begin
());
EmitBlock
(
Cont
);
if
(
Info
.
SwitchBlock
)
EmitBlock
(
Info
.
SwitchBlock
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment