diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-23 19:09:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-23 19:09:22 +0000 |
commit | 5cc1270689c88cea32e6546ed5dd981faae900e7 (patch) | |
tree | 7cc9b079d0090bd219f33fc0fd9d917c68e66f07 /llvm/lib/CWriter/Writer.cpp | |
parent | 9de0d14decaf69ba94dce7b7b19a28dd009f4361 (diff) | |
download | bcm5719-llvm-5cc1270689c88cea32e6546ed5dd981faae900e7.tar.gz bcm5719-llvm-5cc1270689c88cea32e6546ed5dd981faae900e7.zip |
Fix the super obnoxious "cast to pointer from integer of different size" warnings
llvm-svn: 5881
Diffstat (limited to 'llvm/lib/CWriter/Writer.cpp')
-rw-r--r-- | llvm/lib/CWriter/Writer.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/CWriter/Writer.cpp b/llvm/lib/CWriter/Writer.cpp index dfe5ec2f58a..f9ddc7d8c41 100644 --- a/llvm/lib/CWriter/Writer.cpp +++ b/llvm/lib/CWriter/Writer.cpp @@ -946,13 +946,8 @@ void CWriter::visitBranchInst(BranchInst &I) { void CWriter::visitBinaryOperator(Instruction &I) { // binary instructions, shift instructions, setCond instructions. - if (isa<PointerType>(I.getType())) { - Out << "("; - printType(Out, I.getType()); - Out << ")"; - } + assert(!isa<PointerType>(I.getType())); - if (isa<PointerType>(I.getType())) Out << "(long long)"; writeOperand(I.getOperand(0)); switch (I.getOpcode()) { @@ -975,14 +970,20 @@ void CWriter::visitBinaryOperator(Instruction &I) { default: std::cerr << "Invalid operator type!" << I; abort(); } - if (isa<PointerType>(I.getType())) Out << "(long long)"; writeOperand(I.getOperand(1)); } void CWriter::visitCastInst(CastInst &I) { Out << "("; - printType(Out, I.getType(), string(""),/*ignoreName*/false, /*namedContext*/false); + printType(Out, I.getType(), string(""),/*ignoreName*/false, + /*namedContext*/false); Out << ")"; + if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() || + isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) { + // Avoid "cast to pointer from integer of different size" warnings + Out << "(long)"; + } + writeOperand(I.getOperand(0)); } |