blob: e3d8c85b335cdfda8f0f4bb685eed08f0469af31 [file] [log] [blame]
package {
default_applicable_licenses: ["external_clang_license"],
}
// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
//
// large-scale-change included anything that looked like it might be a license
// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
//
// Please consider removing redundant or irrelevant files from 'license_text:'.
//
// large-scale-change filtered out the below license kinds as false-positives:
// SPDX-license-identifier-GPL
// See: http://go/android-license-faq
license {
name: "external_clang_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
"SPDX-license-identifier-BSD",
"SPDX-license-identifier-MIT",
"SPDX-license-identifier-NCSA",
],
license_text: [
"LICENSE.TXT",
"NOTICE",
],
}
cc_defaults {
name: "clang-defaults",
defaults: [
"llvm-defaults",
],
header_libs: ["clang-headers"],
cflags: [
"-pedantic",
"-Wno-cast-qual",
"-Wno-long-long",
"-Wno-unreachable-code-loop-increment",
"-Wno-unused-lambda-capture",
"-Wno-unused-private-field",
],
include_dirs: [
"external/clang/include",
"external/clang/lib/CodeGen",
],
tidy_checks: [
"-google-runtime-member-string-references",
],
target: {
windows: {
enabled: true,
cflags: [
// This triggers an assertion on cross Windows builds.
"-Wno-error=uninitialized",
],
},
not_windows: {
cflags: [
"-Wno-unused-lambda-capture",
],
},
},
}
clang_generated_headers = [
"clang-gen-options",
"clang-gen-attributes",
"clang-gen-checkers",
"clang-gen-comment-commands",
"clang-gen-comment-html-named-character-references",
"clang-gen-html-tags",
"clang-gen-comment-nodes",
"clang-gen-diagnostics",
"clang-gen-declnodes",
"clang-gen-statnodes",
"clang-gen-arm-neon",
"clang-version",
"llvm-gen-attributes",
"llvm-gen-intrinsics",
]
cc_library_headers {
name: "clang-headers",
vendor_available: true,
product_available: true,
host_supported: true,
// TODO(b/153609531): remove when no longer needed.
native_bridge_supported: true,
generated_headers: clang_generated_headers,
export_include_dirs: ["include"],
export_generated_headers: clang_generated_headers,
target: {
windows: {
enabled: true,
},
},
}
llvm_tblgen {
name: "clang-gen-options",
in: "include/clang/Driver/Options.td",
outs: ["clang/Driver/Options.inc"],
}
clang_tblgen {
name: "clang-gen-attributes",
in: "include/clang/Basic/Attr.td",
outs: [
"clang/AST/AttrDump.inc",
"clang/AST/AttrImpl.inc",
"clang/AST/Attrs.inc",
"clang/AST/AttrVisitor.inc",
"clang/Basic/AttrHasAttributeImpl.inc",
"clang/Basic/AttrList.inc",
"clang/Parse/AttrParserStringSwitches.inc",
"clang/Sema/AttrParsedAttrImpl.inc",
"clang/Sema/AttrParsedAttrKinds.inc",
"clang/Sema/AttrParsedAttrList.inc",
"clang/Sema/AttrSpellingListIndex.inc",
"clang/Sema/AttrTemplateInstantiate.inc",
"clang/Serialization/AttrPCHRead.inc",
"clang/Serialization/AttrPCHWrite.inc",
],
}
clang_tblgen {
name: "clang-gen-checkers",
in: "include/clang/StaticAnalyzer/Checkers/Checkers.td",
outs: ["clang/StaticAnalyzer/Checkers/Checkers.inc"],
}
clang_tblgen {
name: "clang-gen-comment-commands",
in: "include/clang/AST/CommentCommands.td",
outs: [
"clang/AST/CommentCommandInfo.inc",
"clang/AST/CommentCommandList.inc",
],
}
clang_tblgen {
name: "clang-gen-comment-html-named-character-references",
in: "include/clang/AST/CommentHTMLNamedCharacterReferences.td",
outs: ["clang/AST/CommentHTMLNamedCharacterReferences.inc"],
}
clang_tblgen {
name: "clang-gen-html-tags",
in: "include/clang/AST/CommentHTMLTags.td",
outs: [
"clang/AST/CommentHTMLTagsProperties.inc",
"clang/AST/CommentHTMLTags.inc",
],
}
clang_tblgen {
name: "clang-gen-comment-nodes",
in: "include/clang/Basic/CommentNodes.td",
outs: ["clang/AST/CommentNodes.inc"],
}
clang_tblgen {
name: "clang-gen-diagnostics",
in: "include/clang/Basic/Diagnostic.td",
outs: [
"clang/Basic/DiagnosticAnalysisKinds.inc",
"clang/Basic/DiagnosticASTKinds.inc",
"clang/Basic/DiagnosticCommentKinds.inc",
"clang/Basic/DiagnosticCommonKinds.inc",
"clang/Basic/DiagnosticDriverKinds.inc",
"clang/Basic/DiagnosticFrontendKinds.inc",
"clang/Basic/DiagnosticLexKinds.inc",
"clang/Basic/DiagnosticParseKinds.inc",
"clang/Basic/DiagnosticSemaKinds.inc",
"clang/Basic/DiagnosticSerializationKinds.inc",
"clang/Basic/DiagnosticGroups.inc",
"clang/Basic/DiagnosticIndexName.inc",
],
}
clang_tblgen {
name: "clang-gen-declnodes",
in: "include/clang/Basic/DeclNodes.td",
outs: ["clang/AST/DeclNodes.inc"],
}
clang_tblgen {
name: "clang-gen-statnodes",
in: "include/clang/Basic/StmtNodes.td",
outs: ["clang/AST/StmtNodes.inc"],
}
clang_tblgen {
name: "clang-gen-arm-neon",
in: "include/clang/Basic/arm_neon.td",
outs: [
"clang/Basic/arm_neon.inc",
"clang/Basic/arm_neon.h",
],
}
genrule {
name: "clang-version",
cmd: "$(location) $(in) > $(out)",
tool_files: [
"clang-version-inc.py",
"version.py",
],
srcs: [
"include/clang/Basic/Version.inc.in",
],
out: ["clang/Basic/Version.inc"],
}
cc_library_shared {
name: "libclang_android",
defaults: [
"clang-defaults",
"force_build_llvm_components",
],
host_supported: true,
whole_static_libs: [
"libclangAnalysis",
"libclangAST",
"libclangASTMatchers",
"libclangBasic",
"libclangCodeGen",
"libclangDriver",
"libclangEdit",
"libclangFormat",
"libclangFrontend",
"libclangIndex",
"libclangLex",
"libclangLibclang",
"libclangParse",
"libclangRewrite",
"libclangRewriteFrontend",
"libclangSema",
"libclangSerialization",
"libclangTooling",
"libclangToolingCore",
],
export_shared_lib_headers: ["libLLVM_android"],
shared_libs: ["libLLVM_android"],
export_header_lib_headers: ["clang-headers"],
target: {
windows: {
host_ldlibs: [
"-limagehlp",
"-lpsapi",
"-lversion",
],
},
not_windows: {
shared_libs: ["libc++"],
},
},
product_variables: {
unbundled_build: {
// Don't build the library in unbundled branches.
enabled: false,
},
},
}
subdirs = [
"lib",
"soong",
"utils/TableGen",
"tools/clang-check",
"tools/clang-format",
"tools/driver",
"tools/libclang",
]