diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2021-02-08 10:38:01 +0100 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2021-02-08 13:14:43 +0100 |
commit | e22677bbdbdc725463feaa1aa50f179964ce442b (patch) | |
tree | cb7cfc6b1ee9653d613018ee9009099cb9e7251d /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 05d7d6949c7cd3f1566d4c8394fa59160a7ffd05 (diff) | |
download | llvm-e22677bbdbdc725463feaa1aa50f179964ce442b.zip llvm-e22677bbdbdc725463feaa1aa50f179964ce442b.tar.gz llvm-e22677bbdbdc725463feaa1aa50f179964ce442b.tar.bz2 |
Reapply "[clang][cli] Report result of ParseLangArgs"
This reverts commit 6039f821 and reapplies bff6d9bb.
Clang's Index/implicit-attrs.m test invokes c-index-test with -fobjc-arc. This flag is not compatible with -fobjc-runtime=gcc, which gets implied on Linux.
The original commit uncovered this by correctly reporting issues when parsing -cc1 command line.
This commit fixes the test to explicitly provide ObjectiveC runtime compatible with ARC.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f4104a3..e131804 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2642,10 +2642,12 @@ static void GenerateLangArgs(const LangOptions &Opts, GenerateArg(Args, OPT_fdeclare_opencl_builtins, SA); } -void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, +bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, const llvm::Triple &T, std::vector<std::string> &Includes, DiagnosticsEngine &Diags) { + unsigned NumErrorsBefore = Diags.getNumErrors(); + // FIXME: Cleanup per-file based stuff. LangStandard::Kind LangStd = LangStandard::lang_unspecified; if (const Arg *A = Args.getLastArg(OPT_std_EQ)) { @@ -3076,6 +3078,8 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, } } } + + return Success && Diags.getNumErrors() == NumErrorsBefore; } static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) { @@ -3416,8 +3420,8 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, } else { // Other LangOpts are only initialized when the input is not AST or LLVM IR. // FIXME: Should we really be calling this for an Language::Asm input? - ParseLangArgs(LangOpts, Args, DashX, T, Res.getPreprocessorOpts().Includes, - Diags); + Success &= ParseLangArgs(LangOpts, Args, DashX, T, + Res.getPreprocessorOpts().Includes, Diags); if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC) LangOpts.ObjCExceptions = 1; if (T.isOSDarwin() && DashX.isPreprocessed()) { |