[PATCH] D94735: CGDebugInfo CreatedLimitedType: Drop file/line for RecordType with invalid location
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 15 16:28:43 PST 2021
MaskRay added inline comments.
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3338-3340
+ const SourceLocation Loc = RD->getLocation();
+ llvm::DIFile *DefUnit = Loc.isValid() ? getOrCreateFile(Loc) : nullptr;
+ const unsigned Line = getLineNumber(Loc);
----------------
dblaikie wrote:
> Might be more readable, even though it provides the same behavior, with something like:
> ```
> llvm::DIFile *DefUnit = nullptr;
> unsigned Line = 0;
> if (SourceLocation Loc = RD->getLocation(); Loc.isValid()) {
> DefUnit = getOrCreateFile(Loc);
> Line = getLineNumber(Loc);
> }
> ```
init-statement in if is C++17, rejected by MSVC and warned by clang -std=c++14... `[-Wc++17-extensions]`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94735/new/
https://reviews.llvm.org/D94735
More information about the cfe-commits
mailing list