[clang] [clang-repl] Implement value printing of custom types (PR #84769)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 11 08:11:05 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 71c2a132b2713c568ef41b0d18f92c4fa8ee73a6 cd22ee8e45d49317d511c954cd646a6e1f232903 -- clang/lib/Headers/__clang_interpreter_runtime_printvalue.h clang/lib/Interpreter/ValuePrinter.cpp clang/test/Interpreter/pretty-print.cpp clang/include/clang/AST/ASTContext.h clang/include/clang/Interpreter/Interpreter.h clang/include/clang/Interpreter/PartialTranslationUnit.h clang/include/clang/Interpreter/Value.h clang/lib/Interpreter/DeviceOffload.cpp clang/lib/Interpreter/DeviceOffload.h clang/lib/Interpreter/IncrementalExecutor.cpp clang/lib/Interpreter/IncrementalExecutor.h clang/lib/Interpreter/IncrementalParser.cpp clang/lib/Interpreter/IncrementalParser.h clang/lib/Interpreter/Interpreter.cpp clang/lib/Interpreter/InterpreterUtils.cpp clang/lib/Interpreter/InterpreterUtils.h clang/lib/Interpreter/Value.cpp clang/tools/clang-repl/ClangRepl.cpp clang/unittests/Interpreter/CodeCompletionTest.cpp clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp clang/unittests/Interpreter/IncrementalProcessingTest.cpp clang/unittests/Interpreter/InterpreterTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Interpreter/Interpreter.h b/clang/include/clang/Interpreter/Interpreter.h
index d9972ab8c7..62a9954f67 100644
--- a/clang/include/clang/Interpreter/Interpreter.h
+++ b/clang/include/clang/Interpreter/Interpreter.h
@@ -94,13 +94,9 @@ class Interpreter {
Value LastValue;
public:
- class SynthesizingCodeRAII {
+ class SynthesizingCodeRAII {};
- };
-
- SynthesizingCodeRAII EnterCodeSynthesisScope() {
-
- }
+ SynthesizingCodeRAII EnterCodeSynthesisScope() {}
~Interpreter();
static llvm::Expected<std::unique_ptr<Interpreter>>
@@ -150,8 +146,6 @@ public:
std::unique_ptr<llvm::Module> GenModule();
-
-
private:
size_t getEffectivePTUSize() const;
diff --git a/clang/lib/Headers/__clang_interpreter_runtime_printvalue.h b/clang/lib/Headers/__clang_interpreter_runtime_printvalue.h
index 707eb0723f..cf97afba8c 100644
--- a/clang/lib/Headers/__clang_interpreter_runtime_printvalue.h
+++ b/clang/lib/Headers/__clang_interpreter_runtime_printvalue.h
@@ -73,7 +73,9 @@ __DECL_PRINT_VALUE_RUNTIME(char *);
namespace __repl_runtime_detail {
// Custom void_t implementation for C++11 compatibility
-template <typename... Ts> struct __repl_void_impl { typedef void type; };
+template <typename... Ts> struct __repl_void_impl {
+ typedef void type;
+};
// Helper to deduce the type of the expression 'std::begin(std::declval<T &>())'
template <typename T>
diff --git a/clang/lib/Interpreter/ValuePrinter.cpp b/clang/lib/Interpreter/ValuePrinter.cpp
index 3f8c9a6f26..a5eea69dbd 100644
--- a/clang/lib/Interpreter/ValuePrinter.cpp
+++ b/clang/lib/Interpreter/ValuePrinter.cpp
@@ -117,7 +117,7 @@ static std::string PrintEnum(const Value &V) {
}
llvm::SmallString<64> APStr;
AP.toString(APStr, /*Radix=*/10);
- SS << " : " << PrintQualType(Ctx, ED->getIntegerType()) << " " << APStr;
+ SS << " : " << PrintQualType(Ctx, ED->getIntegerType()) << " " << APStr;
return Str;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/84769
More information about the cfe-commits
mailing list