summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-03-12 04:21:28 +0000
committerJohn McCall <rjmccall@apple.com>2010-03-12 04:21:28 +0000
commitb8b94668b6598f3a466769bfe9e1eb49bf6a3751 (patch)
tree309811fa66c68dec18d7bf749c9100af01e25fd6 /clang/lib/AST/ASTContext.cpp
parent959e830292242377ec13bcb842720528fe4bdab3 (diff)
downloadbcm5719-llvm-b8b94668b6598f3a466769bfe9e1eb49bf6a3751.tar.gz
bcm5719-llvm-b8b94668b6598f3a466769bfe9e1eb49bf6a3751.zip
Extend the builtin syntax to allow address-space qualifiers on pointers and
references. Based on a patch by Arnaud de Grandmaison! llvm-svn: 98327
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 079c16ac6b2..ea121165fc2 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -4973,13 +4973,24 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context,
Done = false;
while (!Done) {
- switch (*Str++) {
+ switch (char c = *Str++) {
default: Done = true; --Str; break;
case '*':
- Type = Context.getPointerType(Type);
- break;
case '&':
- Type = Context.getLValueReferenceType(Type);
+ {
+ // Both pointers and references can have their pointee types
+ // qualified with an address space.
+ char *End;
+ unsigned AddrSpace = strtoul(Str, &End, 10);
+ if (End != Str && AddrSpace != 0) {
+ Type = Context.getAddrSpaceQualType(Type, AddrSpace);
+ Str = End;
+ }
+ }
+ if (c == '*')
+ Type = Context.getPointerType(Type);
+ else
+ Type = Context.getLValueReferenceType(Type);
break;
// FIXME: There's no way to have a built-in with an rvalue ref arg.
case 'C':
OpenPOWER on IntegriCloud