[PATCH] D120989: Support debug info for alias variable

Kavitha Natarajan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 23:44:28 PST 2022


kavitha-natarajan added inline comments.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3921
+      return cast<llvm::DINode>(GVE);
+    return dyn_cast_or_null<llvm::DINode>(N);
+  }
----------------
aprantl wrote:
> When would we enter a nullptr into the cache?
In this change, only llvm::DIImportedEntity entries are pushed to ImportedDeclCache. So it will never return nullptr. It is only a guard to not to fall into the case of no definition in case of non llvm::DIImportedEntity in the cache (undesired and to be handled by the caller).


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1502
+const GlobalDecl CodeGenModule::getMangledNameDecl(StringRef Name) {
+  auto it = MangledDeclNames.begin();
+  while (it != MangledDeclNames.end()) {
----------------
aprantl wrote:
> std::find()?
MangledDeclNames is a llvm::MapVector implementation, so can't use std::find(). The key for MangledDeclNames MapVector is GlobalDecl and StringRef is the value. llvm::Mapvector::find() is search by key. Here we are doing search by value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120989/new/

https://reviews.llvm.org/D120989



More information about the cfe-commits mailing list