Skip to content

Conversation

@makslevental
Copy link
Contributor

@makslevental makslevental commented Jun 27, 2025

See https://lists.llvm.org/pipermail/cfe-dev/2018-April/057579.html

Based on https://github.com/jensl/llvm-project-20170507/tree/wip/jumbo-support/v1

(Unity building here called "jumbo" because it is called that in the context of the Chromium project.)

This adds an example plugin named JumboSupport that adds a pragma named jumbo, which signals that the main source file is a jumbo compilation unit that will include other source files. After each include into the main source file, the contents of all anonymous namespace declarations in the included source file are hidden, so that the anonymous namespace remains local to source files. It also undefines all macros defined in the included source file.

Some (intentionally) minimal changes to clang is implemented to make it possible to implement this functionality in the plugin.

(Unity building here called "jumbo" because it is called that in the
context of the Chromium project.)

This adds an example plugin named `JumboSupport` that adds a pragma
named `jumbo`, which signals that the main source file is a jumbo
compilation unit that will include other source files. After each
include into the main source file, the contents of all anonymous
namespace declarations in the included source file are hidden, so
that the anonymous namespace remains local to source files. It also
undefines all macros defined in the included source file.

Some (intentionally) minimal changes to clang is implemented to
make it possible to implement this functionality in the plugin.
@github-actions
Copy link

github-actions bot commented Jun 27, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- clang/examples/JumboSupport/JumboSupport.cpp clang/include/clang/AST/Decl.h clang/lib/AST/ItaniumMangle.cpp clang/lib/Sema/SemaLookup.cpp
View the diff from clang-format here.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 17552c23d..2256d54f5 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -24,12 +24,12 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprConcepts.h"
-#include "clang/Basic/SourceManager.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/Mangle.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/ABI.h"
 #include "clang/Basic/Module.h"
+#include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/Thunk.h"
 #include "llvm/ADT/StringExtras.h"

@makslevental makslevental force-pushed the makslevental/unity-build-v2 branch from bc62c34 to 7a0bde8 Compare June 27, 2025 18:44
@makslevental makslevental force-pushed the makslevental/unity-build-v2 branch from 7a0bde8 to ece06da Compare June 27, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant