1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[llvm-pdbdump] Dump restrict type qualifier

Reviewers: zturner, llvm-commits, rnk

Reviewed By: zturner

Subscribers: majnemer

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

llvm-svn: 326731
This commit is contained in:
Aaron Smith 2018-03-05 18:29:43 +00:00
parent 33418abafa
commit ec586751d8
6 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,55 @@
// Compile with "cl /c /Zi /GR- TypeQualifiersTest.cpp"
// Link with "link TypeQualifiersTest.obj /debug /nodefaultlib /entry:main"
union Union {
int * __restrict x_member;
float * __restrict y_member;
int* volatile __restrict m_volatile;
const char* m_const;
};
int f(const volatile int* __restrict arg_crv) {
Union u;
return 1;
}
void g(int& __restrict arg_ref) {
}
namespace NS {
class Class {
public:
int get() const { return 1;}
int set() __restrict { return 2; }
void help() volatile { return; }
};
struct Foo {
int a;
int b;
int func(int x) __restrict { return 1; }
};
Foo s = { 10 };
const int* __restrict p_object = &s.a;
volatile int Foo:: * __restrict p_data_member = &Foo::a;
int (Foo::* p_member_func)(int) __restrict = &Foo::func;
}
typedef long* __restrict RestrictTypedef;
RestrictTypedef RestrictVar;
typedef volatile int* __restrict RankNArray[10][100];
RankNArray ArrayVar;
int main() {
NS::Class ClassVar;
ClassVar.get();
ClassVar.help();
ClassVar.set();
return 0;
}

View File

@ -0,0 +1,25 @@
; RUN: llvm-pdbutil pretty -all -class-recurse-depth=1 \
; RUN: %p/Inputs/TypeQualifiersTest.pdb > %t
; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBALS_FUNC
; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBALS_DATA
; RUN: FileCheck -input-file=%t %s -check-prefix=QUALS
; GLOBALS_FUNC: ---GLOBALS---
; GLOBALS_FUNC-DAG: int __cdecl f(const volatile int* __restrict arg_crv)
; GLOBALS_FUNC-DAG: void __cdecl g(int& __restrict arg_ref)
; GLOBALS_DATA: ---GLOBALS---
; GLOBALS_DATA-DAG: static volatile int* __restrict ArrayVar[10][100]
; GLOBALS_DATA-DAG: static long* __restrict RestrictVar
; GLOBALS_DATA-DAG: static const int* __restrict NS::p_object
; GLOBALS_DATA-DAG: static NS::Foo NS::s
; GLOBALS_DATA-DAG: static volatile int* __restrict NS::p_data_member
; QUALS: ---TYPES---
; QUALS-DAG: typedef RankNArray
; QUALS-DAG: typedef long* __restrict RestrictTypedef
; QUALS: union Union
; QUALS-DAG: int* __restrict x_member
; QUALS-DAG: float* __restrict y_member
; QUALS-DAG: int* volatile __restrict m_volatile
; QUALS-DAG: const char* m_const

View File

@ -252,6 +252,9 @@ void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol) {
WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
PointeeType->dump(*this);
Printer << (Symbol.isReference() ? "&" : "*");
if (Symbol.getRawSymbol().isRestrictedType())
WithColor(Printer, PDB_ColorItem::Keyword).get() << " __restrict";
}
}

View File

@ -63,6 +63,9 @@ void TypedefDumper::dump(const PDBSymbolTypePointer &Symbol) {
PointeeType->dump(*this);
Printer << ((Symbol.isReference()) ? "&" : "*");
}
if (Symbol.getRawSymbol().isRestrictedType())
WithColor(Printer, PDB_ColorItem::Keyword).get() << " __restrict";
}
void TypedefDumper::dump(const PDBSymbolTypeFunctionSig &Symbol) {

View File

@ -169,6 +169,9 @@ void VariableDumper::dumpRight(const PDBSymbolTypeFunctionSig &Symbol) {
WithColor(Printer, PDB_ColorItem::Keyword).get() << " const";
if (Symbol.isVolatileType())
WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile";
if (Symbol.getRawSymbol().isRestrictedType())
WithColor(Printer, PDB_ColorItem::Keyword).get() << " __restrict";
}
void VariableDumper::dump(const PDBSymbolTypePointer &Symbol) {
@ -189,6 +192,9 @@ void VariableDumper::dump(const PDBSymbolTypePointer &Symbol) {
WithColor(Printer, PDB_ColorItem::Keyword).get() << " const ";
if (Symbol.isVolatileType())
WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile ";
if (Symbol.getRawSymbol().isRestrictedType())
WithColor(Printer, PDB_ColorItem::Keyword).get() << " __restrict ";
}
void VariableDumper::dumpRight(const PDBSymbolTypePointer &Symbol) {