================
@@ -41,8 +50,26 @@ void ImplementationInNamespaceCheck::check(
 
   // Enforce that the namespace is the result of macro expansion
   if (Result.SourceManager->isMacroBodyExpansion(NS->getLocation()) == false) {
-    diag(NS->getLocation(), "the outermost namespace should be the '%0' macro")
-        << RequiredNamespaceDeclMacroName;
+    auto DB = diag(NS->getLocation(),
+                   "the outermost namespace should be the '%0' macro")
+              << RequiredNamespaceDeclMacroName;
+
+    // TODO: Determine how to split inline namespaces correctly in the 
FixItHint
+    //
+    // We can't easily replace LIBC_NAMEPACE::inner::namespace { with
+    //
+    // namespace LIBC_NAMEPACE_DECL {
+    //   namespace inner::namespace {
+    //
+    // For now, just update the simple case w/ LIBC_NAMEPACE_DECL
+    if (!NS->isInlineNamespace())
+      DB << FixItHint::CreateReplacement(NS->getLocation(),
+                                         RequiredNamespaceDeclMacroName);
+
+    DB << IncludeInserter.createIncludeInsertion(
+        Result.SourceManager->getFileID(NS->getBeginLoc()),
+        NamespaceMacroHeader);
----------------
5chmidti wrote:

+-: It might be a bit weird to add an include without the macro

https://github.com/llvm/llvm-project/pull/99681
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to