This revision was automatically updated to reflect the committed changes. Closed by commit rGfcf75ae6ce20: [clang][cli] Fix generation of '-fvisibility' with regards to '-mignore-xcoff… (authored by jansvoboda11).
Changed prior to commit: https://reviews.llvm.org/D97552?vs=326676&id=328448#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97552/new/ https://reviews.llvm.org/D97552 Files: clang/include/clang/Driver/Options.td clang/lib/Frontend/CompilerInvocation.cpp Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -1831,6 +1831,23 @@ } } + // This is the reason why '-fvisibility' needs to be always generated: + // its absence implies '-mignore-xcoff-visibility'. + // + // Suppose the original cc1 command line does contain '-fvisibility default': + // '-mignore-xcoff-visibility' should not be implied. + // * If '-fvisibility' is not generated (as most options with default values + // don't), its absence would imply '-mignore-xcoff-visibility'. This changes + // the command line semantics. + // * If '-fvisibility' is generated regardless of its presence and value, + // '-mignore-xcoff-visibility' won't be implied and the command line + // semantics are kept intact. + // + // When the original cc1 command line does **not** contain '-fvisibility', + // '-mignore-xcoff-visibility' is implied. The generated command line will + // contain both '-fvisibility default' and '-mignore-xcoff-visibility' and + // subsequent calls to `CreateFromArgs`/`generateCC1CommandLine` will always + // produce the same arguments. if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility) || !Args.hasArg(OPT_fvisibility))) Opts.IgnoreXCOFFVisibility = 1; Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -5321,7 +5321,9 @@ MarshallingInfoInt<CodeGenOpts<"SSPBufferSize">, "8">; def fvisibility : Separate<["-"], "fvisibility">, HelpText<"Default type and symbol visibility">, - MarshallingInfoVisibility<LangOpts<"ValueVisibilityMode">, "DefaultVisibility">; + MarshallingInfoVisibility<LangOpts<"ValueVisibilityMode">, "DefaultVisibility">, + // Always emitting because of the relation to `-mignore-xcoff-visibility`. + AlwaysEmit; def ftype_visibility : Separate<["-"], "ftype-visibility">, HelpText<"Default type visibility">, MarshallingInfoVisibility<LangOpts<"TypeVisibilityMode">, fvisibility.KeyPath>;
Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -1831,6 +1831,23 @@ } } + // This is the reason why '-fvisibility' needs to be always generated: + // its absence implies '-mignore-xcoff-visibility'. + // + // Suppose the original cc1 command line does contain '-fvisibility default': + // '-mignore-xcoff-visibility' should not be implied. + // * If '-fvisibility' is not generated (as most options with default values + // don't), its absence would imply '-mignore-xcoff-visibility'. This changes + // the command line semantics. + // * If '-fvisibility' is generated regardless of its presence and value, + // '-mignore-xcoff-visibility' won't be implied and the command line + // semantics are kept intact. + // + // When the original cc1 command line does **not** contain '-fvisibility', + // '-mignore-xcoff-visibility' is implied. The generated command line will + // contain both '-fvisibility default' and '-mignore-xcoff-visibility' and + // subsequent calls to `CreateFromArgs`/`generateCC1CommandLine` will always + // produce the same arguments. if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility) || !Args.hasArg(OPT_fvisibility))) Opts.IgnoreXCOFFVisibility = 1; Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -5321,7 +5321,9 @@ MarshallingInfoInt<CodeGenOpts<"SSPBufferSize">, "8">; def fvisibility : Separate<["-"], "fvisibility">, HelpText<"Default type and symbol visibility">, - MarshallingInfoVisibility<LangOpts<"ValueVisibilityMode">, "DefaultVisibility">; + MarshallingInfoVisibility<LangOpts<"ValueVisibilityMode">, "DefaultVisibility">, + // Always emitting because of the relation to `-mignore-xcoff-visibility`. + AlwaysEmit; def ftype_visibility : Separate<["-"], "ftype-visibility">, HelpText<"Default type visibility">, MarshallingInfoVisibility<LangOpts<"TypeVisibilityMode">, fvisibility.KeyPath>;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits