llvm_unreachable("unknown type kind!");
}
-bool CodeGenFunction::EmitReturnBlock() {
+void CodeGenFunction::EmitReturnBlock() {
// For cleanliness, we try to avoid emitting the return block for
// simple cases.
llvm::BasicBlock *CurBB = Builder.GetInsertBlock();
delete ReturnBlock.getBlock();
} else
EmitBlock(ReturnBlock.getBlock());
- return false;
+ return;
}
// Otherwise, if the return block is the target of a single direct
if (BI && BI->isUnconditional() &&
BI->getSuccessor(0) == ReturnBlock.getBlock()) {
// Reset insertion point, including debug location, and delete the branch.
+ // this is really subtle & only works because the next change in location
+ // will hit the caching in CGDebugInfo::EmitLocation & not override this
Builder.SetCurrentDebugLocation(BI->getDebugLoc());
Builder.SetInsertPoint(BI->getParent());
BI->eraseFromParent();
delete ReturnBlock.getBlock();
- return true;
+ return;
}
}
// region.end for now.
EmitBlock(ReturnBlock.getBlock());
- return false;
}
static void EmitIfUsed(CodeGenFunction &CGF, llvm::BasicBlock *BB) {
assert(BreakContinueStack.empty() &&
"mismatched push/pop in break/continue stack!");
+ if (CGDebugInfo *DI = getDebugInfo())
+ DI->EmitLocation(Builder, EndLoc);
+
// Pop any cleanups that might have been associated with the
// parameters. Do this in whatever block we're currently in; it's
// important to do this before we enter the return block or return
PopCleanupBlocks(PrologueCleanupDepth);
// Emit function epilog (to return).
- bool MoveEndLoc = EmitReturnBlock();
+ EmitReturnBlock();
if (ShouldInstrumentFunction())
EmitFunctionInstrumentation("__cyg_profile_func_exit");
// Emit debug descriptor for function end.
if (CGDebugInfo *DI = getDebugInfo()) {
- if (!MoveEndLoc) DI->setLocation(EndLoc);
DI->EmitFunctionEnd(Builder);
}
// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
struct foo;
-void func(foo *f) { // CHECK: DW_TAG_structure_type
+void func(foo *f) {
}
class bar;
-void func(bar *f) { // CHECK: DW_TAG_class_type
+void func(bar *f) {
}
union baz;
-void func(baz *f) { // CHECK: DW_TAG_union_type
+void func(baz *f) {
}
-class B { // CHECK: DW_TAG_class_type
+class B {
public:
virtual ~B();
-// CHECK: metadata !"_vptr$B", {{.*}}, i32 64, metadata !{{.*}}} ; [ DW_TAG_member ]
};
-struct A { // CHECK: DW_TAG_structure_type
+struct A {
int one;
- static const int HdrSize = 52; // CHECK: HdrSize
+ static const int HdrSize = 52;
int two;
A() {
int x = 1;
};
-int main() {
- A a;
+int main(int argc, char **argv) {
B b;
+ if (argc) {
+ A a;
+ }
+ return 0;
}
+
+// CHECK: unwind label %terminate.lpad, !dbg ![[EXCEPTLOC:.*]]
+// CHECK: store i32 0, i32* %retval, !dbg ![[RETLOC:.*]]
+// CHECK: DW_TAG_structure_type ] [foo]
+// CHECK: DW_TAG_class_type ] [bar]
+// CHECK: DW_TAG_union_type ] [baz]
+// CHECK: DW_TAG_structure_type ] [A]
+// CHECK: HdrSize
+// CHECK: DW_TAG_class_type ] [B]
+// CHECK: metadata !"_vptr$B", {{.*}}, i32 64, metadata !{{.*}}} ; [ DW_TAG_member ]
+// CHECK: ![[EXCEPTLOC]] = metadata !{i32 31,
+// CHECK: ![[RETLOC]] = metadata !{i32 30,