aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 89e485a..2606e9f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1483,9 +1483,6 @@ void CompilerInvocation::GenerateCodeGenArgs(
GenerateArg(Args, Opt, SA);
}
- if (Opts.IgnoreXCOFFVisibility)
- GenerateArg(Args, OPT_mignore_xcoff_visibility, SA);
-
if (Opts.EnableAIXExtendedAltivecABI)
GenerateArg(Args, OPT_mabi_EQ_vec_extabi, SA);
@@ -1831,27 +1828,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
}
}
- // 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;
-
if (Arg *A =
Args.getLastArg(OPT_mabi_EQ_vec_default, OPT_mabi_EQ_vec_extabi)) {
if (!T.isOSAIX())
@@ -3342,6 +3318,9 @@ void CompilerInvocation::GenerateLangArgs(const LangOptions &Opts,
Twine(Major) + "." + Twine(Minor) + "." + Twine(Patch), SA);
}
+ if (Opts.IgnoreXCOFFVisibility)
+ GenerateArg(Args, OPT_mignore_xcoff_visibility, SA);
+
if (Opts.SignedOverflowBehavior == LangOptions::SOB_Trapping) {
GenerateArg(Args, OPT_ftrapv, SA);
GenerateArg(Args, OPT_ftrapv_handler, Opts.OverflowHandler, SA);
@@ -3649,6 +3628,30 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.GNUCVersion = Major * 100 * 100 + Minor * 100 + Patch;
}
+ // In AIX OS, the -mignore-xcoff-visibility is enable by default if there is
+ // no -fvisibility=* option.
+ // 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;
+
if (Args.hasArg(OPT_ftrapv)) {
Opts.setSignedOverflowBehavior(LangOptions::SOB_Trapping);
// Set the handler, if one is specified.