r202880 - Pass llvm::Triple objects by const reference.
Benjamin Kramer
benny.kra at googlemail.com
Tue Mar 4 11:31:42 PST 2014
Author: d0k
Date: Tue Mar 4 13:31:42 2014
New Revision: 202880
URL: http://llvm.org/viewvc/llvm-project?rev=202880&view=rev
Log:
Pass llvm::Triple objects by const reference.
Copying isn't cheap as it contains a std::string.
Modified:
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/AST/Mangle.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Sema/AttributeList.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=202880&r1=202879&r2=202880&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Tue Mar 4 13:31:42 2014
@@ -493,7 +493,7 @@ public:
unsigned getMaxArgs() const;
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const;
bool diagnoseLangOpts(class Sema &S) const;
- bool existsInTarget(llvm::Triple T) const;
+ bool existsInTarget(const llvm::Triple &T) const;
bool isKnownToGCC() const;
/// \brief If the parsed attribute has a semantic equivalent, and it would
Modified: cfe/trunk/lib/AST/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Mangle.cpp?rev=202880&r1=202879&r2=202880&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Mangle.cpp (original)
+++ cfe/trunk/lib/AST/Mangle.cpp Tue Mar 4 13:31:42 2014
@@ -64,7 +64,7 @@ static bool isExternC(const NamedDecl *N
static StdOrFastCC getStdOrFastCallMangling(const ASTContext &Context,
const NamedDecl *ND) {
const TargetInfo &TI = Context.getTargetInfo();
- llvm::Triple Triple = TI.getTriple();
+ const llvm::Triple &Triple = TI.getTriple();
if (!Triple.isOSWindows() || Triple.getArch() != llvm::Triple::x86)
return SOF_OTHER;
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=202880&r1=202879&r2=202880&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Mar 4 13:31:42 2014
@@ -2757,7 +2757,7 @@ static Distro DetectDistro(llvm::Triple:
/// a target-triple directory in the library and header search paths.
/// Unfortunately, this triple does not align with the vanilla target triple,
/// so we provide a rough mapping here.
-static std::string getMultiarchTriple(const llvm::Triple TargetTriple,
+static std::string getMultiarchTriple(const llvm::Triple &TargetTriple,
StringRef SysRoot) {
// For most architectures, just use whatever we have rather than trying to be
// clever.
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=202880&r1=202879&r2=202880&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 4 13:31:42 2014
@@ -5983,7 +5983,7 @@ void freebsd::Assemble::ConstructJob(Com
} else if (getToolChain().getArch() == llvm::Triple::arm ||
getToolChain().getArch() == llvm::Triple::thumb) {
const Driver &D = getToolChain().getDriver();
- llvm::Triple Triple = getToolChain().getTriple();
+ const llvm::Triple &Triple = getToolChain().getTriple();
StringRef FloatABI = arm::getARMFloatABI(D, Args, Triple);
if (FloatABI == "hard") {
@@ -6591,7 +6591,7 @@ void gnutools::Assemble::ConstructJob(Co
SplitDebugName(Args, Inputs));
}
-static void AddLibgcc(llvm::Triple Triple, const Driver &D,
+static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
ArgStringList &CmdArgs, const ArgList &Args) {
bool isAndroid = Triple.getEnvironment() == llvm::Triple::Android;
bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=202880&r1=202879&r2=202880&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Tue Mar 4 13:31:42 2014
@@ -2132,7 +2132,7 @@ StmtResult Parser::ParseMicrosoftAsmStat
SmallVector<StringRef, 4> ClobberRefs;
// We need an actual supported target.
- llvm::Triple TheTriple = Actions.Context.getTargetInfo().getTriple();
+ const llvm::Triple &TheTriple = Actions.Context.getTargetInfo().getTriple();
llvm::Triple::ArchType ArchTy = TheTriple.getArch();
const std::string &TT = TheTriple.getTriple();
const llvm::Target *TheTarget = 0;
Modified: cfe/trunk/lib/Sema/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AttributeList.cpp?rev=202880&r1=202879&r2=202880&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AttributeList.cpp (original)
+++ cfe/trunk/lib/Sema/AttributeList.cpp Tue Mar 4 13:31:42 2014
@@ -155,7 +155,7 @@ struct ParsedAttrInfo {
bool (*DiagAppertainsToDecl)(Sema &S, const AttributeList &Attr,
const Decl *);
bool (*DiagLangOpts)(Sema &S, const AttributeList &Attr);
- bool (*ExistsInTarget)(llvm::Triple T);
+ bool (*ExistsInTarget)(const llvm::Triple &T);
unsigned (*SpellingIndexToSemanticSpelling)(const AttributeList &Attr);
};
@@ -195,7 +195,7 @@ bool AttributeList::isTypeAttr() const {
return getInfo(*this).IsType;
}
-bool AttributeList::existsInTarget(llvm::Triple T) const {
+bool AttributeList::existsInTarget(const llvm::Triple &T) const {
return getInfo(*this).ExistsInTarget(T);
}
Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=202880&r1=202879&r2=202880&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue Mar 4 13:31:42 2014
@@ -2237,7 +2237,7 @@ static std::string GenerateLangOptRequir
}
static void GenerateDefaultTargetRequirements(raw_ostream &OS) {
- OS << "static bool defaultTargetRequirements(llvm::Triple) {\n";
+ OS << "static bool defaultTargetRequirements(const llvm::Triple &) {\n";
OS << " return true;\n";
OS << "}\n\n";
}
@@ -2313,7 +2313,7 @@ static std::string GenerateTargetRequire
if (I != CustomTargetSet.end())
return *I;
- OS << "static bool " << FnName << "(llvm::Triple T) {\n";
+ OS << "static bool " << FnName << "(const llvm::Triple &T) {\n";
OS << " llvm::Triple::ArchType Arch = T.getArch();\n";
if (UsesOS)
OS << " llvm::Triple::OSType OS = T.getOS();\n";
More information about the cfe-commits
mailing list