Author: Timm Bäder
Date: 2022-10-14T14:41:05+02:00
New Revision: 6fad7127cb990894cc2392c89152a36af7808736

URL: 
https://github.com/llvm/llvm-project/commit/6fad7127cb990894cc2392c89152a36af7808736
DIFF: 
https://github.com/llvm/llvm-project/commit/6fad7127cb990894cc2392c89152a36af7808736.diff

LOG: [clang][Interp][NFC] Remove unused parameter from emitConst()

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp
    clang/lib/AST/Interp/ByteCodeExprGen.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp 
b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 6edf1c450fa3..ad3348cee4e2 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -145,10 +145,8 @@ bool ByteCodeExprGen<Emitter>::VisitIntegerLiteral(const 
IntegerLiteral *LE) {
   if (DiscardResult)
     return true;
 
-  auto Val = LE->getValue();
-  QualType LitTy = LE->getType();
-  if (Optional<PrimType> T = classify(LitTy))
-    return emitConst(*T, getIntWidth(LitTy), LE->getValue(), LE);
+  if (Optional<PrimType> T = classify(LE->getType()))
+    return emitConst(*T, LE->getValue(), LE);
   return this->bail(LE);
 }
 
@@ -345,7 +343,7 @@ bool ByteCodeExprGen<Emitter>::VisitArrayInitIndexExpr(
     return false;
   QualType IndexType = E->getType();
   APInt Value(getIntWidth(IndexType), *ArrayIndex);
-  return this->emitConst(classifyPrim(IndexType), 0, Value, E);
+  return this->emitConst(classifyPrim(IndexType), Value, E);
 }
 
 template <class Emitter>
@@ -569,8 +567,8 @@ bool ByteCodeExprGen<Emitter>::dereferenceVar(
 }
 
 template <class Emitter>
-bool ByteCodeExprGen<Emitter>::emitConst(PrimType T, unsigned NumBits,
-                                         const APInt &Value, const Expr *E) {
+bool ByteCodeExprGen<Emitter>::emitConst(PrimType T, const APInt &Value,
+                                         const Expr *E) {
   switch (T) {
   case PT_Sint8:
     return this->emitConstSint8(Value.getSExtValue(), E);
@@ -1092,8 +1090,7 @@ bool ByteCodeExprGen<Emitter>::VisitDeclRefExpr(const 
DeclRefExpr *E) {
   } else if (const auto *ECD = dyn_cast<EnumConstantDecl>(Decl)) {
     PrimType T = *classify(ECD->getType());
 
-    return this->emitConst(T, getIntWidth(ECD->getType()), ECD->getInitVal(),
-                           E);
+    return this->emitConst(T, ECD->getInitVal(), E);
   }
 
   // References are implemented using pointers, so when we get here,

diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.h 
b/clang/lib/AST/Interp/ByteCodeExprGen.h
index f55ac2ff433b..ffe8e8372543 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.h
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -232,15 +232,13 @@ class ByteCodeExprGen : public 
ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
                       llvm::function_ref<bool(PrimType)> Indirect);
 
   /// Emits an APInt constant.
-  bool emitConst(PrimType T, unsigned NumBits, const llvm::APInt &Value,
-                 const Expr *E);
+  bool emitConst(PrimType T, const llvm::APInt &Value, const Expr *E);
 
   /// Emits an integer constant.
   template <typename T> bool emitConst(const Expr *E, T Value) {
     QualType Ty = E->getType();
-    unsigned NumBits = getIntWidth(Ty);
-    APInt WrappedValue(NumBits, Value, std::is_signed<T>::value);
-    return emitConst(*Ctx.classify(Ty), NumBits, WrappedValue, E);
+    APInt WrappedValue(getIntWidth(Ty), Value, std::is_signed<T>::value);
+    return emitConst(*Ctx.classify(Ty), WrappedValue, E);
   }
 
   /// Returns the index of a global.


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to