[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 13:17:22 PDT 2017


yaxunl added inline comments.


================
Comment at: include/clang/Basic/AddressSpaces.h:66
 
+inline LangAS LangASFromTargetAS(unsigned TargetAS) {
+  return static_cast<LangAS>((TargetAS) +
----------------
how about `getLangASFromTargetAS` ? It is preferred to start with small letters.


================
Comment at: tools/libclang/CXType.cpp:402
+  ASTContext &Ctx = cxtu::getASTUnit(GetTU(CT))->getASTContext();
+  return Ctx.getTargetAddressSpace(T);
 }
----------------
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.


https://reviews.llvm.org/D38816





More information about the cfe-commits mailing list