comparison lib/Object/COFFModuleDefinition.cpp @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
146:3fc4d5c3e21e 148:63bd29f05246
1 //===--- COFFModuleDefinition.cpp - Simple DEF parser ---------------------===// 1 //===--- COFFModuleDefinition.cpp - Simple DEF parser ---------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 // 8 //
10 // Windows-specific. 9 // Windows-specific.
11 // A parser for the module-definition file (.def file). 10 // A parser for the module-definition file (.def file).
35 Unknown, 34 Unknown,
36 Eof, 35 Eof,
37 Identifier, 36 Identifier,
38 Comma, 37 Comma,
39 Equal, 38 Equal,
39 EqualEqual,
40 KwBase, 40 KwBase,
41 KwConstant, 41 KwConstant,
42 KwData, 42 KwData,
43 KwExports, 43 KwExports,
44 KwHeapsize, 44 KwHeapsize,
102 Buf = (End == Buf.npos) ? "" : Buf.drop_front(End); 102 Buf = (End == Buf.npos) ? "" : Buf.drop_front(End);
103 return lex(); 103 return lex();
104 } 104 }
105 case '=': 105 case '=':
106 Buf = Buf.drop_front(); 106 Buf = Buf.drop_front();
107 // GNU dlltool accepts both = and ==. 107 if (Buf.startswith("=")) {
108 if (Buf.startswith("="))
109 Buf = Buf.drop_front(); 108 Buf = Buf.drop_front();
109 return Token(EqualEqual, "==");
110 }
110 return Token(Equal, "="); 111 return Token(Equal, "=");
111 case ',': 112 case ',':
112 Buf = Buf.drop_front(); 113 Buf = Buf.drop_front();
113 return Token(Comma, ","); 114 return Token(Comma, ",");
114 case '"': { 115 case '"': {
280 } 281 }
281 if (Tok.K == KwPrivate) { 282 if (Tok.K == KwPrivate) {
282 E.Private = true; 283 E.Private = true;
283 continue; 284 continue;
284 } 285 }
286 if (Tok.K == EqualEqual) {
287 read();
288 E.AliasTarget = Tok.Value;
289 if (Machine == IMAGE_FILE_MACHINE_I386 && !isDecorated(E.AliasTarget, MingwDef))
290 E.AliasTarget = std::string("_").append(E.AliasTarget);
291 continue;
292 }
285 unget(); 293 unget();
286 Info.Exports.push_back(E); 294 Info.Exports.push_back(E);
287 return Error::success(); 295 return Error::success();
288 } 296 }
289 } 297 }