----- Original Message ----- > http://llvm.org/bugs/show_bug.cgi?id=16454 demonstrates that > altivec.h > is being included along paths where it doesn't make much sense to do > so. > This file is auto-included when compiling with -faltivec. What I'm > proposing is to avoid copying the -faltivec flag when the action > being > taken is to invoke the assembler or the preprocessor. > > I've verified that this fixes the test case in question without > introducing any unit-test or test-suite regressions. I also verified > that preprocessing a file requiring altivec extensions (like "vector > float x;") with the revised Clang and then compiling the resulting > preprocessed file still works correctly. > > However, I really don't know anything about how all the driver > machinery > works, so I'd appreciate some extra eyes on this before I commit. > I'm > CC'ing a few folks that were suggested. > > For what it's worth, the test case in question is fixed by the > isa<PreprocessJobAction> test. The other test is there just because > it > makes sense to me. > > I will add the original test from the PR as a unit test if this > approach > passes muster.
I think that this makes sense; so the job action is not available from within Frontend/CompilerInvocation.cpp where the file is actually included? To confirm, if you compile something with clang that crashes, thus generating a preprocessed input file, the contents of altivec.h will no longer be copied into that file, correct? -Hal > > Thanks, > Bill > > > Index: lib/Driver/Tools.cpp > =================================================================== > --- lib/Driver/Tools.cpp (revision 184947) > +++ lib/Driver/Tools.cpp (working copy) > @@ -2844,7 +2844,10 @@ void Clang::ConstructJob(Compilation &C, const > Job > Args.AddLastArg(CmdArgs, options::OPT_flimit_debug_info); > Args.AddLastArg(CmdArgs, options::OPT_fno_limit_debug_info); > Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names); > - Args.AddLastArg(CmdArgs, options::OPT_faltivec); > + // -faltivec causes inclusion of altivec.h, which makes no sense > for > + // an assembly or preprocess action. > + if (!isa<AssembleJobAction>(JA) && !isa<PreprocessJobAction>(JA)) > + Args.AddLastArg(CmdArgs, options::OPT_faltivec); > Args.AddLastArg(CmdArgs, > options::OPT_fdiagnostics_show_template_tree); > Args.AddLastArg(CmdArgs, options::OPT_fno_elide_type); > > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > -- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
