]> granicus.if.org Git - clang/commitdiff
Pass llvm::Triple objects by const reference.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 4 Mar 2014 19:31:42 +0000 (19:31 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 4 Mar 2014 19:31:42 +0000 (19:31 +0000)
Copying isn't cheap as it contains a std::string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202880 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/AttributeList.h
lib/AST/Mangle.cpp
lib/Driver/ToolChains.cpp
lib/Driver/Tools.cpp
lib/Parse/ParseStmt.cpp
lib/Sema/AttributeList.cpp
utils/TableGen/ClangAttrEmitter.cpp

index 6d48e38e3eb2e09a195061a31ff4032d6f3bb50f..6a326f2a4d4e7e0502945462820d5f79fe83128b 100644 (file)
@@ -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
index 6ab2406079b9a1b4479a675dc25cbb4d39a64bb5..96e844746c6c9b8526f9b1170ed203bdaa891c28 100644 (file)
@@ -64,7 +64,7 @@ static bool isExternC(const NamedDecl *ND) {
 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;
 
index 83ba05b47f04d0ea0a3433710c7a6ab08f57f55b..9232a5d4b0c9cb24568d58d685eaab597876c3d6 100644 (file)
@@ -2757,7 +2757,7 @@ static Distro DetectDistro(llvm::Triple::ArchType Arch) {
 /// 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.
index 911b6a02aee9456cf6266b5c5b968047f208efc1..abc8f7dc9af6d2ffe355b6d7b4b4fdd99e6e62a2 100644 (file)
@@ -5983,7 +5983,7 @@ void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
   } 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(Compilation &C, const JobAction &JA,
                    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) ||
index 0be14f07ae858047bc8d7baa37376d7025d4fbcb..87074cc09fbbfd65c100e096c8c87377817ca4d2 100644 (file)
@@ -2132,7 +2132,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
   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;
index 7258b37ffe9809ebb94dacdf02416188fd7679b5..c4c1b805c1617ceaf93ea2d7e84fff801035bbbe 100644 (file)
@@ -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);
 }
 
index 44f14229f70393ec75c20cd3dbabb1a81994f735..b073760414901ec14dfcec2ba2b09f0e43dbcf04 100644 (file)
@@ -2237,7 +2237,7 @@ static std::string GenerateLangOptRequirements(const Record &R,
 }
 
 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 GenerateTargetRequirements(const Record &Attr,
   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";