-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support partial preprocessing with clang #37
Comments
Yeah, I think |
FWIW, I tried this quick hack with the Envoy build, and it ended up not being able to resolve libstdc++ types properly. Not sure whether there's something more needed to get partial pre-processing to work with clang, or whether this Bael making some aggressive assumptions. --- cmd/llamacc/main.go
+++ cmd/llamacc/main.go
@@ -196,7 +196,7 @@ func buildLocalPreprocess(ctx context.Context, client *daemon.Client, cfg *Confi
preprocessor.Args = []string{comp.LocalCompiler(cfg)}
preprocessor.Args = append(preprocessor.Args, comp.LocalArgs...)
if !cfg.FullPreprocess {
- preprocessor.Args = append(preprocessor.Args, "-fdirectives-only")
+ preprocessor.Args = append(preprocessor.Args, "-frewrite-includes")
}
preprocessor.Args = append(preprocessor.Args, "-E", "-o", "-", comp.Input)
preprocessor.Stdout = &preprocessed
@@ -224,7 +224,7 @@ func buildLocalPreprocess(ctx context.Context, client *daemon.Client, cfg *Confi
args.Args = []string{comp.RemoteCompiler(cfg)}
args.Args = append(args.Args, comp.RemoteArgs...)
if !cfg.FullPreprocess {
- args.Args = append(args.Args, "-fdirectives-only", "-fpreprocessed")
+ args.Args = append(args.Args, "-frewrite-includes")
}
args.Args = append(args.Args, "-x", comp.PreprocessedLanguage, "-o", comp.Output, "-")
|
OK, I figured this one out. We need to pass all the Defs along to the remote build as well as the |
When doing partial local preprocessing, a remote clang compilation still needs the preprocessor definitions from the command line so that the remaining preprocessing can be performed correctly. Partial preprocessing is necessary to prevent the remote compiler issuing spurious warnings from macro expansion that would be suppressed in a local compilation. This means when spawning a compilation, we should always use either `LocalArgs` or `RemoteArgs`, and the need to separately preserve unknown arguments and conditionally restore preprocessor definitions goes away. This updates nelhage#37.
This one made me scratch my head a bit because I assumed it was a Bazel problem and didn't look in the llama docs for it 😂
-fdirectives-only
doesn't work with clang. Perhaps there's an alternative that works with both compilers? There is a short thread discussing how clang's-frewrite-includes
differs, but maybe the difference doesn't matter for llama?The text was updated successfully, but these errors were encountered: