[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
Fri Sep 11 08:52:13 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:

The test "weak-strong.c" is failing now if the condition `!ExistingIsWeak` (where `WeakNames` is used) is left out.

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


More information about the cfe-commits mailing list