[clang] [clang][tools] Handle weak (and duplicate) symbols in clang-extdef-mapping (PR #222010)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 03:22:57 PDT 2026


================
@@ -43,25 +43,26 @@ class MapExtDefNamesConsumer : public ASTConsumer {
     CurrentFileName = astFilePath.str();
   }
 
-  ~MapExtDefNamesConsumer() {
-    // Flush results to standard output.
-    llvm::outs() << createCrossTUIndexString(Index);
-  }
-
   void HandleTranslationUnit(ASTContext &Context) override {
     handleDecl(Context.getTranslationUnitDecl());
   }
 
+  static void printIndex() { llvm::outs() << createCrossTUIndexString(Index); }
+
 private:
   void handleDecl(const Decl *D);
   void addIfInMain(const DeclaratorDecl *DD, SourceLocation defStart);
 
   ASTContext &Ctx;
   SourceManager &SM;
-  llvm::StringMap<std::string> Index;
+  static llvm::StringMap<std::string> Index;
+  static llvm::StringSet<> WeakNames;
----------------
balazske wrote:

This data is needed, it was a bug to not use it.

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


More information about the cfe-commits mailing list