mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[llvm-rc] Implement the language id option
Differential Revision: https://reviews.llvm.org/D82265
This commit is contained in:
parent
6ecaa26465
commit
a862dd4d2e
15
test/tools/llvm-rc/Inputs/language.rc
Normal file
15
test/tools/llvm-rc/Inputs/language.rc
Normal file
@ -0,0 +1,15 @@
|
||||
1 MENU
|
||||
LANGUAGE 1, 2
|
||||
{
|
||||
MENUITEM "foo", 1
|
||||
}
|
||||
|
||||
2 MENU {
|
||||
MENUITEM "bar", 2
|
||||
}
|
||||
|
||||
LANGUAGE 3, 4
|
||||
|
||||
3 MENU {
|
||||
MENUITEM "baz", 3
|
||||
}
|
19
test/tools/llvm-rc/language.test
Normal file
19
test/tools/llvm-rc/language.test
Normal file
@ -0,0 +1,19 @@
|
||||
; RUN: llvm-rc /l 40A /FO %t.res -- %p/Inputs/language.rc
|
||||
; RUN: llvm-readobj %t.res | FileCheck %s
|
||||
; RUN: llvm-rc /l40A /FO %t.res -- %p/Inputs/language.rc
|
||||
; RUN: llvm-readobj %t.res | FileCheck %s
|
||||
|
||||
; CHECK: Resource name (int): 1
|
||||
; CHECK-NEXT: Data version:
|
||||
; CHECK-NEXT: Memory flags:
|
||||
; CHECK-NEXT: Language ID: 2049
|
||||
|
||||
; CHECK: Resource name (int): 2
|
||||
; CHECK-NEXT: Data version:
|
||||
; CHECK-NEXT: Memory flags:
|
||||
; CHECK-NEXT: Language ID: 1034
|
||||
|
||||
; CHECK: Resource name (int): 3
|
||||
; CHECK-NEXT: Data version:
|
||||
; CHECK-NEXT: Memory flags:
|
||||
; CHECK-NEXT: Language ID: 4099
|
@ -12,7 +12,7 @@ def DEFINE : Separate<[ "/", "-" ], "D">,
|
||||
def UNDEF : Separate<[ "/", "-" ], "U">,
|
||||
HelpText<"Undefine a symbol for the C preprocessor.">;
|
||||
|
||||
def LANG_ID : Separate<[ "/", "-" ], "L">,
|
||||
def LANG_ID : JoinedOrSeparate<[ "/", "-" ], "L">,
|
||||
HelpText<"Set the default language identifier.">;
|
||||
def LANG_NAME : Separate<[ "/", "-" ], "LN">,
|
||||
HelpText<"Set the default language name.">;
|
||||
|
@ -187,7 +187,16 @@ int main(int Argc, const char **Argv) {
|
||||
ExitOnErr(NullResource().visit(Visitor.get()));
|
||||
|
||||
// Set the default language; choose en-US arbitrarily.
|
||||
ExitOnErr(LanguageResource(0x09, 0x01).visit(Visitor.get()));
|
||||
unsigned PrimaryLangId = 0x09, SubLangId = 0x01;
|
||||
if (InputArgs.hasArg(OPT_LANG_ID)) {
|
||||
unsigned LangId;
|
||||
if (InputArgs.getLastArgValue(OPT_LANG_ID).getAsInteger(16, LangId))
|
||||
fatalError("Invalid language id: " +
|
||||
InputArgs.getLastArgValue(OPT_LANG_ID));
|
||||
PrimaryLangId = LangId & 0x3ff;
|
||||
SubLangId = LangId >> 10;
|
||||
}
|
||||
ExitOnErr(LanguageResource(PrimaryLangId, SubLangId).visit(Visitor.get()));
|
||||
}
|
||||
|
||||
rc::RCParser Parser{std::move(Tokens)};
|
||||
|
Loading…
x
Reference in New Issue
Block a user