]> granicus.if.org Git - clang/commitdiff
Fix some cases where StringRef was being passed by const reference. Remove const...
authorCraig Topper <craig.topper@gmail.com>
Sat, 30 Aug 2014 16:55:52 +0000 (16:55 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 30 Aug 2014 16:55:52 +0000 (16:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216825 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
include/clang/ASTMatchers/ASTMatchers.h
include/clang/Analysis/Analyses/ThreadSafetyTIL.h
include/clang/Sema/Sema.h
include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
lib/AST/CommentLexer.cpp
lib/ASTMatchers/Dynamic/Marshallers.h
lib/Basic/SourceManager.cpp
lib/CodeGen/CGObjCGNU.cpp
lib/CodeGen/SanitizerBlacklist.cpp
lib/CodeGen/SanitizerBlacklist.h
lib/Driver/Compilation.cpp
lib/Driver/Tools.cpp
lib/Sema/SemaAttr.cpp
lib/Sema/SemaPseudoObject.cpp

index 9dd6f49ebae7470ac20a13c8169091b2096a572d..817d3250755ca17cdd14283747c8928727b32c04 100644 (file)
@@ -1558,7 +1558,7 @@ AST_MATCHER_P(NamedDecl, matchesName, std::string, RegExp) {
 inline internal::PolymorphicMatcherWithParam1<
     internal::HasOverloadedOperatorNameMatcher, StringRef,
     AST_POLYMORPHIC_SUPPORTED_TYPES_2(CXXOperatorCallExpr, FunctionDecl)>
-hasOverloadedOperatorName(const StringRef Name) {
+hasOverloadedOperatorName(StringRef Name) {
   return internal::PolymorphicMatcherWithParam1<
       internal::HasOverloadedOperatorNameMatcher, StringRef,
       AST_POLYMORPHIC_SUPPORTED_TYPES_2(CXXOperatorCallExpr, FunctionDecl)>(
index 4b7b092708e1653ed819670f4b7d467fe56d10bf..8e244f99a7bee9c147ba2368cb36f1f665e6a473 100644 (file)
@@ -378,7 +378,7 @@ public:
 
   VariableKind kind() const { return static_cast<VariableKind>(Flags); }
 
-  const StringRef name() const { return Name; }
+  StringRef name() const { return Name; }
   const clang::ValueDecl *clangDecl() const { return Cvdecl; }
 
   // Returns the definition (for let vars) or type (for parameter & self vars)
index 856fa6cd9c0808a66ead384cd1d2f41a752d8d73..cada46c48b53ea05642235efe1039d65644ac99b 100644 (file)
@@ -7213,10 +7213,10 @@ public:
   };
 
   llvm::StringMap<SectionInfo> SectionInfos;
-  bool UnifySection(const StringRef &SectionName, 
+  bool UnifySection(StringRef SectionName,
                     int SectionFlags,
                     DeclaratorDecl *TheDecl);
-  bool UnifySection(const StringRef &SectionName,
+  bool UnifySection(StringRef SectionName,
                     int SectionFlags,
                     SourceLocation PragmaSectionLocation);
 
index 54a0fb45414f5dff1b63a37ea2509d694dc9451b..ec8006578fc554953d91879ffef9fbab342e27dd 100644 (file)
@@ -179,9 +179,9 @@ public:
 
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
-  const StringRef getDescription() const { return Description; }
+  StringRef getDescription() const { return Description; }
 
-  const StringRef getShortDescription(bool UseFallback = true) const {
+  StringRef getShortDescription(bool UseFallback = true) const {
     if (ShortDescription.empty() && UseFallback)
       return Description;
     return ShortDescription;
index 792a8320449b6ebf86957df882a769949835a72e..06a08bdad45fd8143ac93b1f717e47f200fb39a5 100644 (file)
@@ -362,7 +362,7 @@ void Lexer::lexCommentText(Token &T) {
           }
         }
 
-        const StringRef CommandName(BufferPtr + 1, Length);
+        StringRef CommandName(BufferPtr + 1, Length);
 
         const CommandInfo *Info = Traits.getCommandInfoOrNULL(CommandName);
         if (!Info) {
@@ -531,7 +531,7 @@ void Lexer::lexVerbatimLineText(Token &T) {
 
   // Extract current line.
   const char *Newline = findNewline(BufferPtr, CommentEnd);
-  const StringRef Text(BufferPtr, Newline - BufferPtr);
+  StringRef Text(BufferPtr, Newline - BufferPtr);
   formTokenWithChars(T, Newline, tok::verbatim_line_text);
   T.setVerbatimLineText(Text);
 
index 75e3a93d4c608f6799c5197a046a878a2f0a197e..bab0adb2c89d45ef13cbc2d46594a4f1099f7f4a 100644 (file)
@@ -473,7 +473,7 @@ private:
   template <typename FromTypeList>
   inline void collect(FromTypeList);
 
-  const StringRef Name;
+  StringRef Name;
   std::vector<MatcherDescriptor *> &Out;
 };
 
index 0d47b094109809320a3469b78f861691b21bb658..64504064535f81aad8158b8cbfd1ac1b7aa22c04 100644 (file)
@@ -111,7 +111,7 @@ llvm::MemoryBuffer *ContentCache::getBuffer(DiagnosticsEngine &Diag,
   // that we are in an inconsistent situation and error out as quickly as
   // possible.
   if (!Buffer.getPointer()) {
-    const StringRef FillStr("<<<MISSING SOURCE FILE>>>\n");
+    StringRef FillStr("<<<MISSING SOURCE FILE>>>\n");
     Buffer.setPointer(MemoryBuffer::getNewMemBuffer(ContentsEntry->getSize(),
                                                     "<invalid>").release());
     char *Ptr = const_cast<char*>(Buffer.getPointer()->getBufferStart());
index 619a66ab4a69363f4f4fe5618d1392a242a0a070..562bbef354e43d0c8802c00677d98a98c887c61f 100644 (file)
@@ -391,8 +391,8 @@ private:
   ///
   /// This structure is used by both classes and categories, and contains a next
   /// pointer allowing them to be chained together in a linked list.
-  llvm::Constant *GenerateMethodList(const StringRef &ClassName,
-      const StringRef &CategoryName,
+  llvm::Constant *GenerateMethodList(StringRef ClassName,
+      StringRef CategoryName,
       ArrayRef<Selector> MethodSels,
       ArrayRef<llvm::Constant *> MethodTypes,
       bool isClassMethodList);
@@ -875,8 +875,8 @@ void CGObjCGNU::EmitClassRef(const std::string &className) {
     llvm::GlobalValue::WeakAnyLinkage, ClassSymbol, symbolRef);
 }
 
-static std::string SymbolNameForMethod(const StringRef &ClassName,
-    const StringRef &CategoryName, const Selector MethodName,
+static std::string SymbolNameForMethod( StringRef ClassName,
+     StringRef CategoryName, const Selector MethodName,
     bool isClassMethod) {
   std::string MethodNameColonStripped = MethodName.getAsString();
   std::replace(MethodNameColonStripped.begin(), MethodNameColonStripped.end(),
@@ -1463,8 +1463,8 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
 /// Generates a MethodList.  Used in construction of a objc_class and
 /// objc_category structures.
 llvm::Constant *CGObjCGNU::
-GenerateMethodList(const StringRef &ClassName,
-                   const StringRef &CategoryName,
+GenerateMethodList(StringRef ClassName,
+                   StringRef CategoryName,
                    ArrayRef<Selector> MethodSels,
                    ArrayRef<llvm::Constant *> MethodTypes,
                    bool isClassMethodList) {
index 9f1ddc8e7d7b9e8b87e2e0b4494d846a9cc20153..9882a6dc41bb34654242537da0bc3544c19b2a0c 100644 (file)
@@ -31,7 +31,7 @@ static StringRef GetGlobalTypeString(const llvm::GlobalValue &G) {
 }
 
 bool SanitizerBlacklist::isIn(const llvm::Module &M,
-                              const StringRef Category) const {
+                              StringRef Category) const {
   return SCL->inSection("src", M.getModuleIdentifier(), Category);
 }
 
@@ -41,7 +41,7 @@ bool SanitizerBlacklist::isIn(const llvm::Function &F) const {
 }
 
 bool SanitizerBlacklist::isIn(const llvm::GlobalVariable &G,
-                              const StringRef Category) const {
+                              StringRef Category) const {
   return isIn(*G.getParent(), Category) ||
          SCL->inSection("global", G.getName(), Category) ||
          SCL->inSection("type", GetGlobalTypeString(G), Category);
index e890c5c57da13c7ea7eca88300aceacbd8659db3..44237ad53359ce2e01f23fbff51c81e1c82cc347 100644 (file)
@@ -34,10 +34,10 @@ class SanitizerBlacklist {
 public:
   SanitizerBlacklist(llvm::SpecialCaseList *SCL) : SCL(SCL) {}
   bool isIn(const llvm::Module &M,
-            const StringRef Category = StringRef()) const;
+            StringRef Category = StringRef()) const;
   bool isIn(const llvm::Function &F) const;
   bool isIn(const llvm::GlobalVariable &G,
-            const StringRef Category = StringRef()) const;
+            StringRef Category = StringRef()) const;
   bool isBlacklistedType(StringRef MangledTypeName) const;
 };
 }  // end namespace CodeGen
index 0697285473375c533c53bd5bb8c9699d85b8e6df..a14b8894d20e246c86d2aa4540b575e3e18c132a 100644 (file)
@@ -233,8 +233,8 @@ void Compilation::initCompilationForDiagnostics() {
   // Redirect stdout/stderr to /dev/null.
   Redirects = new const StringRef*[3]();
   Redirects[0] = nullptr;
-  Redirects[1] = new const StringRef();
-  Redirects[2] = new const StringRef();
+  Redirects[1] = new StringRef();
+  Redirects[2] = new StringRef();
 }
 
 StringRef Compilation::getSysRoot() const {
index d751ca9a1157fb190bea680fcbc86c8e54a16def..df2f9cfa4c9c02c024b3aa9c2a06d6ec1b30d2df 100644 (file)
@@ -1637,7 +1637,7 @@ void Clang::AddHexagonTargetArgs(const ArgList &Args,
 }
 
 // Decode AArch64 features from string like +[no]featureA+[no]featureB+...
-static bool DecodeAArch64Features(const Driver &D, const StringRef &text,
+static bool DecodeAArch64Features(const Driver &D, StringRef text,
                                   std::vector<const char *> &Features) {
   SmallVector<StringRef, 8> Split;
   text.split(Split, StringRef("+"), -1, false);
@@ -2134,7 +2134,7 @@ static void addProfileRT(
 }
 
 static SmallString<128> getSanitizerRTLibName(const ToolChain &TC,
-                                              const StringRef Sanitizer,
+                                              StringRef Sanitizer,
                                               bool Shared) {
   // Sanitizer runtime has name "libclang_rt.<Sanitizer>-<ArchName>.{a,so}"
   // (or "libclang_rt.<Sanitizer>-<ArchName>-android.so for Android)
@@ -2150,7 +2150,7 @@ static SmallString<128> getSanitizerRTLibName(const ToolChain &TC,
 
 static void addSanitizerRTLinkFlags(const ToolChain &TC, const ArgList &Args,
                                     ArgStringList &CmdArgs,
-                                    const StringRef Sanitizer,
+                                    StringRef Sanitizer,
                                     bool ExportSymbols, bool LinkDeps) {
   SmallString<128> LibSanitizer =
       getSanitizerRTLibName(TC, Sanitizer, /*Shared*/ false);
@@ -7765,7 +7765,7 @@ void dragonfly::Link::ConstructJob(Compilation &C, const JobAction &JA,
 
 static void addSanitizerRTWindows(const ToolChain &TC, const ArgList &Args,
                                   ArgStringList &CmdArgs,
-                                  const StringRef RTName) {
+                                  StringRef RTName) {
   SmallString<128> LibSanitizer(getCompilerRTLibDir(TC));
   llvm::sys::path::append(LibSanitizer,
                           Twine("clang_rt.") + RTName + ".lib");
@@ -7863,7 +7863,7 @@ static std::string FindFallback(const char *FallbackName,
   llvm::SplitString(OptPath.getValue(), PathSegments, EnvPathSeparatorStr);
 
   for (size_t i = 0, e = PathSegments.size(); i != e; ++i) {
-    const StringRef &PathSegment = PathSegments[i];
+    StringRef PathSegment = PathSegments[i];
     if (PathSegment.empty())
       continue;
 
index a7d606d545ca0abe9111e98ade30524a88e166a8..6320faab3741774081f033938cf9a9866a856915 100644 (file)
@@ -360,7 +360,7 @@ void Sema::PragmaStack<ValueType>::Act(SourceLocation PragmaLocation,
   }
 }
 
-bool Sema::UnifySection(const StringRef &SectionName,
+bool Sema::UnifySection(StringRef SectionName,
                         int SectionFlags,
                         DeclaratorDecl *Decl) {
   auto Section = SectionInfos.find(SectionName);
@@ -387,7 +387,7 @@ bool Sema::UnifySection(const StringRef &SectionName,
   return false;
 }
 
-bool Sema::UnifySection(const StringRef &SectionName,
+bool Sema::UnifySection(StringRef SectionName,
                         int SectionFlags,
                         SourceLocation PragmaSectionLocation) {
   auto Section = SectionInfos.find(SectionName);
index aa3e89ed67a943c1494b4871fae02c584b8032ef..b81b60c802e4b366d781318ee27d7619c557945f 100644 (file)
@@ -615,7 +615,7 @@ bool ObjCPropertyOpBuilder::findSetter(bool warn) {
     if (setter->isPropertyAccessor() && warn)
       if (const ObjCInterfaceDecl *IFace =
           dyn_cast<ObjCInterfaceDecl>(setter->getDeclContext())) {
-        const StringRef thisPropertyName(prop->getName());
+        StringRef thisPropertyName = prop->getName();
         // Try flipping the case of the first character.
         char front = thisPropertyName.front();
         front = isLowercase(front) ? toUppercase(front) : toLowercase(front);