summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-10-15 00:23:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-10-15 00:23:07 +0000
commit6b4ebcc653b63c544a9eca39441e85a5a18f140f (patch)
treeec6cdfee1c7c805b317dbb211e25113c8932c1d6 /clang/lib/CodeGen/CodeGenFunction.cpp
parentfeea5d6fb45ce7485c411a1234107534a4b5bd76 (diff)
downloadbcm5719-llvm-6b4ebcc653b63c544a9eca39441e85a5a18f140f.tar.gz
bcm5719-llvm-6b4ebcc653b63c544a9eca39441e85a5a18f140f.zip
At -O0, emit an @llvm.trap() call at the end of a value-returning function which
fails to return a value, to make debugging this issue easier. llvm-svn: 165914
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 8562d79ebf5..5f71af80827 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -547,6 +547,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
EmitCheck(Builder.getFalse(), "missing_return",
EmitCheckSourceLocation(FD->getLocation()),
llvm::ArrayRef<llvm::Value*>());
+ else if (CGM.getCodeGenOpts().OptimizationLevel == 0)
+ Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::trap));
Builder.CreateUnreachable();
Builder.ClearInsertionPoint();
}
OpenPOWER on IntegriCloud