Fznamznon wrote: > Can you share what the Static assert complaint is that makes you think we > should be doing this?
The complaint is that `Preprocessor::addPragmaHandler` called from parser with a raw ptr argument coming from a `unique_ptr` owned by Parser actually initializes another `unique_ptr` with that same raw ptr (the second `unique_ptr` is stored in a `PragmaNamespace` which is owned by `Preprocessor`). That results in two `unique_ptr`s that manage the same memory at the same time. Which seems dangerous. This also creates a requirement to not forget to call `removePragmaHandler` at the right time, otherwise the two `unique_ptr`s may cause double free. It seems I can't get rid of PragmaHandlers in Parser, since some of the handlers are "added" to Preprocessor under different namespaces using the same pointer owned by Parser (example UnrollHintHandler). It seems I can't remove a smart pointer from `PragmaNamespace` either since Preprocessor itself adds some handlers via `addPragmaHandler` (see `Preprocessor::RegisterBuiltinPragmas`) which are not stored anywhere. The two `unique_ptr`s created for the same raw pointer makes me think it should be a `shared_ptr` instead. https://github.com/llvm/llvm-project/pull/117703 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits