--- /dev/null
+// 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;
+}
--- /dev/null
+; 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
WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
PointeeType->dump(*this);
Printer << (Symbol.isReference() ? "&" : "*");
+
+ if (Symbol.getRawSymbol().isRestrictedType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << " __restrict";
}
}
PointeeType->dump(*this);
Printer << ((Symbol.isReference()) ? "&" : "*");
}
+
+ if (Symbol.getRawSymbol().isRestrictedType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << " __restrict";
}
void TypedefDumper::dump(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) {
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) {