1cc_defaults { 2 name: "clang-defaults", 3 defaults: [ 4 "llvm-defaults", 5 ], 6 clang: true, 7 8 header_libs: ["clang-headers"], 9 10 cflags: [ 11 "-pedantic", 12 "-Wcast-qual", 13 "-Wno-long-long", 14 ], 15 16 include_dirs: [ 17 "external/clang/include", 18 "external/clang/lib/CodeGen", 19 ], 20 21 target: { 22 windows: { 23 enabled: true, 24 cflags: [ 25 // This triggers an assertion on cross Windows builds. 26 "-Wno-error=uninitialized", 27 ], 28 }, 29 }, 30 31} 32 33clang_generated_headers = [ 34 "clang-gen-options", 35 "clang-gen-attributes", 36 "clang-gen-checkers", 37 "clang-gen-comment-commands", 38 "clang-gen-comment-html-named-character-references", 39 "clang-gen-html-tags", 40 "clang-gen-comment-nodes", 41 "clang-gen-diagnostics", 42 "clang-gen-declnodes", 43 "clang-gen-statnodes", 44 "clang-gen-arm-neon", 45 "clang-version", 46 "llvm-gen-attributes", 47 "llvm-gen-intrinsics", 48] 49 50cc_library_headers { 51 name: "clang-headers", 52 host_supported: true, 53 generated_headers: clang_generated_headers, 54 export_include_dirs: ["include"], 55 export_generated_headers: clang_generated_headers, 56 target: { 57 windows: { 58 enabled: true, 59 }, 60 }, 61} 62 63llvm_tblgen { 64 name: "clang-gen-options", 65 in: "include/clang/Driver/Options.td", 66 outs: ["clang/Driver/Options.inc"], 67} 68 69clang_tblgen { 70 name: "clang-gen-attributes", 71 in: "include/clang/Basic/Attr.td", 72 outs: [ 73 "clang/AST/AttrDump.inc", 74 "clang/AST/AttrImpl.inc", 75 "clang/AST/Attrs.inc", 76 "clang/AST/AttrVisitor.inc", 77 "clang/Basic/AttrHasAttributeImpl.inc", 78 "clang/Basic/AttrList.inc", 79 "clang/Parse/AttrParserStringSwitches.inc", 80 "clang/Sema/AttrParsedAttrImpl.inc", 81 "clang/Sema/AttrParsedAttrKinds.inc", 82 "clang/Sema/AttrParsedAttrList.inc", 83 "clang/Sema/AttrSpellingListIndex.inc", 84 "clang/Sema/AttrTemplateInstantiate.inc", 85 "clang/Serialization/AttrPCHRead.inc", 86 "clang/Serialization/AttrPCHWrite.inc", 87 ], 88} 89 90clang_tblgen { 91 name: "clang-gen-checkers", 92 in: "include/clang/StaticAnalyzer/Checkers/Checkers.td", 93 outs: ["clang/StaticAnalyzer/Checkers/Checkers.inc"], 94} 95 96clang_tblgen { 97 name: "clang-gen-comment-commands", 98 in: "include/clang/AST/CommentCommands.td", 99 outs: [ 100 "clang/AST/CommentCommandInfo.inc", 101 "clang/AST/CommentCommandList.inc", 102 ], 103} 104 105clang_tblgen { 106 name: "clang-gen-comment-html-named-character-references", 107 in: "include/clang/AST/CommentHTMLNamedCharacterReferences.td", 108 outs: ["clang/AST/CommentHTMLNamedCharacterReferences.inc"], 109} 110 111clang_tblgen { 112 name: "clang-gen-html-tags", 113 in: "include/clang/AST/CommentHTMLTags.td", 114 outs: [ 115 "clang/AST/CommentHTMLTagsProperties.inc", 116 "clang/AST/CommentHTMLTags.inc", 117 ], 118} 119 120clang_tblgen { 121 name: "clang-gen-comment-nodes", 122 in: "include/clang/Basic/CommentNodes.td", 123 outs: ["clang/AST/CommentNodes.inc"], 124} 125 126clang_tblgen { 127 name: "clang-gen-diagnostics", 128 in: "include/clang/Basic/Diagnostic.td", 129 outs: [ 130 "clang/Basic/DiagnosticAnalysisKinds.inc", 131 "clang/Basic/DiagnosticASTKinds.inc", 132 "clang/Basic/DiagnosticCommentKinds.inc", 133 "clang/Basic/DiagnosticCommonKinds.inc", 134 "clang/Basic/DiagnosticDriverKinds.inc", 135 "clang/Basic/DiagnosticFrontendKinds.inc", 136 "clang/Basic/DiagnosticLexKinds.inc", 137 "clang/Basic/DiagnosticParseKinds.inc", 138 "clang/Basic/DiagnosticSemaKinds.inc", 139 "clang/Basic/DiagnosticSerializationKinds.inc", 140 "clang/Basic/DiagnosticGroups.inc", 141 "clang/Basic/DiagnosticIndexName.inc", 142 ], 143} 144 145clang_tblgen { 146 name: "clang-gen-declnodes", 147 in: "include/clang/Basic/DeclNodes.td", 148 outs: ["clang/AST/DeclNodes.inc"], 149} 150 151clang_tblgen { 152 name: "clang-gen-statnodes", 153 in: "include/clang/Basic/StmtNodes.td", 154 outs: ["clang/AST/StmtNodes.inc"], 155} 156 157clang_tblgen { 158 name: "clang-gen-arm-neon", 159 in: "include/clang/Basic/arm_neon.td", 160 outs: [ 161 "clang/Basic/arm_neon.inc", 162 "clang/Basic/arm_neon.h", 163 ], 164} 165 166genrule { 167 name: "clang-version", 168 cmd: "$(location) $(in) > $(out)", 169 tool_files: [ 170 "clang-version-inc.py", 171 "version.py", 172 ], 173 srcs: [ 174 "include/clang/Basic/Version.inc.in", 175 ], 176 out: ["clang/Basic/Version.inc"], 177} 178 179cc_library_shared { 180 name: "libclang", 181 defaults: [ 182 "clang-defaults", 183 "force_build_llvm_components", 184 ], 185 186 host_supported: true, 187 188 whole_static_libs: [ 189 "libclangAnalysis", 190 "libclangAST", 191 "libclangASTMatchers", 192 "libclangBasic", 193 "libclangCodeGen", 194 "libclangDriver", 195 "libclangEdit", 196 "libclangFormat", 197 "libclangFrontend", 198 "libclangIndex", 199 "libclangLex", 200 "libclangLibclang", 201 "libclangParse", 202 "libclangRewrite", 203 "libclangRewriteFrontend", 204 "libclangSema", 205 "libclangSerialization", 206 "libclangTooling", 207 "libclangToolingCore", 208 ], 209 210 export_shared_lib_headers: ["libLLVM"], 211 shared_libs: ["libLLVM"], 212 export_header_lib_headers: ["clang-headers"], 213 214 target: { 215 windows: { 216 host_ldlibs: [ 217 "-limagehlp", 218 "-lpsapi", 219 "-lversion", 220 ], 221 }, 222 darwin: { 223 shared_libs: ["libc++"], 224 225 host_ldlibs: [ 226 "-ldl", 227 "-lpthread", 228 ], 229 }, 230 linux: { 231 shared_libs: ["libc++"], 232 233 host_ldlibs: [ 234 "-ldl", 235 "-lpthread", 236 ], 237 }, 238 }, 239 240 product_variables: { 241 unbundled_build: { 242 // Don't build the library in unbundled branches. 243 enabled: false, 244 }, 245 }, 246} 247 248subdirs = [ 249 "lib", 250 "soong", 251 "utils/TableGen", 252 "tools/clang-check", 253 "tools/clang-format", 254 "tools/driver", 255 "tools/libclang", 256] 257