a few tiny cleanups (#5712)

exposes emitLazily (for nlvm) and simplifies some conditionals
This commit is contained in:
Jacek Sieka 2017-05-29 15:42:26 +08:00 • committed by Andreas Rumpf
commit ba4cc4bf35
4 changed files with 12 additions and 30 deletions

View file

@ -11,7 +11,7 @@
import
ast, astalgo, ropes, hashes, strutils, types, msgs, wordrecg,
platform, trees
platform, trees, options
proc getPragmaStmt*(n: PNode, w: TSpecialWord): PNode =
case n.kind
@ -211,20 +211,8 @@ proc mangle*(name: string): string =
if requiresUnderscore:
result.add "_"
proc makeLLVMString*(s: string): Rope =
const MaxLineLength = 64
result = nil
var res = "c\""
for i in countup(0, len(s) - 1):
if (i + 1) mod MaxLineLength == 0:
add(result, rope(res))
setLen(res, 0)
case s[i]
of '\0'..'\x1F', '\x7F'..'\xFF', '\"', '\\':
add(res, '\\')
add(res, toHex(ord(s[i]), 2))
else: add(res, s[i])
add(res, "\\00\"")
add(result, rope(res))
proc emitLazily*(s: PSym): bool {.inline.} =
result = optDeadCodeElim in gGlobalOptions or
sfDeadCodeElim in getModule(s).flags
initTypeTables()