summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2011-09-30 12:31:57 +0000
committerTorok Edwin <edwintorok@gmail.com>2011-09-30 12:31:57 +0000
commit10a11ecb59b8b9d5de462930960df0d4bd4bf801 (patch)
tree1465477b338d62d822dabdb1703de9b01d4f1a7c /lib/CodeGen/LLVMTargetMachine.cpp
parent25a7d94e81317a5f562631906692c4761dcd2395 (diff)
downloadllvm-10a11ecb59b8b9d5de462930960df0d4bd4bf801.tar.gz
llvm-10a11ecb59b8b9d5de462930960df0d4bd4bf801.tar.bz2
llvm-10a11ecb59b8b9d5de462930960df0d4bd4bf801.tar.xz
Instead of crashing when MCAsmInfo is NULL, add an assert.
This helps with porting code from 2.9 to 3.0 as TargetSelect.h changed location, and if you include the old one by accident you will trigger this assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--lib/CodeGen/LLVMTargetMachine.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp
index 8f463e2d3f..3bd1d6071e 100644
--- a/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/lib/CodeGen/LLVMTargetMachine.cpp
@@ -114,6 +114,11 @@ LLVMTargetMachine::LLVMTargetMachine(const Target &T, StringRef Triple,
: TargetMachine(T, Triple, CPU, FS) {
CodeGenInfo = T.createMCCodeGenInfo(Triple, RM, CM);
AsmInfo = T.createMCAsmInfo(Triple);
+ // TargetSelect.h moved to different directory between LLVM 2.9 and 3.0,
+ // and if the old one gets included then MCAsmInfo will be NULL and we'd crash
+ // later.
+ // Provide the user a useful error message about whats wrong.
+ assert(AsmInfo && "MCAsmInfo not initialized. Make sure you include the correct TargetSelect.h!");
}
bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,