llvm-project
8fe33a05 - [NFC] Fix evaluation order dependency in call arguments (#141366)

Commit
126 days ago
[NFC] Fix evaluation order dependency in call arguments (#141366) The code in `ARMAsmParser::parseDirectiveReq` passes both `parseRegister(Reg, SRegLoc, ERegLoc)` and `SRegLoc` as arguments to `check()`. Since function arguments are indeterminately sequenced per C++17 [expr.call]/5, a compiler can evaluate `SRegLoc` before `parseRegister()` executes. This means `check()` receives a null location instead of the actual parsed source location for error reporting. The fix separates the calls to establish explicit sequencing, ensuring `check()` receives the correct source location. This issue was detected by [the CFamily analyzer for SonarQube](https://www.sonarsource.com/knowledge/languages/cpp/). I'm happy to provide any additional information or clarification as needed.
Parents
Loading