[clang][ToolChains] explicitly return LangOptions::StackProtectorMode
authorNick Desaulniers <ndesaulniers@google.com>
Wed, 28 Oct 2020 18:13:14 +0000 (11:13 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Wed, 28 Oct 2020 18:20:30 +0000 (11:20 -0700)
commitcdff3bd932870cc9f84c6828cb1a7bb0df3c5fa0
tree8fc8a496b2d242bda6d4812f0d4e84e0736e73cd
parent40dd4d5233d9f81705a24d91b48d2620e487b89d
[clang][ToolChains] explicitly return LangOptions::StackProtectorMode

Make the virtual method Toolchain::GetDefaultStackProtectorLevel()
return an explict enum value rather than an integral constant. This
makes the code subjectively easier to read, and should help prevent bugs
that may (or may never) arise from changing the enum values. Previously,
these were just kept in sync via a comment, which is brittle. The trade
off is including a additional header in a few new places. It is not
necessary, but in my opinion helps the readability.

Split off from https://reviews.llvm.org/D90194 to help cut down on lines
changed in code review.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D90271
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CrossWindows.h
clang/lib/Driver/ToolChains/Darwin.h
clang/lib/Driver/ToolChains/Fuchsia.h
clang/lib/Driver/ToolChains/OpenBSD.h
clang/lib/Driver/ToolChains/PS4CPU.h