Author: Timm Bäder
Date: 2023-09-23T11:45:30+02:00
New Revision: 658b655191e997258ac0e5f3308c59e51c2a1ee3

URL: 
https://github.com/llvm/llvm-project/commit/658b655191e997258ac0e5f3308c59e51c2a1ee3
DIFF: 
https://github.com/llvm/llvm-project/commit/658b655191e997258ac0e5f3308c59e51c2a1ee3.diff

LOG: [clang][Interp][NFC] Refactor ByteCodeEmitter a bit

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp 
b/clang/lib/AST/Interp/ByteCodeEmitter.cpp
index 9f0a2dfb47c9e7a..9b6adcc29bac5f1 100644
--- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp
+++ b/clang/lib/AST/Interp/ByteCodeEmitter.cpp
@@ -109,23 +109,22 @@ ByteCodeEmitter::compileFunc(const FunctionDecl 
*FuncDecl) {
     // Return a dummy function if compilation failed.
     if (BailLocation)
       return llvm::make_error<ByteCodeGenError>(*BailLocation);
-    else {
-      Func->setIsFullyCompiled(true);
-      return Func;
-    }
-  } else {
-    // Create scopes from descriptors.
-    llvm::SmallVector<Scope, 2> Scopes;
-    for (auto &DS : Descriptors) {
-      Scopes.emplace_back(std::move(DS));
-    }
 
-    // Set the function's code.
-    Func->setCode(NextLocalOffset, std::move(Code), std::move(SrcMap),
-                  std::move(Scopes), FuncDecl->hasBody());
     Func->setIsFullyCompiled(true);
     return Func;
   }
+
+  // Create scopes from descriptors.
+  llvm::SmallVector<Scope, 2> Scopes;
+  for (auto &DS : Descriptors) {
+    Scopes.emplace_back(std::move(DS));
+  }
+
+  // Set the function's code.
+  Func->setCode(NextLocalOffset, std::move(Code), std::move(SrcMap),
+                std::move(Scopes), FuncDecl->hasBody());
+  Func->setIsFullyCompiled(true);
+  return Func;
 }
 
 Scope::Local ByteCodeEmitter::createLocal(Descriptor *D) {


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

Reply via email to