continue #15456 add #pragma directives compiler support (#16472)

* continue #15456
* follow the advice from juan_carlos
This commit is contained in:
flywind 2021-01-04 04:34:13 -06:00 • committed by GitHub
commit acf3715ea8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -653,12 +653,19 @@ proc genParForStmt(p: BProc, t: PNode) =
initLocExpr(p, call[2], rangeB) initLocExpr(p, call[2], rangeB)
# $n at the beginning because of #9710 # $n at the beginning because of #9710
if call.len == 4: # `||`(a, b, annotation) if call.len == 4: # procName(a, b, annotation)
if call[0].sym.name.s == "||": # `||`(a, b, annotation)
lineF(p, cpsStmts, "$n#pragma omp $4$n" & lineF(p, cpsStmts, "$n#pragma omp $4$n" &
"for ($1 = $2; $1 <= $3; ++$1)", "for ($1 = $2; $1 <= $3; ++$1)",
[forLoopVar.loc.rdLoc, [forLoopVar.loc.rdLoc,
rangeA.rdLoc, rangeB.rdLoc, rangeA.rdLoc, rangeB.rdLoc,
call[3].getStr.rope]) call[3].getStr.rope])
else:
lineF(p, cpsStmts, "$n#pragma $4$n" &
"for ($1 = $2; $1 <= $3; ++$1)",
[forLoopVar.loc.rdLoc,
rangeA.rdLoc, rangeB.rdLoc,
call[3].getStr.rope])
else: # `||`(a, b, step, annotation) else: # `||`(a, b, step, annotation)
var step: TLoc var step: TLoc
initLocExpr(p, call[3], step) initLocExpr(p, call[3], step)