[llvm] [llvm-ml] Remove unsafe getCurrentSegmentOnly() call (PR #123355)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 13:33:57 PST 2025


================
@@ -441,6 +441,11 @@ bool COFFMasmParser::parseDirectiveOption(StringRef Directive, SMLoc Loc) {
 ///          statements
 ///      label "endproc"
 bool COFFMasmParser::parseDirectiveProc(StringRef Directive, SMLoc Loc) {
+  if (!getStreamer().getCurrentFragment()) {
+    return Error(getTok().getLoc(), "expected section directive before '" +
----------------
MaskRay wrote:

The convention is to just state `expected something` and omit `before directive ...`. The `before directive` information is obvious from the source line that is printed

https://github.com/llvm/llvm-project/pull/123355


More information about the llvm-commits mailing list