Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tools/cquery/cc_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@

CC_INFO = "CcInfo"

def file_list_to_paths(files):
return [getattr(f, "path", f) for f in files]

def compilation_context_to_struct(ctx):
return struct(
defines = ctx.defines.to_list(),
direct_headers = ctx.direct_headers,
direct_private_headers = ctx.direct_private_headers,
derect_textutal_headers = ctx.direct_textual_headers,
headers = file_list_to_paths(ctx.headers.to_list()),
direct_headers = file_list_to_paths(ctx.direct_headers),
direct_private_headers = file_list_to_paths(ctx.direct_private_headers),
derect_textutal_headers = file_list_to_paths(ctx.direct_textual_headers),
external_includes = ctx.external_includes.to_list(),
framework_includes = ctx.framework_includes.to_list(),
includes = ctx.includes.to_list(),
Expand Down Expand Up @@ -40,7 +44,7 @@ def format_cc_info(info):
def format(target):
buffer = "%s: " % target.label

if CC_INFO in providers(target):
if CC_INFO in (providers(target) or []):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what case we can have providers(target) as None?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry idk, but in some cases it is and this keeps the cquery from failing

buffer += format_cc_info(providers(target)[CC_INFO])
else:
buffer += "NO CcInfo"
Expand Down
4 changes: 2 additions & 2 deletions tools/cquery/cc_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def format_cc_toolchain(toolchain):
def format(target):
buffer = "%s: " % target.label

if CC_TOOLCHAIN_INFO in providers(target):
if CC_TOOLCHAIN_INFO in (providers(target) or []):
buffer += format_cc_toolchain(providers(target)[CC_TOOLCHAIN_INFO])
else:
buffer += "NO CcTolchainInfo"

return buffer
return buffer