]> granicus.if.org Git - clang/commitdiff
StringRef-ify Binary/UnaryOperator::getOpcodeStr
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 8 Oct 2012 01:11:04 +0000 (01:11 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 8 Oct 2012 01:11:04 +0000 (01:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165383 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Expr.h
include/clang/Sema/Overload.h
lib/AST/Expr.cpp
lib/Sema/AnalysisBasedWarnings.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaOverload.cpp

index 443d8be92b92b36784942f434d0c7bcec0af8232..f176041bf17a90127f05c3c9c8620f8ebaa192b5 100644 (file)
@@ -1613,7 +1613,7 @@ public:
 
   /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
   /// corresponds to, e.g. "sizeof" or "[pre]++"
-  static const char *getOpcodeStr(Opcode Op);
+  static StringRef getOpcodeStr(Opcode Op);
 
   /// \brief Retrieve the unary opcode that corresponds to the given
   /// overloaded operator.
@@ -2836,9 +2836,9 @@ public:
 
   /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
   /// corresponds to, e.g. "<<=".
-  static const char *getOpcodeStr(Opcode Op);
+  static StringRef getOpcodeStr(Opcode Op);
 
-  const char *getOpcodeStr() const { return getOpcodeStr(getOpcode()); }
+  StringRef getOpcodeStr() const { return getOpcodeStr(getOpcode()); }
 
   /// \brief Retrieve the binary opcode that corresponds to the given
   /// overloaded operator.
index 85ef77af93346593ef931ed9b17e3dc67264e59f..6ebccbdba638d3ff39a7a77a3e779b25f6c14ccb 100644 (file)
@@ -808,7 +808,7 @@ namespace clang {
     void NoteCandidates(Sema &S,
                         OverloadCandidateDisplayKind OCD,
                         llvm::ArrayRef<Expr *> Args,
-                        const char *Opc = 0,
+                        StringRef Opc = "",
                         SourceLocation Loc = SourceLocation());
   };
 
index e1198b85c5a504f598c23c72a02141806f62fbc3..694325af22d7f0027dfe30caf44bd1cd9ab62ffc 100644 (file)
@@ -869,7 +869,7 @@ getLocationOfByte(unsigned ByteNo, const SourceManager &SM,
 
 /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
 /// corresponds to, e.g. "sizeof" or "[pre]++".
-const char *UnaryOperator::getOpcodeStr(Opcode Op) {
+StringRef UnaryOperator::getOpcodeStr(Opcode Op) {
   switch (Op) {
   case UO_PostInc: return "++";
   case UO_PostDec: return "--";
@@ -1570,7 +1570,7 @@ CStyleCastExpr *CStyleCastExpr::CreateEmpty(ASTContext &C, unsigned PathSize) {
 
 /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
 /// corresponds to, e.g. "<<=".
-const char *BinaryOperator::getOpcodeStr(Opcode Op) {
+StringRef BinaryOperator::getOpcodeStr(Opcode Op) {
   switch (Op) {
   case BO_PtrMemD:   return ".*";
   case BO_PtrMemI:   return "->*";
index 67d290b73c5e6f9eda1abeca0f391cc93c7c512d..6d09f2c116f356ea77d5ba1babcc12fde3ccfa6f 100644 (file)
@@ -501,7 +501,7 @@ static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
 
     // Information used when building the diagnostic.
     unsigned DiagKind;
-    const char *Str;
+    StringRef Str;
     SourceRange Range;
 
     // FixIts to suppress the diagnosic by removing the dead condition.
index d40818b83b0d6a36a2bd9a9dd29647a07669a82b..dcb3736bd7b5bf5243d227d5cfb188ccdc94719a 100644 (file)
@@ -8464,8 +8464,8 @@ static void DiagnoseBitwisePrecedence(Sema &Self, BinaryOperatorKind Opc,
   SourceRange DiagRange = isLeftComp ? SourceRange(LHSExpr->getLocStart(),
                                                    OpLoc)
                                      : SourceRange(OpLoc, RHSExpr->getLocEnd());
-  std::string OpStr = isLeftComp ? BinOp::getOpcodeStr(LHSopc)
-                                 : BinOp::getOpcodeStr(RHSopc);
+  StringRef OpStr = isLeftComp ? BinOp::getOpcodeStr(LHSopc)
+                               : BinOp::getOpcodeStr(RHSopc);
   SourceRange ParensRange = isLeftComp ?
       SourceRange(cast<BinOp>(LHSExpr)->getRHS()->getLocStart(),
                   RHSExpr->getLocEnd())
index 10b96c9ec310c84b52bb63a3590630db5a01f751..600393137d729f63569f9e055c9515b9102740e1 100644 (file)
@@ -8537,7 +8537,7 @@ void NoteSurrogateCandidate(Sema &S, OverloadCandidate *Cand) {
 }
 
 void NoteBuiltinOperatorCandidate(Sema &S,
-                                  const char *Opc,
+                                  StringRef Opc,
                                   SourceLocation OpLoc,
                                   OverloadCandidate *Cand) {
   assert(Cand->NumConversions <= 2 && "builtin operator is not binary");
@@ -8806,7 +8806,7 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand,
 void OverloadCandidateSet::NoteCandidates(Sema &S,
                                           OverloadCandidateDisplayKind OCD,
                                           llvm::ArrayRef<Expr *> Args,
-                                          const char *Opc,
+                                          StringRef Opc,
                                           SourceLocation OpLoc) {
   // Sort the candidates by viability and position.  Sorting directly would
   // be prohibitive, so we make a set of pointers and sort those.