[PATCH] D38816: Convert clang::LangAS to a strongly typed enum

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 18:31:42 PDT 2017

yaxunl added inline comments.

Comment at: tools/libclang/CXType.cpp:402
+  ASTContext &Ctx = cxtu::getASTUnit(GetTU(CT))->getASTContext();
+  return Ctx.getTargetAddressSpace(T);
arichardson wrote:
> yaxunl wrote:
> > Is this function suppose to return AST address space or target address space?
> > 
> > Some targets e.g. x86 maps all AST address spaces to 0. Returning target address space will not let the client unable to differentiate different address spaces in the source language.
> I am not entirely sure what the correct return value is here because the current implementation returns either the LanguageAS or `LangAS - LangAS::FirstTargetAddressSpace` which can also overlap. So possibly it should just always returning the AST address space?
> I think for now I will just keep the current behaviour with a FIXME and create a followup patch.
That's fine. Thanks.


More information about the cfe-commits mailing list