https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/104552
>From 42c79911d0138d45c425e42cc19bef5e84a67e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Fri, 16 Aug 2024 08:42:16 +0200 Subject: [PATCH] [clang] Rename all AST/Interp stuff to AST/ByteCode "Interp" clashes with the clang interpreter and people often confuse this. --- clang/docs/ClangFormattedStatus.rst | 2 +- clang/docs/tools/clang-formatted-files.txt | 36 ++++++------ clang/lib/AST/ASTContext.cpp | 2 +- clang/lib/AST/{Interp => ByteCode}/Boolean.h | 15 +++-- .../{Interp => ByteCode}/ByteCodeEmitter.cpp | 9 ++- .../{Interp => ByteCode}/ByteCodeEmitter.h | 2 +- .../lib/AST/{Interp => ByteCode}/Compiler.cpp | 5 +- clang/lib/AST/{Interp => ByteCode}/Compiler.h | 0 .../lib/AST/{Interp => ByteCode}/Context.cpp | 0 clang/lib/AST/{Interp => ByteCode}/Context.h | 0 .../AST/{Interp => ByteCode}/Descriptor.cpp | 0 .../lib/AST/{Interp => ByteCode}/Descriptor.h | 2 +- clang/lib/AST/{Interp => ByteCode}/Disasm.cpp | 0 .../{Interp => ByteCode}/DynamicAllocator.cpp | 0 .../{Interp => ByteCode}/DynamicAllocator.h | 0 .../AST/{Interp => ByteCode}/EvalEmitter.cpp | 4 +- .../AST/{Interp => ByteCode}/EvalEmitter.h | 0 .../{Interp => ByteCode}/EvaluationResult.cpp | 0 .../{Interp => ByteCode}/EvaluationResult.h | 0 .../lib/AST/{Interp => ByteCode}/Floating.cpp | 0 clang/lib/AST/{Interp => ByteCode}/Floating.h | 0 clang/lib/AST/{Interp => ByteCode}/Frame.cpp | 0 clang/lib/AST/{Interp => ByteCode}/Frame.h | 0 .../lib/AST/{Interp => ByteCode}/Function.cpp | 0 clang/lib/AST/{Interp => ByteCode}/Function.h | 0 .../{Interp => ByteCode}/FunctionPointer.h | 0 clang/lib/AST/{Interp => ByteCode}/Integral.h | 42 +++++++++----- .../lib/AST/{Interp => ByteCode}/IntegralAP.h | 0 clang/lib/AST/{Interp => ByteCode}/Interp.cpp | 0 clang/lib/AST/{Interp => ByteCode}/Interp.h | 15 ++--- .../AST/{Interp => ByteCode}/InterpBlock.cpp | 0 .../AST/{Interp => ByteCode}/InterpBlock.h | 2 +- .../{Interp => ByteCode}/InterpBuiltin.cpp | 0 .../AST/{Interp => ByteCode}/InterpFrame.cpp | 2 +- .../AST/{Interp => ByteCode}/InterpFrame.h | 2 +- .../AST/{Interp => ByteCode}/InterpShared.cpp | 0 .../AST/{Interp => ByteCode}/InterpShared.h | 0 .../AST/{Interp => ByteCode}/InterpStack.cpp | 4 +- .../AST/{Interp => ByteCode}/InterpStack.h | 5 +- .../AST/{Interp => ByteCode}/InterpState.cpp | 0 .../AST/{Interp => ByteCode}/InterpState.h | 0 .../{Interp => ByteCode}/MemberPointer.cpp | 0 .../AST/{Interp => ByteCode}/MemberPointer.h | 0 clang/lib/AST/{Interp => ByteCode}/Opcode.h | 0 clang/lib/AST/{Interp => ByteCode}/Opcodes.td | 0 .../lib/AST/{Interp => ByteCode}/Pointer.cpp | 0 clang/lib/AST/{Interp => ByteCode}/Pointer.h | 2 +- .../lib/AST/{Interp => ByteCode}/PrimType.cpp | 0 clang/lib/AST/{Interp => ByteCode}/PrimType.h | 57 ++++++++++++++----- .../lib/AST/{Interp => ByteCode}/Primitives.h | 0 .../lib/AST/{Interp => ByteCode}/Program.cpp | 43 +++++++------- clang/lib/AST/{Interp => ByteCode}/Program.h | 16 ++---- clang/lib/AST/{Interp => ByteCode}/Record.cpp | 2 +- clang/lib/AST/{Interp => ByteCode}/Record.h | 0 clang/lib/AST/{Interp => ByteCode}/Source.cpp | 0 clang/lib/AST/{Interp => ByteCode}/Source.h | 0 clang/lib/AST/{Interp => ByteCode}/State.cpp | 0 clang/lib/AST/{Interp => ByteCode}/State.h | 0 clang/lib/AST/CMakeLists.txt | 52 ++++++++--------- clang/lib/AST/ExprConstShared.h | 2 +- clang/lib/AST/ExprConstant.cpp | 6 +- .../test/AST/{Interp => ByteCode}/arrays.cpp | 0 clang/test/AST/{Interp => ByteCode}/atomic.c | 0 .../test/AST/{Interp => ByteCode}/atomic.cpp | 0 .../AST/{Interp => ByteCode}/bitfields.cpp | 0 .../builtin-align-cxx.cpp | 0 .../builtin-constant-p.cpp | 0 .../builtin-functions.cpp | 0 .../AST/{Interp => ByteCode}/builtins.cpp | 0 clang/test/AST/{Interp => ByteCode}/c.c | 0 clang/test/AST/{Interp => ByteCode}/c23.c | 0 .../test/AST/{Interp => ByteCode}/codegen.cpp | 0 clang/test/AST/{Interp => ByteCode}/comma.cpp | 0 clang/test/AST/{Interp => ByteCode}/complex.c | 0 .../test/AST/{Interp => ByteCode}/complex.cpp | 0 clang/test/AST/{Interp => ByteCode}/cond.cpp | 0 .../AST/{Interp => ByteCode}/const-eval.c | 0 .../{Interp => ByteCode}/const-fpfeatures.cpp | 0 .../const-temporaries.cpp | 0 .../constexpr-frame-describe.cpp | 0 .../constexpr-nqueens.cpp | 0 .../constexpr-subobj-initialization.cpp | 0 .../{Interp => ByteCode}/crash-GH49103-2.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx03.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx11.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx17.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx20.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx23.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx26.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx2a.cpp | 0 clang/test/AST/{Interp => ByteCode}/cxx98.cpp | 0 .../AST/{Interp => ByteCode}/depth-limit.cpp | 0 .../AST/{Interp => ByteCode}/depth-limit2.cpp | 0 .../{Interp => ByteCode}/enums-targets.cpp | 0 clang/test/AST/{Interp => ByteCode}/enums.cpp | 0 .../AST/{Interp => ByteCode}/eval-order.cpp | 0 .../test/AST/{Interp => ByteCode}/floats.cpp | 0 .../AST/{Interp => ByteCode}/functions.cpp | 0 clang/test/AST/{Interp => ByteCode}/hlsl.hlsl | 0 clang/test/AST/{Interp => ByteCode}/if.cpp | 0 clang/test/AST/{Interp => ByteCode}/intap.cpp | 0 .../test/AST/{Interp => ByteCode}/invalid.cpp | 0 .../test/AST/{Interp => ByteCode}/lambda.cpp | 0 .../AST/{Interp => ByteCode}/lifetimes.cpp | 0 .../AST/{Interp => ByteCode}/literals.cpp | 0 clang/test/AST/{Interp => ByteCode}/loops.cpp | 0 .../{Interp => ByteCode}/memberpointers.cpp | 0 clang/test/AST/{Interp => ByteCode}/ms.cpp | 0 .../test/AST/{Interp => ByteCode}/mutable.cpp | 0 .../AST/{Interp => ByteCode}/new-delete.cpp | 0 .../AST/{Interp => ByteCode}/nullable.cpp | 0 clang/test/AST/{Interp => ByteCode}/objc.mm | 0 clang/test/AST/{Interp => ByteCode}/opencl.cl | 0 .../{Interp => ByteCode}/pointer-addition.c | 0 .../test/AST/{Interp => ByteCode}/records.cpp | 0 .../AST/{Interp => ByteCode}/references.cpp | 0 .../test/AST/{Interp => ByteCode}/shifts.cpp | 0 .../AST/{Interp => ByteCode}/spaceship.cpp | 0 .../test/AST/{Interp => ByteCode}/switch.cpp | 0 clang/test/AST/{Interp => ByteCode}/sycl.cpp | 0 .../test/AST/{Interp => ByteCode}/unions.cpp | 0 .../test/AST/{Interp => ByteCode}/vectors.cpp | 0 clang/test/AST/{Interp => ByteCode}/weak.cpp | 0 .../AST/{Interp => ByteCode}/CMakeLists.txt | 0 .../AST/{Interp => ByteCode}/Descriptor.cpp | 28 ++++----- .../AST/{Interp => ByteCode}/toAPValue.cpp | 6 +- clang/unittests/AST/CMakeLists.txt | 2 +- 127 files changed, 198 insertions(+), 167 deletions(-) rename clang/lib/AST/{Interp => ByteCode}/Boolean.h (96%) rename clang/lib/AST/{Interp => ByteCode}/ByteCodeEmitter.cpp (97%) rename clang/lib/AST/{Interp => ByteCode}/ByteCodeEmitter.h (97%) rename clang/lib/AST/{Interp => ByteCode}/Compiler.cpp (99%) rename clang/lib/AST/{Interp => ByteCode}/Compiler.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Context.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Context.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Descriptor.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Descriptor.h (99%) rename clang/lib/AST/{Interp => ByteCode}/Disasm.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/DynamicAllocator.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/DynamicAllocator.h (100%) rename clang/lib/AST/{Interp => ByteCode}/EvalEmitter.cpp (99%) rename clang/lib/AST/{Interp => ByteCode}/EvalEmitter.h (100%) rename clang/lib/AST/{Interp => ByteCode}/EvaluationResult.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/EvaluationResult.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Floating.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Floating.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Frame.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Frame.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Function.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Function.h (100%) rename clang/lib/AST/{Interp => ByteCode}/FunctionPointer.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Integral.h (93%) rename clang/lib/AST/{Interp => ByteCode}/IntegralAP.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Interp.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Interp.h (99%) rename clang/lib/AST/{Interp => ByteCode}/InterpBlock.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/InterpBlock.h (100%) rename clang/lib/AST/{Interp => ByteCode}/InterpBuiltin.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/InterpFrame.cpp (99%) rename clang/lib/AST/{Interp => ByteCode}/InterpFrame.h (99%) rename clang/lib/AST/{Interp => ByteCode}/InterpShared.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/InterpShared.h (100%) rename clang/lib/AST/{Interp => ByteCode}/InterpStack.cpp (98%) rename clang/lib/AST/{Interp => ByteCode}/InterpStack.h (97%) rename clang/lib/AST/{Interp => ByteCode}/InterpState.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/InterpState.h (100%) rename clang/lib/AST/{Interp => ByteCode}/MemberPointer.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/MemberPointer.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Opcode.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Opcodes.td (100%) rename clang/lib/AST/{Interp => ByteCode}/Pointer.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Pointer.h (99%) rename clang/lib/AST/{Interp => ByteCode}/PrimType.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/PrimType.h (83%) rename clang/lib/AST/{Interp => ByteCode}/Primitives.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Program.cpp (95%) rename clang/lib/AST/{Interp => ByteCode}/Program.h (96%) rename clang/lib/AST/{Interp => ByteCode}/Record.cpp (96%) rename clang/lib/AST/{Interp => ByteCode}/Record.h (100%) rename clang/lib/AST/{Interp => ByteCode}/Source.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/Source.h (100%) rename clang/lib/AST/{Interp => ByteCode}/State.cpp (100%) rename clang/lib/AST/{Interp => ByteCode}/State.h (100%) rename clang/test/AST/{Interp => ByteCode}/arrays.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/atomic.c (100%) rename clang/test/AST/{Interp => ByteCode}/atomic.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/bitfields.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/builtin-align-cxx.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/builtin-constant-p.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/builtin-functions.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/builtins.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/c.c (100%) rename clang/test/AST/{Interp => ByteCode}/c23.c (100%) rename clang/test/AST/{Interp => ByteCode}/codegen.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/comma.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/complex.c (100%) rename clang/test/AST/{Interp => ByteCode}/complex.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cond.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/const-eval.c (100%) rename clang/test/AST/{Interp => ByteCode}/const-fpfeatures.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/const-temporaries.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/constexpr-frame-describe.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/constexpr-nqueens.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/constexpr-subobj-initialization.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/crash-GH49103-2.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx03.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx11.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx17.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx20.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx23.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx26.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx2a.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/cxx98.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/depth-limit.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/depth-limit2.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/enums-targets.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/enums.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/eval-order.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/floats.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/functions.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/hlsl.hlsl (100%) rename clang/test/AST/{Interp => ByteCode}/if.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/intap.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/invalid.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/lambda.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/lifetimes.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/literals.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/loops.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/memberpointers.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/ms.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/mutable.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/new-delete.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/nullable.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/objc.mm (100%) rename clang/test/AST/{Interp => ByteCode}/opencl.cl (100%) rename clang/test/AST/{Interp => ByteCode}/pointer-addition.c (100%) rename clang/test/AST/{Interp => ByteCode}/records.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/references.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/shifts.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/spaceship.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/switch.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/sycl.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/unions.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/vectors.cpp (100%) rename clang/test/AST/{Interp => ByteCode}/weak.cpp (100%) rename clang/unittests/AST/{Interp => ByteCode}/CMakeLists.txt (100%) rename clang/unittests/AST/{Interp => ByteCode}/Descriptor.cpp (95%) rename clang/unittests/AST/{Interp => ByteCode}/toAPValue.cpp (98%) diff --git a/clang/docs/ClangFormattedStatus.rst b/clang/docs/ClangFormattedStatus.rst index 68c13076ccbb4e..0ee0782879ef6b 100644 --- a/clang/docs/ClangFormattedStatus.rst +++ b/clang/docs/ClangFormattedStatus.rst @@ -439,7 +439,7 @@ tree in terms of conformance to :doc:`ClangFormat` as of: March 06, 2022 17:32:2 - `2` - `79` - :part:`2%` - * - clang/lib/AST/Interp + * - clang/lib/AST/ByteCode - `44` - `18` - `26` diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt index 62871133a68075..fc07357986d989 100644 --- a/clang/docs/tools/clang-formatted-files.txt +++ b/clang/docs/tools/clang-formatted-files.txt @@ -322,24 +322,24 @@ clang/lib/APINotes/APINotesTypes.cpp clang/lib/APINotes/APINotesYAMLCompiler.cpp clang/lib/AST/DataCollection.cpp clang/lib/AST/Linkage.h -clang/lib/AST/Interp/ByteCodeGenError.cpp -clang/lib/AST/Interp/ByteCodeGenError.h -clang/lib/AST/Interp/Context.cpp -clang/lib/AST/Interp/Context.h -clang/lib/AST/Interp/Descriptor.cpp -clang/lib/AST/Interp/Disasm.cpp -clang/lib/AST/Interp/EvalEmitter.h -clang/lib/AST/Interp/Frame.cpp -clang/lib/AST/Interp/Frame.h -clang/lib/AST/Interp/InterpState.h -clang/lib/AST/Interp/Opcode.h -clang/lib/AST/Interp/Pointer.cpp -clang/lib/AST/Interp/PrimType.cpp -clang/lib/AST/Interp/Record.h -clang/lib/AST/Interp/Source.cpp -clang/lib/AST/Interp/Source.h -clang/lib/AST/Interp/State.cpp -clang/lib/AST/Interp/State.h +clang/lib/AST/ByteCode/ByteCodeGenError.cpp +clang/lib/AST/ByteCode/ByteCodeGenError.h +clang/lib/AST/ByteCode/Context.cpp +clang/lib/AST/ByteCode/Context.h +clang/lib/AST/ByteCode/Descriptor.cpp +clang/lib/AST/ByteCode/Disasm.cpp +clang/lib/AST/ByteCode/EvalEmitter.h +clang/lib/AST/ByteCode/Frame.cpp +clang/lib/AST/ByteCode/Frame.h +clang/lib/AST/ByteCode/InterpState.h +clang/lib/AST/ByteCode/Opcode.h +clang/lib/AST/ByteCode/Pointer.cpp +clang/lib/AST/ByteCode/PrimType.cpp +clang/lib/AST/ByteCode/Record.h +clang/lib/AST/ByteCode/Source.cpp +clang/lib/AST/ByteCode/Source.h +clang/lib/AST/ByteCode/State.cpp +clang/lib/AST/ByteCode/State.h clang/lib/ASTMatchers/GtestMatchers.cpp clang/lib/ASTMatchers/Dynamic/Marshallers.cpp clang/lib/Basic/Attributes.cpp diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 0dbbe0043f7031..f35a025fc8edfc 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -11,8 +11,8 @@ //===----------------------------------------------------------------------===// #include "clang/AST/ASTContext.h" +#include "ByteCode/Context.h" #include "CXXABI.h" -#include "Interp/Context.h" #include "clang/AST/APValue.h" #include "clang/AST/ASTConcept.h" #include "clang/AST/ASTMutationListener.h" diff --git a/clang/lib/AST/Interp/Boolean.h b/clang/lib/AST/ByteCode/Boolean.h similarity index 96% rename from clang/lib/AST/Interp/Boolean.h rename to clang/lib/AST/ByteCode/Boolean.h index 23f72860367646..0a2e0fe332110e 100644 --- a/clang/lib/AST/Interp/Boolean.h +++ b/clang/lib/AST/ByteCode/Boolean.h @@ -9,25 +9,25 @@ #ifndef LLVM_CLANG_AST_INTERP_BOOLEAN_H #define LLVM_CLANG_AST_INTERP_BOOLEAN_H -#include <cstddef> -#include <cstdint> #include "Integral.h" #include "clang/AST/APValue.h" #include "clang/AST/ComparisonCategories.h" #include "llvm/ADT/APSInt.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" +#include <cstddef> +#include <cstdint> namespace clang { namespace interp { /// Wrapper around boolean types. class Boolean final { - private: +private: /// Underlying boolean. bool V; - public: +public: /// Zero-initializes a boolean. Boolean() : V(false) {} explicit Boolean(bool V) : V(V) {} @@ -104,8 +104,7 @@ class Boolean final { static Boolean zero() { return from(false); } - template <typename T> - static Boolean from(T Value, unsigned NumBits) { + template <typename T> static Boolean from(T Value, unsigned NumBits) { return Boolean(Value); } @@ -153,7 +152,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Boolean &B) { return OS; } -} // namespace interp -} // namespace clang +} // namespace interp +} // namespace clang #endif diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp b/clang/lib/AST/ByteCode/ByteCodeEmitter.cpp similarity index 97% rename from clang/lib/AST/Interp/ByteCodeEmitter.cpp rename to clang/lib/AST/ByteCode/ByteCodeEmitter.cpp index a01fa15dc0b7dc..1f6bdaff50b5bf 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp +++ b/clang/lib/AST/ByteCode/ByteCodeEmitter.cpp @@ -206,8 +206,7 @@ void ByteCodeEmitter::emitLabel(LabelTy Label) { const size_t Target = Code.size(); LabelOffsets.insert({Label, Target}); - if (auto It = LabelRelocs.find(Label); - It != LabelRelocs.end()) { + if (auto It = LabelRelocs.find(Label); It != LabelRelocs.end()) { for (unsigned Reloc : It->second) { using namespace llvm::support; @@ -228,8 +227,7 @@ int32_t ByteCodeEmitter::getOffset(LabelTy Label) { assert(aligned(Position)); // If target is known, compute jump offset. - if (auto It = LabelOffsets.find(Label); - It != LabelOffsets.end()) + if (auto It = LabelOffsets.find(Label); It != LabelOffsets.end()) return It->second - Position; // Otherwise, record relocation and return dummy offset. @@ -308,7 +306,8 @@ void emit(Program &P, std::vector<std::byte> &Code, const IntegralAP<true> &Val, } template <typename... Tys> -bool ByteCodeEmitter::emitOp(Opcode Op, const Tys &... Args, const SourceInfo &SI) { +bool ByteCodeEmitter::emitOp(Opcode Op, const Tys &...Args, + const SourceInfo &SI) { bool Success = true; // The opcode is followed by arguments. The source info is diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.h b/clang/lib/AST/ByteCode/ByteCodeEmitter.h similarity index 97% rename from clang/lib/AST/Interp/ByteCodeEmitter.h rename to clang/lib/AST/ByteCode/ByteCodeEmitter.h index a19a25c2f9e8ec..59e12defd8e52b 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.h +++ b/clang/lib/AST/ByteCode/ByteCodeEmitter.h @@ -92,7 +92,7 @@ class ByteCodeEmitter { /// Emits an opcode. template <typename... Tys> - bool emitOp(Opcode Op, const Tys &... Args, const SourceInfo &L); + bool emitOp(Opcode Op, const Tys &...Args, const SourceInfo &L); protected: #define GET_LINK_PROTO diff --git a/clang/lib/AST/Interp/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp similarity index 99% rename from clang/lib/AST/Interp/Compiler.cpp rename to clang/lib/AST/ByteCode/Compiler.cpp index 5e1f507ca2b178..c3ecaa40b86f2a 100644 --- a/clang/lib/AST/Interp/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -3722,7 +3722,8 @@ bool Compiler<Emitter>::visitDeclAndReturn(const VarDecl *VD, } template <class Emitter> -VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, bool Toplevel) { +VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, + bool Toplevel) { // We don't know what to do with these, so just return false. if (VD->getType().isNull()) return false; @@ -5124,7 +5125,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) { if (!this->visit(SubExpr)) return false; return DiscardResult ? this->emitPop(*T, E) : this->emitNeg(*T, E); - case UO_Plus: // +x + case UO_Plus: // +x if (!T) return this->emitError(E); diff --git a/clang/lib/AST/Interp/Compiler.h b/clang/lib/AST/ByteCode/Compiler.h similarity index 100% rename from clang/lib/AST/Interp/Compiler.h rename to clang/lib/AST/ByteCode/Compiler.h diff --git a/clang/lib/AST/Interp/Context.cpp b/clang/lib/AST/ByteCode/Context.cpp similarity index 100% rename from clang/lib/AST/Interp/Context.cpp rename to clang/lib/AST/ByteCode/Context.cpp diff --git a/clang/lib/AST/Interp/Context.h b/clang/lib/AST/ByteCode/Context.h similarity index 100% rename from clang/lib/AST/Interp/Context.h rename to clang/lib/AST/ByteCode/Context.h diff --git a/clang/lib/AST/Interp/Descriptor.cpp b/clang/lib/AST/ByteCode/Descriptor.cpp similarity index 100% rename from clang/lib/AST/Interp/Descriptor.cpp rename to clang/lib/AST/ByteCode/Descriptor.cpp diff --git a/clang/lib/AST/Interp/Descriptor.h b/clang/lib/AST/ByteCode/Descriptor.h similarity index 99% rename from clang/lib/AST/Interp/Descriptor.h rename to clang/lib/AST/ByteCode/Descriptor.h index 6f1adeb898c430..41899c3bd6831a 100644 --- a/clang/lib/AST/Interp/Descriptor.h +++ b/clang/lib/AST/ByteCode/Descriptor.h @@ -229,7 +229,7 @@ struct Descriptor final { /// Returns the allocated size, including metadata. unsigned getAllocSize() const { return AllocSize; } /// returns the size of an element when the structure is viewed as an array. - unsigned getElemSize() const { return ElemSize; } + unsigned getElemSize() const { return ElemSize; } /// Returns the size of the metadata. unsigned getMetadataSize() const { return MDSize; } diff --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp similarity index 100% rename from clang/lib/AST/Interp/Disasm.cpp rename to clang/lib/AST/ByteCode/Disasm.cpp diff --git a/clang/lib/AST/Interp/DynamicAllocator.cpp b/clang/lib/AST/ByteCode/DynamicAllocator.cpp similarity index 100% rename from clang/lib/AST/Interp/DynamicAllocator.cpp rename to clang/lib/AST/ByteCode/DynamicAllocator.cpp diff --git a/clang/lib/AST/Interp/DynamicAllocator.h b/clang/lib/AST/ByteCode/DynamicAllocator.h similarity index 100% rename from clang/lib/AST/Interp/DynamicAllocator.h rename to clang/lib/AST/ByteCode/DynamicAllocator.h diff --git a/clang/lib/AST/Interp/EvalEmitter.cpp b/clang/lib/AST/ByteCode/EvalEmitter.cpp similarity index 99% rename from clang/lib/AST/Interp/EvalEmitter.cpp rename to clang/lib/AST/ByteCode/EvalEmitter.cpp index 08536536ac3c2e..e36d86c814e17f 100644 --- a/clang/lib/AST/Interp/EvalEmitter.cpp +++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp @@ -76,9 +76,7 @@ EvaluationResult EvalEmitter::interpretDecl(const VarDecl *VD, return std::move(this->EvalResult); } -void EvalEmitter::emitLabel(LabelTy Label) { - CurrentLabel = Label; -} +void EvalEmitter::emitLabel(LabelTy Label) { CurrentLabel = Label; } EvalEmitter::LabelTy EvalEmitter::getLabel() { return NextLabel++; } diff --git a/clang/lib/AST/Interp/EvalEmitter.h b/clang/lib/AST/ByteCode/EvalEmitter.h similarity index 100% rename from clang/lib/AST/Interp/EvalEmitter.h rename to clang/lib/AST/ByteCode/EvalEmitter.h diff --git a/clang/lib/AST/Interp/EvaluationResult.cpp b/clang/lib/AST/ByteCode/EvaluationResult.cpp similarity index 100% rename from clang/lib/AST/Interp/EvaluationResult.cpp rename to clang/lib/AST/ByteCode/EvaluationResult.cpp diff --git a/clang/lib/AST/Interp/EvaluationResult.h b/clang/lib/AST/ByteCode/EvaluationResult.h similarity index 100% rename from clang/lib/AST/Interp/EvaluationResult.h rename to clang/lib/AST/ByteCode/EvaluationResult.h diff --git a/clang/lib/AST/Interp/Floating.cpp b/clang/lib/AST/ByteCode/Floating.cpp similarity index 100% rename from clang/lib/AST/Interp/Floating.cpp rename to clang/lib/AST/ByteCode/Floating.cpp diff --git a/clang/lib/AST/Interp/Floating.h b/clang/lib/AST/ByteCode/Floating.h similarity index 100% rename from clang/lib/AST/Interp/Floating.h rename to clang/lib/AST/ByteCode/Floating.h diff --git a/clang/lib/AST/Interp/Frame.cpp b/clang/lib/AST/ByteCode/Frame.cpp similarity index 100% rename from clang/lib/AST/Interp/Frame.cpp rename to clang/lib/AST/ByteCode/Frame.cpp diff --git a/clang/lib/AST/Interp/Frame.h b/clang/lib/AST/ByteCode/Frame.h similarity index 100% rename from clang/lib/AST/Interp/Frame.h rename to clang/lib/AST/ByteCode/Frame.h diff --git a/clang/lib/AST/Interp/Function.cpp b/clang/lib/AST/ByteCode/Function.cpp similarity index 100% rename from clang/lib/AST/Interp/Function.cpp rename to clang/lib/AST/ByteCode/Function.cpp diff --git a/clang/lib/AST/Interp/Function.h b/clang/lib/AST/ByteCode/Function.h similarity index 100% rename from clang/lib/AST/Interp/Function.h rename to clang/lib/AST/ByteCode/Function.h diff --git a/clang/lib/AST/Interp/FunctionPointer.h b/clang/lib/AST/ByteCode/FunctionPointer.h similarity index 100% rename from clang/lib/AST/Interp/FunctionPointer.h rename to clang/lib/AST/ByteCode/FunctionPointer.h diff --git a/clang/lib/AST/Interp/Integral.h b/clang/lib/AST/ByteCode/Integral.h similarity index 93% rename from clang/lib/AST/Interp/Integral.h rename to clang/lib/AST/ByteCode/Integral.h index aafdd02676c966..e06ec1669259da 100644 --- a/clang/lib/AST/Interp/Integral.h +++ b/clang/lib/AST/ByteCode/Integral.h @@ -13,8 +13,8 @@ #ifndef LLVM_CLANG_AST_INTERP_INTEGRAL_H #define LLVM_CLANG_AST_INTERP_INTEGRAL_H -#include "clang/AST/ComparisonCategories.h" #include "clang/AST/APValue.h" +#include "clang/AST/ComparisonCategories.h" #include "llvm/ADT/APSInt.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" @@ -33,14 +33,30 @@ template <bool Signed> class IntegralAP; // Helper structure to select the representation. template <unsigned Bits, bool Signed> struct Repr; -template <> struct Repr<8, false> { using Type = uint8_t; }; -template <> struct Repr<16, false> { using Type = uint16_t; }; -template <> struct Repr<32, false> { using Type = uint32_t; }; -template <> struct Repr<64, false> { using Type = uint64_t; }; -template <> struct Repr<8, true> { using Type = int8_t; }; -template <> struct Repr<16, true> { using Type = int16_t; }; -template <> struct Repr<32, true> { using Type = int32_t; }; -template <> struct Repr<64, true> { using Type = int64_t; }; +template <> struct Repr<8, false> { + using Type = uint8_t; +}; +template <> struct Repr<16, false> { + using Type = uint16_t; +}; +template <> struct Repr<32, false> { + using Type = uint32_t; +}; +template <> struct Repr<64, false> { + using Type = uint64_t; +}; +template <> struct Repr<8, true> { + using Type = int8_t; +}; +template <> struct Repr<16, true> { + using Type = int16_t; +}; +template <> struct Repr<32, true> { + using Type = int32_t; +}; +template <> struct Repr<64, true> { + using Type = int64_t; +}; /// Wrapper around numeric types. /// @@ -159,12 +175,8 @@ template <unsigned Bits, bool Signed> class Integral final { void print(llvm::raw_ostream &OS) const { OS << V; } - static Integral min(unsigned NumBits) { - return Integral(Min); - } - static Integral max(unsigned NumBits) { - return Integral(Max); - } + static Integral min(unsigned NumBits) { return Integral(Min); } + static Integral max(unsigned NumBits) { return Integral(Max); } template <typename ValT> static Integral from(ValT Value) { if constexpr (std::is_integral<ValT>::value) diff --git a/clang/lib/AST/Interp/IntegralAP.h b/clang/lib/AST/ByteCode/IntegralAP.h similarity index 100% rename from clang/lib/AST/Interp/IntegralAP.h rename to clang/lib/AST/ByteCode/IntegralAP.h diff --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp similarity index 100% rename from clang/lib/AST/Interp/Interp.cpp rename to clang/lib/AST/ByteCode/Interp.cpp diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/ByteCode/Interp.h similarity index 99% rename from clang/lib/AST/Interp/Interp.h rename to clang/lib/AST/ByteCode/Interp.h index c2d73f32f0b20c..c3ce21cb13770e 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/ByteCode/Interp.h @@ -1226,7 +1226,7 @@ template <PrimType Name, class T = typename PrimConv<Name>::T> bool GetField(InterpState &S, CodePtr OpPC, uint32_t I) { const Pointer &Obj = S.Stk.peek<Pointer>(); if (!CheckNull(S, OpPC, Obj, CSK_Field)) - return false; + return false; if (!CheckRange(S, OpPC, Obj, CSK_Field)) return false; const Pointer &Field = Obj.atField(I); @@ -1542,7 +1542,7 @@ inline bool GetPtrActiveField(InterpState &S, CodePtr OpPC, uint32_t Off) { } inline bool GetPtrActiveThisField(InterpState &S, CodePtr OpPC, uint32_t Off) { - if (S.checkingPotentialConstantExpression()) + if (S.checkingPotentialConstantExpression()) return false; const Pointer &This = S.Current->getThis(); if (!CheckThis(S, OpPC, This)) @@ -2053,7 +2053,7 @@ template <PrimType TIn, PrimType TOut> bool Cast(InterpState &S, CodePtr OpPC) { /// 1) Pops a Floating from the stack. /// 2) Pushes a new floating on the stack that uses the given semantics. inline bool CastFP(InterpState &S, CodePtr OpPC, const llvm::fltSemantics *Sem, - llvm::RoundingMode RM) { + llvm::RoundingMode RM) { Floating F = S.Stk.pop<Floating>(); Floating Result = F.toSemantics(Sem, RM); S.Stk.push<Floating>(Result); @@ -2313,9 +2313,9 @@ inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS) { if (!S.noteUndefinedBehavior()) return false; RHS = -RHS; - return DoShift < LT, RT, - Dir == ShiftDir::Left ? ShiftDir::Right - : ShiftDir::Left > (S, OpPC, LHS, RHS); + return DoShift<LT, RT, + Dir == ShiftDir::Left ? ShiftDir::Right : ShiftDir::Left>( + S, OpPC, LHS, RHS); } if constexpr (Dir == ShiftDir::Left) { @@ -2467,7 +2467,8 @@ inline bool ArrayElemPop(InterpState &S, CodePtr OpPC, uint32_t Index) { } template <PrimType Name, class T = typename PrimConv<Name>::T> -inline bool CopyArray(InterpState &S, CodePtr OpPC, uint32_t SrcIndex, uint32_t DestIndex, uint32_t Size) { +inline bool CopyArray(InterpState &S, CodePtr OpPC, uint32_t SrcIndex, + uint32_t DestIndex, uint32_t Size) { const auto &SrcPtr = S.Stk.pop<Pointer>(); const auto &DestPtr = S.Stk.peek<Pointer>(); diff --git a/clang/lib/AST/Interp/InterpBlock.cpp b/clang/lib/AST/ByteCode/InterpBlock.cpp similarity index 100% rename from clang/lib/AST/Interp/InterpBlock.cpp rename to clang/lib/AST/ByteCode/InterpBlock.cpp diff --git a/clang/lib/AST/Interp/InterpBlock.h b/clang/lib/AST/ByteCode/InterpBlock.h similarity index 100% rename from clang/lib/AST/Interp/InterpBlock.h rename to clang/lib/AST/ByteCode/InterpBlock.h index 20cf8cb9d3810e..a5cd58e3a655a0 100644 --- a/clang/lib/AST/Interp/InterpBlock.h +++ b/clang/lib/AST/ByteCode/InterpBlock.h @@ -14,10 +14,10 @@ #define LLVM_CLANG_AST_INTERP_BLOCK_H #include "Descriptor.h" +#include "clang/AST/ComparisonCategories.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/Expr.h" -#include "clang/AST/ComparisonCategories.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/Support/raw_ostream.h" diff --git a/clang/lib/AST/Interp/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp similarity index 100% rename from clang/lib/AST/Interp/InterpBuiltin.cpp rename to clang/lib/AST/ByteCode/InterpBuiltin.cpp diff --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/ByteCode/InterpFrame.cpp similarity index 99% rename from clang/lib/AST/Interp/InterpFrame.cpp rename to clang/lib/AST/ByteCode/InterpFrame.cpp index 4530f28d694e84..8b55b61cbbfa7e 100644 --- a/clang/lib/AST/Interp/InterpFrame.cpp +++ b/clang/lib/AST/ByteCode/InterpFrame.cpp @@ -137,7 +137,7 @@ void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx, if (!Ty->isReferenceType()) OS << "&"; llvm::SmallVector<Pointer, 2> Levels; - for (Pointer F = P; !F.isRoot(); ) { + for (Pointer F = P; !F.isRoot();) { Levels.push_back(F); F = F.isArrayElement() ? F.getArray().expand() : F.getBase(); } diff --git a/clang/lib/AST/Interp/InterpFrame.h b/clang/lib/AST/ByteCode/InterpFrame.h similarity index 99% rename from clang/lib/AST/Interp/InterpFrame.h rename to clang/lib/AST/ByteCode/InterpFrame.h index 91b9b41b5d3343..1e0d2b1d4424b1 100644 --- a/clang/lib/AST/Interp/InterpFrame.h +++ b/clang/lib/AST/ByteCode/InterpFrame.h @@ -91,7 +91,7 @@ class InterpFrame final : public Frame { /// Mutates a local copy of a parameter. template <typename T> void setParam(unsigned Offset, const T &Value) { - getParamPointer(Offset).deref<T>() = Value; + getParamPointer(Offset).deref<T>() = Value; } /// Returns a pointer to an argument - lazily creates a block. diff --git a/clang/lib/AST/Interp/InterpShared.cpp b/clang/lib/AST/ByteCode/InterpShared.cpp similarity index 100% rename from clang/lib/AST/Interp/InterpShared.cpp rename to clang/lib/AST/ByteCode/InterpShared.cpp diff --git a/clang/lib/AST/Interp/InterpShared.h b/clang/lib/AST/ByteCode/InterpShared.h similarity index 100% rename from clang/lib/AST/Interp/InterpShared.h rename to clang/lib/AST/ByteCode/InterpShared.h diff --git a/clang/lib/AST/Interp/InterpStack.cpp b/clang/lib/AST/ByteCode/InterpStack.cpp similarity index 98% rename from clang/lib/AST/Interp/InterpStack.cpp rename to clang/lib/AST/ByteCode/InterpStack.cpp index c7024740d322ef..b8cdaeee72166c 100644 --- a/clang/lib/AST/Interp/InterpStack.cpp +++ b/clang/lib/AST/ByteCode/InterpStack.cpp @@ -18,9 +18,7 @@ using namespace clang; using namespace clang::interp; -InterpStack::~InterpStack() { - clear(); -} +InterpStack::~InterpStack() { clear(); } void InterpStack::clear() { if (Chunk && Chunk->Next) diff --git a/clang/lib/AST/Interp/InterpStack.h b/clang/lib/AST/ByteCode/InterpStack.h similarity index 97% rename from clang/lib/AST/Interp/InterpStack.h rename to clang/lib/AST/ByteCode/InterpStack.h index 4966e2870de6bd..153d17f0d70e1b 100644 --- a/clang/lib/AST/Interp/InterpStack.h +++ b/clang/lib/AST/ByteCode/InterpStack.h @@ -32,7 +32,7 @@ class InterpStack final { ~InterpStack(); /// Constructs a value in place on the top of the stack. - template <typename T, typename... Tys> void push(Tys &&... Args) { + template <typename T, typename... Tys> void push(Tys &&...Args) { new (grow(aligned_size<T>())) T(std::forward<Tys>(Args)...); #ifndef NDEBUG ItemTypes.push_back(toPrimType<T>()); @@ -153,8 +153,7 @@ class InterpStack final { template <typename T> static constexpr PrimType toPrimType() { if constexpr (std::is_same_v<T, Pointer>) return PT_Ptr; - else if constexpr (std::is_same_v<T, bool> || - std::is_same_v<T, Boolean>) + else if constexpr (std::is_same_v<T, bool> || std::is_same_v<T, Boolean>) return PT_Bool; else if constexpr (std::is_same_v<T, int8_t> || std::is_same_v<T, Integral<8, true>>) diff --git a/clang/lib/AST/Interp/InterpState.cpp b/clang/lib/AST/ByteCode/InterpState.cpp similarity index 100% rename from clang/lib/AST/Interp/InterpState.cpp rename to clang/lib/AST/ByteCode/InterpState.cpp diff --git a/clang/lib/AST/Interp/InterpState.h b/clang/lib/AST/ByteCode/InterpState.h similarity index 100% rename from clang/lib/AST/Interp/InterpState.h rename to clang/lib/AST/ByteCode/InterpState.h diff --git a/clang/lib/AST/Interp/MemberPointer.cpp b/clang/lib/AST/ByteCode/MemberPointer.cpp similarity index 100% rename from clang/lib/AST/Interp/MemberPointer.cpp rename to clang/lib/AST/ByteCode/MemberPointer.cpp diff --git a/clang/lib/AST/Interp/MemberPointer.h b/clang/lib/AST/ByteCode/MemberPointer.h similarity index 100% rename from clang/lib/AST/Interp/MemberPointer.h rename to clang/lib/AST/ByteCode/MemberPointer.h diff --git a/clang/lib/AST/Interp/Opcode.h b/clang/lib/AST/ByteCode/Opcode.h similarity index 100% rename from clang/lib/AST/Interp/Opcode.h rename to clang/lib/AST/ByteCode/Opcode.h diff --git a/clang/lib/AST/Interp/Opcodes.td b/clang/lib/AST/ByteCode/Opcodes.td similarity index 100% rename from clang/lib/AST/Interp/Opcodes.td rename to clang/lib/AST/ByteCode/Opcodes.td diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp similarity index 100% rename from clang/lib/AST/Interp/Pointer.cpp rename to clang/lib/AST/ByteCode/Pointer.cpp diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h similarity index 99% rename from clang/lib/AST/Interp/Pointer.h rename to clang/lib/AST/ByteCode/Pointer.h index 01ccb88ec03b29..8db081c0ec82b3 100644 --- a/clang/lib/AST/Interp/Pointer.h +++ b/clang/lib/AST/ByteCode/Pointer.h @@ -173,7 +173,7 @@ class Pointer { /// Subtract the given offset from the current Base and Offset /// of the pointer. - [[nodiscard]] Pointer atFieldSub(unsigned Off) const { + [[nodiscard]] Pointer atFieldSub(unsigned Off) const { assert(Offset >= Off); unsigned O = Offset - Off; return Pointer(asBlockPointer().Pointee, O, O); diff --git a/clang/lib/AST/Interp/PrimType.cpp b/clang/lib/AST/ByteCode/PrimType.cpp similarity index 100% rename from clang/lib/AST/Interp/PrimType.cpp rename to clang/lib/AST/ByteCode/PrimType.cpp diff --git a/clang/lib/AST/Interp/PrimType.h b/clang/lib/AST/ByteCode/PrimType.h similarity index 83% rename from clang/lib/AST/Interp/PrimType.h rename to clang/lib/AST/ByteCode/PrimType.h index 20fb5e81774d6f..bb2f59d86e98d7 100644 --- a/clang/lib/AST/Interp/PrimType.h +++ b/clang/lib/AST/ByteCode/PrimType.h @@ -73,23 +73,45 @@ constexpr bool isIntegralType(PrimType T) { return T <= PT_Bool; } /// Mapping from primitive types to their representation. template <PrimType T> struct PrimConv; -template <> struct PrimConv<PT_Sint8> { using T = Integral<8, true>; }; -template <> struct PrimConv<PT_Uint8> { using T = Integral<8, false>; }; -template <> struct PrimConv<PT_Sint16> { using T = Integral<16, true>; }; -template <> struct PrimConv<PT_Uint16> { using T = Integral<16, false>; }; -template <> struct PrimConv<PT_Sint32> { using T = Integral<32, true>; }; -template <> struct PrimConv<PT_Uint32> { using T = Integral<32, false>; }; -template <> struct PrimConv<PT_Sint64> { using T = Integral<64, true>; }; -template <> struct PrimConv<PT_Uint64> { using T = Integral<64, false>; }; +template <> struct PrimConv<PT_Sint8> { + using T = Integral<8, true>; +}; +template <> struct PrimConv<PT_Uint8> { + using T = Integral<8, false>; +}; +template <> struct PrimConv<PT_Sint16> { + using T = Integral<16, true>; +}; +template <> struct PrimConv<PT_Uint16> { + using T = Integral<16, false>; +}; +template <> struct PrimConv<PT_Sint32> { + using T = Integral<32, true>; +}; +template <> struct PrimConv<PT_Uint32> { + using T = Integral<32, false>; +}; +template <> struct PrimConv<PT_Sint64> { + using T = Integral<64, true>; +}; +template <> struct PrimConv<PT_Uint64> { + using T = Integral<64, false>; +}; template <> struct PrimConv<PT_IntAP> { using T = IntegralAP<false>; }; template <> struct PrimConv<PT_IntAPS> { using T = IntegralAP<true>; }; -template <> struct PrimConv<PT_Float> { using T = Floating; }; -template <> struct PrimConv<PT_Bool> { using T = Boolean; }; -template <> struct PrimConv<PT_Ptr> { using T = Pointer; }; +template <> struct PrimConv<PT_Float> { + using T = Floating; +}; +template <> struct PrimConv<PT_Bool> { + using T = Boolean; +}; +template <> struct PrimConv<PT_Ptr> { + using T = Pointer; +}; template <> struct PrimConv<PT_FnPtr> { using T = FunctionPointer; }; @@ -117,8 +139,12 @@ static inline bool aligned(const void *P) { /// Helper macro to simplify type switches. /// The macro implicitly exposes a type T in the scope of the inner block. -#define TYPE_SWITCH_CASE(Name, B) \ - case Name: { using T = PrimConv<Name>::T; B; break; } +#define TYPE_SWITCH_CASE(Name, B) \ + case Name: { \ + using T = PrimConv<Name>::T; \ + B; \ + break; \ + } #define TYPE_SWITCH(Expr, B) \ do { \ switch (Expr) { \ @@ -181,7 +207,10 @@ static inline bool aligned(const void *P) { do { \ switch (Expr) { \ TYPE_SWITCH_CASE(PT_Ptr, B) \ - default: { D; break; } \ + default: { \ + D; \ + break; \ + } \ } \ } while (0) #endif diff --git a/clang/lib/AST/Interp/Primitives.h b/clang/lib/AST/ByteCode/Primitives.h similarity index 100% rename from clang/lib/AST/Interp/Primitives.h rename to clang/lib/AST/ByteCode/Primitives.h diff --git a/clang/lib/AST/Interp/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp similarity index 95% rename from clang/lib/AST/Interp/Program.cpp rename to clang/lib/AST/ByteCode/Program.cpp index 9109956dc652cb..25b99115ddd777 100644 --- a/clang/lib/AST/Interp/Program.cpp +++ b/clang/lib/AST/ByteCode/Program.cpp @@ -76,26 +76,26 @@ unsigned Program::createGlobalString(const StringLiteral *S) { Pointer Field = Ptr.atIndex(I).narrow(); const uint32_t CodePoint = I == N ? 0 : S->getCodeUnit(I); switch (CharType) { - case PT_Sint8: { - using T = PrimConv<PT_Sint8>::T; - Field.deref<T>() = T::from(CodePoint, BitWidth); - Field.initialize(); - break; - } - case PT_Uint16: { - using T = PrimConv<PT_Uint16>::T; - Field.deref<T>() = T::from(CodePoint, BitWidth); - Field.initialize(); - break; - } - case PT_Uint32: { - using T = PrimConv<PT_Uint32>::T; - Field.deref<T>() = T::from(CodePoint, BitWidth); - Field.initialize(); - break; - } - default: - llvm_unreachable("unsupported character type"); + case PT_Sint8: { + using T = PrimConv<PT_Sint8>::T; + Field.deref<T>() = T::from(CodePoint, BitWidth); + Field.initialize(); + break; + } + case PT_Uint16: { + using T = PrimConv<PT_Uint16>::T; + Field.deref<T>() = T::from(CodePoint, BitWidth); + Field.initialize(); + break; + } + case PT_Uint32: { + using T = PrimConv<PT_Uint32>::T; + Field.deref<T>() = T::from(CodePoint, BitWidth); + Field.initialize(); + break; + } + default: + llvm_unreachable("unsupported character type"); } } return I; @@ -394,8 +394,7 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty, D, ElemTy.getTypePtr(), std::nullopt, IsConst, IsTemporary); if (!ElemDesc) return nullptr; - unsigned ElemSize = - ElemDesc->getAllocSize() + sizeof(InlineDescriptor); + unsigned ElemSize = ElemDesc->getAllocSize() + sizeof(InlineDescriptor); if (std::numeric_limits<unsigned>::max() / ElemSize <= NumElems) return {}; return allocateDescriptor(D, ElemDesc, MDSize, NumElems, IsConst, diff --git a/clang/lib/AST/Interp/Program.h b/clang/lib/AST/ByteCode/Program.h similarity index 96% rename from clang/lib/AST/Interp/Program.h rename to clang/lib/AST/ByteCode/Program.h index 1cabc5212180f2..7f69d9790fc79a 100644 --- a/clang/lib/AST/Interp/Program.h +++ b/clang/lib/AST/ByteCode/Program.h @@ -13,8 +13,6 @@ #ifndef LLVM_CLANG_AST_INTERP_PROGRAM_H #define LLVM_CLANG_AST_INTERP_PROGRAM_H -#include <map> -#include <vector> #include "Function.h" #include "Pointer.h" #include "PrimType.h" @@ -24,6 +22,8 @@ #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" +#include <map> +#include <vector> namespace clang { class RecordDecl; @@ -94,15 +94,14 @@ class Program final { /// Creates a new function from a code range. template <typename... Ts> - Function *createFunction(const FunctionDecl *Def, Ts &&... Args) { + Function *createFunction(const FunctionDecl *Def, Ts &&...Args) { Def = Def->getCanonicalDecl(); auto *Func = new Function(*this, Def, std::forward<Ts>(Args)...); Funcs.insert({Def, std::unique_ptr<Function>(Func)}); return Func; } /// Creates an anonymous function. - template <typename... Ts> - Function *createFunction(Ts &&... Args) { + template <typename... Ts> Function *createFunction(Ts &&...Args) { auto *Func = new Function(*this, std::forward<Ts>(Args)...); AnonFuncs.emplace_back(Func); return Func; @@ -213,8 +212,7 @@ class Program final { llvm::DenseMap<const ValueDecl *, unsigned> DummyVariables; /// Creates a new descriptor. - template <typename... Ts> - Descriptor *allocateDescriptor(Ts &&... Args) { + template <typename... Ts> Descriptor *allocateDescriptor(Ts &&...Args) { return new (Allocator) Descriptor(std::forward<Ts>(Args)...); } @@ -232,9 +230,7 @@ class Program final { } /// Ends a global declaration. - void endDeclaration() { - CurrentDeclaration = NoDeclaration; - } + void endDeclaration() { CurrentDeclaration = NoDeclaration; } public: /// Dumps the disassembled bytecode to \c llvm::errs(). diff --git a/clang/lib/AST/Interp/Record.cpp b/clang/lib/AST/ByteCode/Record.cpp similarity index 96% rename from clang/lib/AST/Interp/Record.cpp rename to clang/lib/AST/ByteCode/Record.cpp index e7b741f2d458c8..ec1b55da347af6 100644 --- a/clang/lib/AST/Interp/Record.cpp +++ b/clang/lib/AST/ByteCode/Record.cpp @@ -18,7 +18,7 @@ Record::Record(const RecordDecl *Decl, BaseList &&SrcBases, : Decl(Decl), Bases(std::move(SrcBases)), Fields(std::move(SrcFields)), BaseSize(BaseSize), VirtualSize(VirtualSize), IsUnion(Decl->isUnion()) { for (Base &V : SrcVirtualBases) - VirtualBases.push_back({ V.Decl, V.Offset + BaseSize, V.Desc, V.R }); + VirtualBases.push_back({V.Decl, V.Offset + BaseSize, V.Desc, V.R}); for (Base &B : Bases) BaseMap[B.Decl] = &B; diff --git a/clang/lib/AST/Interp/Record.h b/clang/lib/AST/ByteCode/Record.h similarity index 100% rename from clang/lib/AST/Interp/Record.h rename to clang/lib/AST/ByteCode/Record.h diff --git a/clang/lib/AST/Interp/Source.cpp b/clang/lib/AST/ByteCode/Source.cpp similarity index 100% rename from clang/lib/AST/Interp/Source.cpp rename to clang/lib/AST/ByteCode/Source.cpp diff --git a/clang/lib/AST/Interp/Source.h b/clang/lib/AST/ByteCode/Source.h similarity index 100% rename from clang/lib/AST/Interp/Source.h rename to clang/lib/AST/ByteCode/Source.h diff --git a/clang/lib/AST/Interp/State.cpp b/clang/lib/AST/ByteCode/State.cpp similarity index 100% rename from clang/lib/AST/Interp/State.cpp rename to clang/lib/AST/ByteCode/State.cpp diff --git a/clang/lib/AST/Interp/State.h b/clang/lib/AST/ByteCode/State.h similarity index 100% rename from clang/lib/AST/Interp/State.h rename to clang/lib/AST/ByteCode/State.h diff --git a/clang/lib/AST/CMakeLists.txt b/clang/lib/AST/CMakeLists.txt index 70aecb781c2ff2..041252b6830e0a 100644 --- a/clang/lib/AST/CMakeLists.txt +++ b/clang/lib/AST/CMakeLists.txt @@ -11,7 +11,7 @@ set(LLVM_LINK_COMPONENTS # another library which depends on clangAST. clang_tablegen(Opcodes.inc -gen-clang-opcodes - SOURCE Interp/Opcodes.td + SOURCE ByteCode/Opcodes.td TARGET Opcodes) clang_tablegen(AttrDocTable.inc -gen-clang-attr-doc-table @@ -64,31 +64,31 @@ add_clang_library(clangAST ExternalASTSource.cpp FormatString.cpp InheritViz.cpp - Interp/ByteCodeEmitter.cpp - Interp/Compiler.cpp - Interp/Context.cpp - Interp/Descriptor.cpp - Interp/Disasm.cpp - Interp/EvalEmitter.cpp - Interp/Frame.cpp - Interp/Function.cpp - Interp/InterpBuiltin.cpp - Interp/Floating.cpp - Interp/EvaluationResult.cpp - Interp/DynamicAllocator.cpp - Interp/Interp.cpp - Interp/InterpBlock.cpp - Interp/InterpFrame.cpp - Interp/InterpStack.cpp - Interp/InterpState.cpp - Interp/Pointer.cpp - Interp/PrimType.cpp - Interp/Program.cpp - Interp/Record.cpp - Interp/Source.cpp - Interp/State.cpp - Interp/MemberPointer.cpp - Interp/InterpShared.cpp + ByteCode/ByteCodeEmitter.cpp + ByteCode/Compiler.cpp + ByteCode/Context.cpp + ByteCode/Descriptor.cpp + ByteCode/Disasm.cpp + ByteCode/EvalEmitter.cpp + ByteCode/Frame.cpp + ByteCode/Function.cpp + ByteCode/InterpBuiltin.cpp + ByteCode/Floating.cpp + ByteCode/EvaluationResult.cpp + ByteCode/DynamicAllocator.cpp + ByteCode/Interp.cpp + ByteCode/InterpBlock.cpp + ByteCode/InterpFrame.cpp + ByteCode/InterpStack.cpp + ByteCode/InterpState.cpp + ByteCode/Pointer.cpp + ByteCode/PrimType.cpp + ByteCode/Program.cpp + ByteCode/Record.cpp + ByteCode/Source.cpp + ByteCode/State.cpp + ByteCode/MemberPointer.cpp + ByteCode/InterpShared.cpp ItaniumCXXABI.cpp ItaniumMangle.cpp JSONNodeDumper.cpp diff --git a/clang/lib/AST/ExprConstShared.h b/clang/lib/AST/ExprConstShared.h index 2a7088e4e371a1..efe8ee986d29b3 100644 --- a/clang/lib/AST/ExprConstShared.h +++ b/clang/lib/AST/ExprConstShared.h @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // // Shared functionality between the new constant expression -// interpreter (AST/Interp/) and the current one (ExprConstant.cpp). +// interpreter (AST/ByteCode/) and the current one (ExprConstant.cpp). // //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 09edbb6641650a..7bfc63ffd81e28 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -32,10 +32,10 @@ // //===----------------------------------------------------------------------===// +#include "ByteCode/Context.h" +#include "ByteCode/Frame.h" +#include "ByteCode/State.h" #include "ExprConstShared.h" -#include "Interp/Context.h" -#include "Interp/Frame.h" -#include "Interp/State.h" #include "clang/AST/APValue.h" #include "clang/AST/ASTContext.h" #include "clang/AST/ASTDiagnostic.h" diff --git a/clang/test/AST/Interp/arrays.cpp b/clang/test/AST/ByteCode/arrays.cpp similarity index 100% rename from clang/test/AST/Interp/arrays.cpp rename to clang/test/AST/ByteCode/arrays.cpp diff --git a/clang/test/AST/Interp/atomic.c b/clang/test/AST/ByteCode/atomic.c similarity index 100% rename from clang/test/AST/Interp/atomic.c rename to clang/test/AST/ByteCode/atomic.c diff --git a/clang/test/AST/Interp/atomic.cpp b/clang/test/AST/ByteCode/atomic.cpp similarity index 100% rename from clang/test/AST/Interp/atomic.cpp rename to clang/test/AST/ByteCode/atomic.cpp diff --git a/clang/test/AST/Interp/bitfields.cpp b/clang/test/AST/ByteCode/bitfields.cpp similarity index 100% rename from clang/test/AST/Interp/bitfields.cpp rename to clang/test/AST/ByteCode/bitfields.cpp diff --git a/clang/test/AST/Interp/builtin-align-cxx.cpp b/clang/test/AST/ByteCode/builtin-align-cxx.cpp similarity index 100% rename from clang/test/AST/Interp/builtin-align-cxx.cpp rename to clang/test/AST/ByteCode/builtin-align-cxx.cpp diff --git a/clang/test/AST/Interp/builtin-constant-p.cpp b/clang/test/AST/ByteCode/builtin-constant-p.cpp similarity index 100% rename from clang/test/AST/Interp/builtin-constant-p.cpp rename to clang/test/AST/ByteCode/builtin-constant-p.cpp diff --git a/clang/test/AST/Interp/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp similarity index 100% rename from clang/test/AST/Interp/builtin-functions.cpp rename to clang/test/AST/ByteCode/builtin-functions.cpp diff --git a/clang/test/AST/Interp/builtins.cpp b/clang/test/AST/ByteCode/builtins.cpp similarity index 100% rename from clang/test/AST/Interp/builtins.cpp rename to clang/test/AST/ByteCode/builtins.cpp diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/ByteCode/c.c similarity index 100% rename from clang/test/AST/Interp/c.c rename to clang/test/AST/ByteCode/c.c diff --git a/clang/test/AST/Interp/c23.c b/clang/test/AST/ByteCode/c23.c similarity index 100% rename from clang/test/AST/Interp/c23.c rename to clang/test/AST/ByteCode/c23.c diff --git a/clang/test/AST/Interp/codegen.cpp b/clang/test/AST/ByteCode/codegen.cpp similarity index 100% rename from clang/test/AST/Interp/codegen.cpp rename to clang/test/AST/ByteCode/codegen.cpp diff --git a/clang/test/AST/Interp/comma.cpp b/clang/test/AST/ByteCode/comma.cpp similarity index 100% rename from clang/test/AST/Interp/comma.cpp rename to clang/test/AST/ByteCode/comma.cpp diff --git a/clang/test/AST/Interp/complex.c b/clang/test/AST/ByteCode/complex.c similarity index 100% rename from clang/test/AST/Interp/complex.c rename to clang/test/AST/ByteCode/complex.c diff --git a/clang/test/AST/Interp/complex.cpp b/clang/test/AST/ByteCode/complex.cpp similarity index 100% rename from clang/test/AST/Interp/complex.cpp rename to clang/test/AST/ByteCode/complex.cpp diff --git a/clang/test/AST/Interp/cond.cpp b/clang/test/AST/ByteCode/cond.cpp similarity index 100% rename from clang/test/AST/Interp/cond.cpp rename to clang/test/AST/ByteCode/cond.cpp diff --git a/clang/test/AST/Interp/const-eval.c b/clang/test/AST/ByteCode/const-eval.c similarity index 100% rename from clang/test/AST/Interp/const-eval.c rename to clang/test/AST/ByteCode/const-eval.c diff --git a/clang/test/AST/Interp/const-fpfeatures.cpp b/clang/test/AST/ByteCode/const-fpfeatures.cpp similarity index 100% rename from clang/test/AST/Interp/const-fpfeatures.cpp rename to clang/test/AST/ByteCode/const-fpfeatures.cpp diff --git a/clang/test/AST/Interp/const-temporaries.cpp b/clang/test/AST/ByteCode/const-temporaries.cpp similarity index 100% rename from clang/test/AST/Interp/const-temporaries.cpp rename to clang/test/AST/ByteCode/const-temporaries.cpp diff --git a/clang/test/AST/Interp/constexpr-frame-describe.cpp b/clang/test/AST/ByteCode/constexpr-frame-describe.cpp similarity index 100% rename from clang/test/AST/Interp/constexpr-frame-describe.cpp rename to clang/test/AST/ByteCode/constexpr-frame-describe.cpp diff --git a/clang/test/AST/Interp/constexpr-nqueens.cpp b/clang/test/AST/ByteCode/constexpr-nqueens.cpp similarity index 100% rename from clang/test/AST/Interp/constexpr-nqueens.cpp rename to clang/test/AST/ByteCode/constexpr-nqueens.cpp diff --git a/clang/test/AST/Interp/constexpr-subobj-initialization.cpp b/clang/test/AST/ByteCode/constexpr-subobj-initialization.cpp similarity index 100% rename from clang/test/AST/Interp/constexpr-subobj-initialization.cpp rename to clang/test/AST/ByteCode/constexpr-subobj-initialization.cpp diff --git a/clang/test/AST/Interp/crash-GH49103-2.cpp b/clang/test/AST/ByteCode/crash-GH49103-2.cpp similarity index 100% rename from clang/test/AST/Interp/crash-GH49103-2.cpp rename to clang/test/AST/ByteCode/crash-GH49103-2.cpp diff --git a/clang/test/AST/Interp/cxx03.cpp b/clang/test/AST/ByteCode/cxx03.cpp similarity index 100% rename from clang/test/AST/Interp/cxx03.cpp rename to clang/test/AST/ByteCode/cxx03.cpp diff --git a/clang/test/AST/Interp/cxx11.cpp b/clang/test/AST/ByteCode/cxx11.cpp similarity index 100% rename from clang/test/AST/Interp/cxx11.cpp rename to clang/test/AST/ByteCode/cxx11.cpp diff --git a/clang/test/AST/Interp/cxx17.cpp b/clang/test/AST/ByteCode/cxx17.cpp similarity index 100% rename from clang/test/AST/Interp/cxx17.cpp rename to clang/test/AST/ByteCode/cxx17.cpp diff --git a/clang/test/AST/Interp/cxx20.cpp b/clang/test/AST/ByteCode/cxx20.cpp similarity index 100% rename from clang/test/AST/Interp/cxx20.cpp rename to clang/test/AST/ByteCode/cxx20.cpp diff --git a/clang/test/AST/Interp/cxx23.cpp b/clang/test/AST/ByteCode/cxx23.cpp similarity index 100% rename from clang/test/AST/Interp/cxx23.cpp rename to clang/test/AST/ByteCode/cxx23.cpp diff --git a/clang/test/AST/Interp/cxx26.cpp b/clang/test/AST/ByteCode/cxx26.cpp similarity index 100% rename from clang/test/AST/Interp/cxx26.cpp rename to clang/test/AST/ByteCode/cxx26.cpp diff --git a/clang/test/AST/Interp/cxx2a.cpp b/clang/test/AST/ByteCode/cxx2a.cpp similarity index 100% rename from clang/test/AST/Interp/cxx2a.cpp rename to clang/test/AST/ByteCode/cxx2a.cpp diff --git a/clang/test/AST/Interp/cxx98.cpp b/clang/test/AST/ByteCode/cxx98.cpp similarity index 100% rename from clang/test/AST/Interp/cxx98.cpp rename to clang/test/AST/ByteCode/cxx98.cpp diff --git a/clang/test/AST/Interp/depth-limit.cpp b/clang/test/AST/ByteCode/depth-limit.cpp similarity index 100% rename from clang/test/AST/Interp/depth-limit.cpp rename to clang/test/AST/ByteCode/depth-limit.cpp diff --git a/clang/test/AST/Interp/depth-limit2.cpp b/clang/test/AST/ByteCode/depth-limit2.cpp similarity index 100% rename from clang/test/AST/Interp/depth-limit2.cpp rename to clang/test/AST/ByteCode/depth-limit2.cpp diff --git a/clang/test/AST/Interp/enums-targets.cpp b/clang/test/AST/ByteCode/enums-targets.cpp similarity index 100% rename from clang/test/AST/Interp/enums-targets.cpp rename to clang/test/AST/ByteCode/enums-targets.cpp diff --git a/clang/test/AST/Interp/enums.cpp b/clang/test/AST/ByteCode/enums.cpp similarity index 100% rename from clang/test/AST/Interp/enums.cpp rename to clang/test/AST/ByteCode/enums.cpp diff --git a/clang/test/AST/Interp/eval-order.cpp b/clang/test/AST/ByteCode/eval-order.cpp similarity index 100% rename from clang/test/AST/Interp/eval-order.cpp rename to clang/test/AST/ByteCode/eval-order.cpp diff --git a/clang/test/AST/Interp/floats.cpp b/clang/test/AST/ByteCode/floats.cpp similarity index 100% rename from clang/test/AST/Interp/floats.cpp rename to clang/test/AST/ByteCode/floats.cpp diff --git a/clang/test/AST/Interp/functions.cpp b/clang/test/AST/ByteCode/functions.cpp similarity index 100% rename from clang/test/AST/Interp/functions.cpp rename to clang/test/AST/ByteCode/functions.cpp diff --git a/clang/test/AST/Interp/hlsl.hlsl b/clang/test/AST/ByteCode/hlsl.hlsl similarity index 100% rename from clang/test/AST/Interp/hlsl.hlsl rename to clang/test/AST/ByteCode/hlsl.hlsl diff --git a/clang/test/AST/Interp/if.cpp b/clang/test/AST/ByteCode/if.cpp similarity index 100% rename from clang/test/AST/Interp/if.cpp rename to clang/test/AST/ByteCode/if.cpp diff --git a/clang/test/AST/Interp/intap.cpp b/clang/test/AST/ByteCode/intap.cpp similarity index 100% rename from clang/test/AST/Interp/intap.cpp rename to clang/test/AST/ByteCode/intap.cpp diff --git a/clang/test/AST/Interp/invalid.cpp b/clang/test/AST/ByteCode/invalid.cpp similarity index 100% rename from clang/test/AST/Interp/invalid.cpp rename to clang/test/AST/ByteCode/invalid.cpp diff --git a/clang/test/AST/Interp/lambda.cpp b/clang/test/AST/ByteCode/lambda.cpp similarity index 100% rename from clang/test/AST/Interp/lambda.cpp rename to clang/test/AST/ByteCode/lambda.cpp diff --git a/clang/test/AST/Interp/lifetimes.cpp b/clang/test/AST/ByteCode/lifetimes.cpp similarity index 100% rename from clang/test/AST/Interp/lifetimes.cpp rename to clang/test/AST/ByteCode/lifetimes.cpp diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/ByteCode/literals.cpp similarity index 100% rename from clang/test/AST/Interp/literals.cpp rename to clang/test/AST/ByteCode/literals.cpp diff --git a/clang/test/AST/Interp/loops.cpp b/clang/test/AST/ByteCode/loops.cpp similarity index 100% rename from clang/test/AST/Interp/loops.cpp rename to clang/test/AST/ByteCode/loops.cpp diff --git a/clang/test/AST/Interp/memberpointers.cpp b/clang/test/AST/ByteCode/memberpointers.cpp similarity index 100% rename from clang/test/AST/Interp/memberpointers.cpp rename to clang/test/AST/ByteCode/memberpointers.cpp diff --git a/clang/test/AST/Interp/ms.cpp b/clang/test/AST/ByteCode/ms.cpp similarity index 100% rename from clang/test/AST/Interp/ms.cpp rename to clang/test/AST/ByteCode/ms.cpp diff --git a/clang/test/AST/Interp/mutable.cpp b/clang/test/AST/ByteCode/mutable.cpp similarity index 100% rename from clang/test/AST/Interp/mutable.cpp rename to clang/test/AST/ByteCode/mutable.cpp diff --git a/clang/test/AST/Interp/new-delete.cpp b/clang/test/AST/ByteCode/new-delete.cpp similarity index 100% rename from clang/test/AST/Interp/new-delete.cpp rename to clang/test/AST/ByteCode/new-delete.cpp diff --git a/clang/test/AST/Interp/nullable.cpp b/clang/test/AST/ByteCode/nullable.cpp similarity index 100% rename from clang/test/AST/Interp/nullable.cpp rename to clang/test/AST/ByteCode/nullable.cpp diff --git a/clang/test/AST/Interp/objc.mm b/clang/test/AST/ByteCode/objc.mm similarity index 100% rename from clang/test/AST/Interp/objc.mm rename to clang/test/AST/ByteCode/objc.mm diff --git a/clang/test/AST/Interp/opencl.cl b/clang/test/AST/ByteCode/opencl.cl similarity index 100% rename from clang/test/AST/Interp/opencl.cl rename to clang/test/AST/ByteCode/opencl.cl diff --git a/clang/test/AST/Interp/pointer-addition.c b/clang/test/AST/ByteCode/pointer-addition.c similarity index 100% rename from clang/test/AST/Interp/pointer-addition.c rename to clang/test/AST/ByteCode/pointer-addition.c diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/ByteCode/records.cpp similarity index 100% rename from clang/test/AST/Interp/records.cpp rename to clang/test/AST/ByteCode/records.cpp diff --git a/clang/test/AST/Interp/references.cpp b/clang/test/AST/ByteCode/references.cpp similarity index 100% rename from clang/test/AST/Interp/references.cpp rename to clang/test/AST/ByteCode/references.cpp diff --git a/clang/test/AST/Interp/shifts.cpp b/clang/test/AST/ByteCode/shifts.cpp similarity index 100% rename from clang/test/AST/Interp/shifts.cpp rename to clang/test/AST/ByteCode/shifts.cpp diff --git a/clang/test/AST/Interp/spaceship.cpp b/clang/test/AST/ByteCode/spaceship.cpp similarity index 100% rename from clang/test/AST/Interp/spaceship.cpp rename to clang/test/AST/ByteCode/spaceship.cpp diff --git a/clang/test/AST/Interp/switch.cpp b/clang/test/AST/ByteCode/switch.cpp similarity index 100% rename from clang/test/AST/Interp/switch.cpp rename to clang/test/AST/ByteCode/switch.cpp diff --git a/clang/test/AST/Interp/sycl.cpp b/clang/test/AST/ByteCode/sycl.cpp similarity index 100% rename from clang/test/AST/Interp/sycl.cpp rename to clang/test/AST/ByteCode/sycl.cpp diff --git a/clang/test/AST/Interp/unions.cpp b/clang/test/AST/ByteCode/unions.cpp similarity index 100% rename from clang/test/AST/Interp/unions.cpp rename to clang/test/AST/ByteCode/unions.cpp diff --git a/clang/test/AST/Interp/vectors.cpp b/clang/test/AST/ByteCode/vectors.cpp similarity index 100% rename from clang/test/AST/Interp/vectors.cpp rename to clang/test/AST/ByteCode/vectors.cpp diff --git a/clang/test/AST/Interp/weak.cpp b/clang/test/AST/ByteCode/weak.cpp similarity index 100% rename from clang/test/AST/Interp/weak.cpp rename to clang/test/AST/ByteCode/weak.cpp diff --git a/clang/unittests/AST/Interp/CMakeLists.txt b/clang/unittests/AST/ByteCode/CMakeLists.txt similarity index 100% rename from clang/unittests/AST/Interp/CMakeLists.txt rename to clang/unittests/AST/ByteCode/CMakeLists.txt diff --git a/clang/unittests/AST/Interp/Descriptor.cpp b/clang/unittests/AST/ByteCode/Descriptor.cpp similarity index 95% rename from clang/unittests/AST/Interp/Descriptor.cpp rename to clang/unittests/AST/ByteCode/Descriptor.cpp index abcf1bb0714cc8..9e09c7f15ac9a2 100644 --- a/clang/unittests/AST/Interp/Descriptor.cpp +++ b/clang/unittests/AST/ByteCode/Descriptor.cpp @@ -1,6 +1,6 @@ -#include "../../../lib/AST/Interp/Descriptor.h" -#include "../../../lib/AST/Interp/Context.h" -#include "../../../lib/AST/Interp/Program.h" +#include "../../../lib/AST/ByteCode/Descriptor.h" +#include "../../../lib/AST/ByteCode/Context.h" +#include "../../../lib/AST/ByteCode/Program.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/ASTMatchers/ASTMatchFinder.h" @@ -15,17 +15,17 @@ using namespace clang::ast_matchers; /// Inspect generated Descriptors as well as the pointers we create. /// TEST(Descriptor, Primitives) { - constexpr char Code[] = - "struct A { bool a; bool b; };\n" - "struct S {\n" - " float f;\n" - " char s[4];\n" - " A a[3];\n" - " short l[3][3];\n" - " int EmptyA[0];\n" - "};\n" - "constexpr S d = {0.0, \"foo\", {{true, false}, {false, true}, {false, false}},\n" - " {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, {}};\n"; + constexpr char Code[] = "struct A { bool a; bool b; };\n" + "struct S {\n" + " float f;\n" + " char s[4];\n" + " A a[3];\n" + " short l[3][3];\n" + " int EmptyA[0];\n" + "};\n" + "constexpr S d = {0.0, \"foo\", {{true, false}, " + "{false, true}, {false, false}},\n" + " {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, {}};\n"; auto AST = tooling::buildASTFromCodeWithArgs( Code, {"-fexperimental-new-constant-interpreter"}); diff --git a/clang/unittests/AST/Interp/toAPValue.cpp b/clang/unittests/AST/ByteCode/toAPValue.cpp similarity index 98% rename from clang/unittests/AST/Interp/toAPValue.cpp rename to clang/unittests/AST/ByteCode/toAPValue.cpp index 5ec607a8243492..3f141878fb9594 100644 --- a/clang/unittests/AST/Interp/toAPValue.cpp +++ b/clang/unittests/AST/ByteCode/toAPValue.cpp @@ -1,6 +1,6 @@ -#include "../../../lib/AST/Interp/Context.h" -#include "../../../lib/AST/Interp/Descriptor.h" -#include "../../../lib/AST/Interp/Program.h" +#include "../../../lib/AST/ByteCode/Context.h" +#include "../../../lib/AST/ByteCode/Descriptor.h" +#include "../../../lib/AST/ByteCode/Program.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/ASTMatchers/ASTMatchFinder.h" diff --git a/clang/unittests/AST/CMakeLists.txt b/clang/unittests/AST/CMakeLists.txt index 51245599736cfb..40d2e1ff77a601 100644 --- a/clang/unittests/AST/CMakeLists.txt +++ b/clang/unittests/AST/CMakeLists.txt @@ -5,7 +5,7 @@ set(LLVM_LINK_COMPONENTS ) -add_subdirectory(Interp) +add_subdirectory(ByteCode) add_clang_unittest(ASTTests ASTContextParentMapTest.cpp _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits