Skip to content

Commit

Permalink
change flags, but break clang
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWF committed Jul 6, 2024
1 parent c8290ce commit d19459f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -827,5 +827,4 @@ def err_drv_contract_group_name_invalid : Error<
"|cannot be empty"
"|\"%2\" is an invalid value"
"}0">;

}
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ def fcontract_evaluation_semantic_EQ : Joined<["-"], "fcontract-evaluation-seman
NormalizedValues<["Ignore", "Enforce", "Observe", "QuickEnforce"]>,
MarshallingInfoEnum<LangOpts<"ContractEvalSemantic">, "Enforce">;

def fclang_contract_groups_EQ : CommaJoined<["-"], "fclang-contract-groups=">,
def fcontract_group_evaluation_semantic_EQ : CommaJoined<["-"], "fcontract-group-evaluation-semantic=">,
Visibility<[ClangOption, CC1Option]>,
HelpText<"Clang extension. Enable or disable contracts by group. The argument is a comma-separated "
"sequence of one or more group names, each prefixed by '+' or '-'.">;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7258,8 +7258,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Twine("-fcontract-evaluation-semantic=") + A->getValue()));
}
std::vector<std::string> ContractGroups =
Args.getAllArgValues(options::OPT_fclang_contract_groups_EQ);
CmdArgs.push_back(Args.MakeArgString(Twine("-fclang-contract-groups=") +
Args.getAllArgValues(options::OPT_fcontract_group_evaluation_semantic_EQ);
CmdArgs.push_back(Args.MakeArgString(Twine("-fcontract-group-evaluation-semantic=") +
llvm::join(ContractGroups, ",")));

}();
Expand Down
8 changes: 5 additions & 3 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3512,9 +3512,11 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,
GenerateArg(Consumer, OPT_pic_is_pie);
for (StringRef Sanitizer : serializeSanitizerKinds(Opts.Sanitize))
GenerateArg(Consumer, OPT_fsanitize_EQ, Sanitizer);


for (StringRef ContractGroup :
Opts.ContractOptions.serializeContractGroupArgs())
GenerateArg(Consumer, OPT_fclang_contract_groups_EQ, ContractGroup);
GenerateArg(Consumer, OPT_fcontract_group_evaluation_semantic_EQ, ContractGroup);
return;
}

Expand Down Expand Up @@ -3789,7 +3791,7 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,

for (StringRef ContractGroup :
Opts.ContractOptions.serializeContractGroupArgs())
GenerateArg(Consumer, OPT_fclang_contract_groups_EQ, ContractGroup);
GenerateArg(Consumer, OPT_fcontract_group_evaluation_semantic_EQ, ContractGroup);
}

bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
Expand Down Expand Up @@ -4426,7 +4428,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
};

std::vector<std::string> ContractGroupValues =
Args.getAllArgValues(options::OPT_fclang_contract_groups_EQ);
Args.getAllArgValues(options::OPT_fcontract_group_evaluation_semantic_EQ);
Opts.ContractOptions.parseContractGroups(ContractGroupValues,
EmitContractDiag);

Expand Down
6 changes: 3 additions & 3 deletions libcxx/include/contracts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public:
unsigned __line_;
};

contract_violation(_Info __info) noexcept
explicit contract_violation(_Info __info) noexcept
: __info_(__info) {}


Expand All @@ -70,13 +70,13 @@ _LIBCPP_EXPORTED_FROM_ABI void invoke_default_contract_violation_handler(const c

} // namespace std::contracts

_LIBCPP_WEAK void handle_contract_violation(const std::contracts::contract_violation&) noexcept;
_LIBCPP_WEAK void handle_contract_violation(const std::contracts::contract_violation&);


extern "C" {
_LIBCPP_EXPORTED_FROM_ABI
void __handle_contract_violation(unsigned kind, unsigned eval_semantic,
unsigned detection_mode, const char* comment, const char* file, unsigned line);
unsigned detection_mode, const char* comment, const char* file, unsigned line);
}


Expand Down
1 change: 0 additions & 1 deletion libcxx/src/contracts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
namespace std::contracts {

void invoke_default_contract_violation_handler(const contract_violation& violation) noexcept {

::handle_contract_violation(violation);
}

Expand Down

0 comments on commit d19459f

Please sign in to comment.