This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Fix layering violation by getOpenCLTypeAddrSpace
ClosedPublic

Authored by svenvh on Dec 5 2017, 6:57 AM.

Details

Summary

Commit 7ac28eb0a5 / r310911 ("[OpenCL] Allow targets to select address
space per type", 2017-08-15) made Basic depend on AST, introducing a
circular dependency. Break this dependency by adding the
OpenCLTypeKind enum in Basic and map from AST types to this enum in
ASTContext.

Diff Detail

Repository
rC Clang

Event Timeline

svenvh created this revision.Dec 5 2017, 6:57 AM
yaxunl added inline comments.Dec 5 2017, 8:46 AM
lib/CodeGen/CGOpenCLRuntime.cpp
40

Maybe also introduce ASTContext::getOpenCLTypeAddrSpace(const Type *T) for convenience. It has TargetInfo member.

svenvh updated this revision to Diff 125554.Dec 5 2017, 9:27 AM

Introducing ASTContext::getOpenCLTypeAddrSpace(const Type *T) as suggested.

svenvh marked an inline comment as done.Dec 5 2017, 9:28 AM
yaxunl accepted this revision.Dec 5 2017, 9:38 AM

LGTM. Thanks!

This revision is now accepted and ready to land.Dec 5 2017, 9:38 AM
chapuni added a subscriber: chapuni.Dec 5 2017, 2:37 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.