[lld] r238675 - COFF: Use range-based for loop.
Rui Ueyama
ruiu at google.com
Sun May 31 09:10:50 PDT 2015
Author: ruiu
Date: Sun May 31 11:10:50 2015
New Revision: 238675
URL: http://llvm.org/viewvc/llvm-project?rev=238675&view=rev
Log:
COFF: Use range-based for loop.
Modified:
lld/trunk/COFF/SymbolTable.cpp
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=238675&r1=238674&r2=238675&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Sun May 31 11:10:50 2015
@@ -162,24 +162,23 @@ Defined *SymbolTable::find(StringRef Nam
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");
}
More information about the llvm-commits
mailing list