summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commit319a1415b88d43873717a917023774b570e8a711 (patch)
treef025a264e5d7b0e8875273a16b60ab7a56ba5898 /llvm/lib/CodeGen
parent0d164012286d824d3e980d224fa8e01d1b162b9a (diff)
downloadbcm5719-llvm-319a1415b88d43873717a917023774b570e8a711.tar.gz
bcm5719-llvm-319a1415b88d43873717a917023774b570e8a711.zip
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. llvm-svn: 140848
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 8f463e2d3f9..3bd1d6071e4 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/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,
OpenPOWER on IntegriCloud