[PATCH] D33356: [Nios2] Changes in frontend to support Nios2 LLVM target
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 30 01:14:03 PDT 2017
ahatanak added a comment.
A couple of coding style nits. FYI, LLVM coding standard is documented here:
http://llvm.org/docs/CodingStandards.html
================
Comment at: include/clang/Basic/TargetBuiltins.h:154
+ /// \brief Nios2 builtins
+ namespace Nios2 {
+ enum {
----------------
No need to indent enum inside namespace.
http://llvm.org/docs/CodingStandards.html#namespace-indentation
================
Comment at: lib/Basic/Targets.cpp:7609
+ void setDataLayout() {
+ if (BigEndian) {
+ resetDataLayout("E-p:32:32:32-i8:8:32-i16:16:32-n32");
----------------
No need for curly braces here.
================
Comment at: lib/Basic/Targets.cpp:7631
+ bool setABI(const std::string &Name) override {
+ if ((Name == "o32") || (Name == "eabi")) {
+ ABI = Name;
----------------
You don't need the inner parentheses here and the code below.
================
Comment at: lib/Basic/Targets.cpp:7685
+ bool hasFeature(StringRef Feature) const override {
+ return isFeatureSupportedByCPU(Feature, CPU);
+ }
----------------
Two space indentation here.
================
Comment at: lib/Driver/ToolChains/CommonArgs.cpp:220
+ Arg *A = Args.getLastArg(options::OPT_mcpu_EQ);
+ if (A == nullptr)
+ A = Args.getLastArg(options::OPT_march_EQ);
----------------
You can just write "if (!A)". Also, you can move up the return statement at the end of the function and do an early return.
```
if (A!) {
...
return ""
}
const *name = A->getValue();
...
```
https://reviews.llvm.org/D33356
More information about the cfe-commits
mailing list