From a7620d9656832258d59bcfffd2be38ce6fbfa0cf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 15 Jul 2001 06:35:59 +0000 Subject: [PATCH] Implement forward/external declarations for methods. llvm-svn: 196 --- llvm/lib/VMCore/AsmWriter.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 78ef8c75537f..e8025441266d 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -65,10 +65,12 @@ bool AssemblyWriter::processConstPool(const ConstantPool &CP, bool isMethod) { ModuleAnalyzer::processConstPool(CP, isMethod); - if (isMethod) - Out << "begin"; - else + if (isMethod) { + if (!CP.getParentV()->castMethodAsserting()->isExternal()) + Out << "begin"; + } else { Out << "implementation\n"; + } return false; } @@ -103,11 +105,13 @@ bool AssemblyWriter::processConstant(const ConstPoolVal *CPV) { // bool AssemblyWriter::processMethod(const Method *M) { // Print out the return type and name... - Out << "\n" << M->getReturnType() << " \"" << M->getName() << "\"("; + Out << "\n" << (M->isExternal() ? "declare " : "") + << M->getReturnType() << " \"" << M->getName() << "\"("; Table.incorporateMethod(M); ModuleAnalyzer::processMethod(M); Table.purgeMethod(); - Out << "end\n"; + if (!M->isExternal()) + Out << "end\n"; return false; }