mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
fix some 80 column violations
Add support for programs that define main in a .a file, such as f2c'd programs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fc82ef6797
commit
c72e57314a
@ -21,8 +21,6 @@
|
|||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
|
/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
|
||||||
@ -33,7 +31,8 @@ GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
|||||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||||
DefinedSymbols.insert(I->getName());
|
DefinedSymbols.insert(I->getName());
|
||||||
for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I)
|
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
||||||
|
I != E; ++I)
|
||||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||||
DefinedSymbols.insert(I->getName());
|
DefinedSymbols.insert(I->getName());
|
||||||
}
|
}
|
||||||
@ -54,6 +53,13 @@ static void
|
|||||||
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||||
std::set<std::string> DefinedSymbols;
|
std::set<std::string> DefinedSymbols;
|
||||||
UndefinedSymbols.clear();
|
UndefinedSymbols.clear();
|
||||||
|
|
||||||
|
// If the program doesn't define a main, try pulling one in from a .a file.
|
||||||
|
// This is needed for programs where the main function is defined in an
|
||||||
|
// archive, such f2c'd programs.
|
||||||
|
Function *Main = M->getMainFunction();
|
||||||
|
if (Main == 0 || Main->isExternal())
|
||||||
|
UndefinedSymbols.insert("main");
|
||||||
|
|
||||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
if (I->hasName()) {
|
if (I->hasName()) {
|
||||||
@ -62,7 +68,8 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
|||||||
else if (!I->hasInternalLinkage())
|
else if (!I->hasInternalLinkage())
|
||||||
DefinedSymbols.insert(I->getName());
|
DefinedSymbols.insert(I->getName());
|
||||||
}
|
}
|
||||||
for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I)
|
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
||||||
|
I != E; ++I)
|
||||||
if (I->hasName()) {
|
if (I->hasName()) {
|
||||||
if (I->isExternal())
|
if (I->isExternal())
|
||||||
UndefinedSymbols.insert(I->getName());
|
UndefinedSymbols.insert(I->getName());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user