r210402 - StringRefize TargetInfo::getABI()
Alp Toker
alp at nuanti.com
Sat Jun 7 16:30:42 PDT 2014
Author: alp
Date: Sat Jun 7 18:30:42 2014
New Revision: 210402
URL: http://llvm.org/viewvc/llvm-project?rev=210402&view=rev
Log:
StringRefize TargetInfo::getABI()
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=210402&r1=210401&r2=210402&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sat Jun 7 18:30:42 2014
@@ -632,9 +632,7 @@ public:
}
/// \brief Get the ABI currently in use.
- virtual const char *getABI() const {
- return "";
- }
+ virtual StringRef getABI() const { return StringRef(); }
/// \brief Get the C++ ABI currently in use.
TargetCXXABI getCXXABI() const {
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=210402&r1=210401&r2=210402&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Jun 7 18:30:42 2014
@@ -1863,7 +1863,7 @@ public:
bool hasFeature(StringRef Feature) const override;
bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) override;
- const char* getABI() const override {
+ StringRef getABI() const override {
if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
return "avx";
else if (getTriple().getArch() == llvm::Triple::x86 &&
@@ -3663,7 +3663,7 @@ public:
// zero length bitfield.
UseZeroLengthBitfieldAlignment = true;
}
- const char *getABI() const override { return ABI.c_str(); }
+ StringRef getABI() const override { return ABI; }
bool setABI(const std::string &Name) override {
ABI = Name;
@@ -4287,7 +4287,7 @@ public:
TheCXXABI.set(TargetCXXABI::GenericAArch64);
}
- virtual const char *getABI() const { return ABI.c_str(); }
+ StringRef getABI() const override { return ABI; }
virtual bool setABI(const std::string &Name) {
if (Name != "aapcs" && Name != "darwinpcs")
return false;
@@ -5222,7 +5222,7 @@ public:
IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) {}
- const char *getABI() const override { return ABI.c_str(); }
+ StringRef getABI() const override { return ABI; }
bool setABI(const std::string &Name) override = 0;
bool setCPU(const std::string &Name) override {
CPU = Name;
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=210402&r1=210401&r2=210402&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Sat Jun 7 18:30:42 2014
@@ -6480,7 +6480,7 @@ const TargetCodeGenInfo &CodeGenModule::
case llvm::Triple::arm64:
case llvm::Triple::arm64_be: {
AArch64ABIInfo::ABIKind Kind = AArch64ABIInfo::AAPCS;
- if (strcmp(getTarget().getABI(), "darwinpcs") == 0)
+ if (getTarget().getABI() == "darwinpcs")
Kind = AArch64ABIInfo::DarwinPCS;
return *(TheTargetCodeGenInfo = new AArch64TargetCodeGenInfo(Types, Kind));
@@ -6492,7 +6492,7 @@ const TargetCodeGenInfo &CodeGenModule::
case llvm::Triple::thumbeb:
{
ARMABIInfo::ABIKind Kind = ARMABIInfo::AAPCS;
- if (strcmp(getTarget().getABI(), "apcs-gnu") == 0)
+ if (getTarget().getABI() == "apcs-gnu")
Kind = ARMABIInfo::APCS;
else if (CodeGenOpts.FloatABI == "hard" ||
(CodeGenOpts.FloatABI != "soft" &&
@@ -6555,7 +6555,7 @@ const TargetCodeGenInfo &CodeGenModule::
}
case llvm::Triple::x86_64: {
- bool HasAVX = strcmp(getTarget().getABI(), "avx") == 0;
+ bool HasAVX = getTarget().getABI() == "avx";
switch (Triple.getOS()) {
case llvm::Triple::Win32:
More information about the cfe-commits
mailing list