[all-commits] [llvm/llvm-project] 31d375: CGDebugInfo: Drop Loc.isInvalid() special case fro...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jan 26 11:45:02 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 31d375f178c27f258ab640afa613a595e67f92f2
      https://github.com/llvm/llvm-project/commit/31d375f178c27f258ab640afa613a595e67f92f2
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-01-26 (Tue, 26 Jan 2021)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp

  Log Message:
  -----------
  CGDebugInfo: Drop Loc.isInvalid() special case from getLineNumber

`getLineNumber()` picks CurLoc if the parameter is invalid. This appears to
mainly work around missing SourceLocation information for some constructs, but
sometimes adds unintended locations.

* For `CodeGenObjC/debug-info-blocks.m`, `CurLoc` has been advanced to the closing brace. The debug line of `ImplicitVarParameter` is set to the line of `}` because this implicit parameter has an invalid `SourceLocation`. The debug line is a bit arbitrary - perhaps the location of `^{` is better.
* The file/line of Clang synthesized `__va_list_tag` is arbitrarily attached a `#include` line. D94735

Drop the special case to make getLineNumber less magic and add CurLoc fallback in its callers instead.

Tested with stage 2 -DCMAKE_BUILD_TYPE=Debug clang, byte identical.

Reviewed By: #debug-info, aprantl

Differential Revision: https://reviews.llvm.org/D94391




More information about the All-commits mailing list