Files
clang-p2996/lldb/lit/SymbolFile/NativePDB/bitfields.cpp
Zachary Turner ba968c0d1d [lit] Add a generic build script with a lit substitution.
This adds a script called build.py as well as a lit substitution
called %build that we can use to invoke it.  The idea is that
this allows a lit test to build test inferiors without having
to worry about architecture / platform specific differences,
command line syntax, finding / configurationg a proper toolchain,
and other issues.  They can simply write something like:

%build --arch=32 -o %t.exe %p/Inputs/foo.cpp

and it will just work.  This paves the way for being able to
run lit tests with multiple configurations, platforms, and
compilers with a single test.

Differential Revision: https://reviews.llvm.org/D54914

llvm-svn: 348058
2018-12-01 00:22:21 +00:00

61 lines
1.8 KiB
C++

// clang-format off
// REQUIRES: lld
// Test various interesting cases for AST reconstruction.
// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
// RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
// Test trivial versions of each tag type.
struct Struct {
int A : 5 = 6;
int B : 7 = 8;
unsigned C : 3 = 2;
unsigned D : 15 = 12345;
char E : 1 = 0;
char F : 2 = 1;
char G : 3 = 2;
// H should be at offset 0 of a new byte.
char H : 3 = 3;
};
constexpr Struct TheStruct;
int main(int argc, char **argv) {
return TheStruct.A;
}
// CHECK: (lldb) target variable -T TheStruct
// CHECK: (const Struct) TheStruct = {
// CHECK: (int:5) A = 6
// CHECK: (int:7) B = 8
// CHECK: (unsigned int:3) C = 2
// CHECK: (unsigned int:15) D = 12345
// CHECK: (char:1) E = '\0'
// CHECK: (char:2) F = '\x01'
// CHECK: (char:3) G = '\x02'
// CHECK: (char:3) H = '\x03'
// CHECK: }
//
// CHECK: target modules dump ast
// CHECK: Dumping clang ast for 1 modules.
// CHECK: TranslationUnitDecl {{.*}}
// CHECK: |-CXXRecordDecl {{.*}} struct Struct definition
// CHECK: | |-FieldDecl {{.*}} A 'int'
// CHECK: | | `-IntegerLiteral {{.*}} 'int' 5
// CHECK: | |-FieldDecl {{.*}} B 'int'
// CHECK: | | `-IntegerLiteral {{.*}} 'int' 7
// CHECK: | |-FieldDecl {{.*}} C 'unsigned int'
// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
// CHECK: | |-FieldDecl {{.*}} D 'unsigned int'
// CHECK: | | `-IntegerLiteral {{.*}} 'int' 15
// CHECK: | |-FieldDecl {{.*}} E 'char'
// CHECK: | | `-IntegerLiteral {{.*}} 'int' 1
// CHECK: | |-FieldDecl {{.*}} F 'char'
// CHECK: | | `-IntegerLiteral {{.*}} 'int' 2
// CHECK: | |-FieldDecl {{.*}} G 'char'
// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
// CHECK: | `-FieldDecl {{.*}} H 'char'
// CHECK: | `-IntegerLiteral {{.*}} 'int' 3