diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-05-31 16:10:50 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-05-31 16:10:50 +0000 |
| commit | 80b5689d919df2d4dfcc039e6e9e85b577372a93 (patch) | |
| tree | 687d243471be3302bc34e26696c2fd577f690408 | |
| parent | b74d15e507745d44812bff2d00929bc061aeba3d (diff) | |
| download | bcm5719-llvm-80b5689d919df2d4dfcc039e6e9e85b577372a93.tar.gz bcm5719-llvm-80b5689d919df2d4dfcc039e6e9e85b577372a93.zip | |
COFF: Use range-based for loop.
llvm-svn: 238675
| -rw-r--r-- | lld/COFF/SymbolTable.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index f70ba37605f..1d6244c83f3 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -162,24 +162,23 @@ Defined *SymbolTable::find(StringRef Name) { return nullptr; } -// Link default entry point name. +// Windows specific -- Link default entry point name. ErrorOr<StringRef> SymbolTable::findDefaultEntry() { + // User-defined main functions and their corresponding entry points. static const char *Entries[][2] = { - {"mainCRTStartup", "mainCRTStartup"}, - {"wmainCRTStartup", "wmainCRTStartup"}, - {"WinMainCRTStartup", "WinMainCRTStartup"}, - {"wWinMainCRTStartup", "wWinMainCRTStartup"}, {"main", "mainCRTStartup"}, {"wmain", "wmainCRTStartup"}, {"WinMain", "WinMainCRTStartup"}, {"wWinMain", "wWinMainCRTStartup"}, }; - for (size_t I = 0; I < array_lengthof(Entries); ++I) { - if (!find(Entries[I][0])) + for (auto E : Entries) { + if (find(E[1])) + return StringRef(E[1]); + if (!find(E[0])) continue; - if (auto EC = addSymbol(new Undefined(Entries[I][1]))) + if (auto EC = addSymbol(new Undefined(E[1]))) return EC; - return StringRef(Entries[I][1]); + return StringRef(E[1]); } return make_dynamic_error_code("entry point must be defined"); } |

