llvm.org GIT mirror llvm / 576e6bc
Revert 349677, it contained a whole bunch of stuff I did not mean to commit git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349678 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Weber 8 months ago
15 changed file(s) with 19 addition(s) and 424 deletion(s). Raw diff Collapse all Expand all
99
1010 add_llvm_tool(llvm-ar
1111 llvm-ar.cpp
12
13 DEPENDS
14 intrinsics_gen
1215 )
1316
1417 add_llvm_tool_symlink(llvm-ranlib llvm-ar)
44
55 add_llvm_tool(llvm-bcanalyzer
66 llvm-bcanalyzer.cpp
7
8 DEPENDS
9 intrinsics_gen
710 )
1313 #include
1414
1515 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
16 if (Size == 0)
17 return 0;
18
19 bool UseItanium = Data[0] < 128;
20 std::string NullTerminatedString((const char *)Data + 1, Size - 1);
21
22 if (UseItanium) {
23 free(llvm::itaniumDemangle(NullTerminatedString.c_str(), nullptr, nullptr,
24 nullptr));
25 } else {
26 free(llvm::microsoftDemangle(NullTerminatedString.c_str(), nullptr, nullptr,
27 nullptr));
28 }
16 std::string NullTerminatedString((const char *)Data, Size);
17 int status = 0;
18 if (char *demangle = llvm::itaniumDemangle(NullTerminatedString.c_str(), nullptr,
19 nullptr, &status))
20 free(demangle);
2921
3022 return 0;
3123 }
0 group("default") {
11 deps = [
22 ":lld",
3 "//clang/lib/Basic",
43 "//llvm/tools/llc",
54 "//llvm/tools/llvm-ar:symlinks",
65 "//llvm/tools/llvm-as",
+0
-109
utils/gn/secondary/clang/include/clang/Basic/BUILD.gn less more
None import("//clang/utils/TableGen/clang_tablegen.gni")
1 import("//llvm/version.gni")
2
3 # Version header.
4
5 action("version") {
6 script = "//llvm/utils/gn/build/write_cmake_config.py"
7
8 sources = [
9 "Version.inc.in",
10 ]
11 outputs = [
12 "$root_gen_dir/clang/include/clang/Basic/Version.inc",
13 ]
14 args = [
15 "-o",
16 rebase_path(outputs[0], root_out_dir),
17 rebase_path(sources[0], root_out_dir),
18
19 "CLANG_VERSION=$llvm_version",
20 "CLANG_VERSION_MAJOR=$llvm_version_major",
21 "CLANG_VERSION_MINOR=$llvm_version_minor",
22 "CLANG_VERSION_PATCHLEVEL=$llvm_version_patch",
23 ]
24 }
25
26 # Diagnostics.
27
28 diag_groups = [
29 "Analysis",
30 "AST",
31 "Comment",
32 "Common",
33 "CrossTU",
34 "Driver",
35 "Frontend",
36 "Lex",
37 "Parse",
38 "Refactoring",
39 "Sema",
40 "Serialization",
41 ]
42 foreach(diag_group, diag_groups) {
43 clang_tablegen("Diagnostic${diag_group}Kinds") {
44 args = [
45 "-gen-clang-diags-defs",
46 "-clang-component=${diag_group}",
47 ]
48 td_file = "Diagnostic.td"
49 }
50 }
51 group("diags_tablegen") {
52 # DiagnosticGroups and DiagnosticIndexName are intentionally not part of this
53 # group. Much of clang depends on the DiagKinds.inc files transitively,
54 # but almost nothing needs DiagnosticGroups.inc or DiagnosticIndexName.inc.
55 public_deps = []
56 foreach(diag_group, diag_groups) {
57 public_deps += [ ":Diagnostic${diag_group}Kinds" ]
58 }
59 }
60
61 clang_tablegen("DiagnosticGroups") {
62 args = [ "-gen-clang-diag-groups" ]
63 td_file = "Diagnostic.td"
64 }
65
66 clang_tablegen("DiagnosticIndexName") {
67 args = [ "-gen-clang-diags-index-name" ]
68 td_file = "Diagnostic.td"
69 }
70
71 # Attributes
72
73 clang_tablegen("AttrList") {
74 args = [
75 "-gen-clang-attr-list",
76 "-I",
77 rebase_path("../..", root_out_dir),
78 ]
79 td_file = "Attr.td"
80 }
81
82 clang_tablegen("AttrSubMatchRulesList") {
83 args = [
84 "-gen-clang-attr-subject-match-rule-list",
85 "-I",
86 rebase_path("../..", root_out_dir),
87 ]
88 td_file = "Attr.td"
89 }
90
91 clang_tablegen("AttrHasAttributeImpl") {
92 args = [
93 "-gen-clang-attr-has-attribute-impl",
94 "-I",
95 rebase_path("../..", root_out_dir),
96 ]
97 td_file = "Attr.td"
98 }
99
100 # Misc
101
102 clang_tablegen("arm_neon") {
103 args = [ "-gen-arm-neon-sema" ]
104 }
105
106 clang_tablegen("arm_fp16") {
107 args = [ "-gen-arm-neon-sema" ]
108 }
+0
-84
utils/gn/secondary/clang/include/clang/Config/BUILD.gn less more
None import("//clang/lib/ARCMigrate/enable.gni")
1 import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
2 import("//llvm/utils/gn/build/libs/xml/enable.gni")
3 import("//llvm/version.gni")
4
5 config("Config_config") {
6 visibility = [ ":Config" ]
7 include_dirs = [ "$target_gen_dir/clang/include" ]
8 }
9
10 action("Config") {
11 script = "//llvm/utils/gn/build/write_cmake_config.py"
12
13 sources = [
14 "config.h.cmake",
15 ]
16 outputs = [
17 "$target_gen_dir/config.h",
18 ]
19 args = [
20 "-o",
21 rebase_path(outputs[0], root_out_dir),
22 rebase_path(sources[0], root_out_dir),
23
24 "BUG_REPORT_URL=https://bugs.llvm.org/",
25 "CLANG_DEFAULT_LINKER=",
26 "CLANG_DEFAULT_STD_C=",
27 "CLANG_DEFAULT_STD_CXX=",
28 "CLANG_DEFAULT_CXX_STDLIB=",
29 "CLANG_DEFAULT_RTLIB=",
30 "CLANG_DEFAULT_OBJCOPY=objcopy",
31 "CLANG_DEFAULT_OPENMP_RUNTIME=libomp",
32 "CLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_35",
33 "CLANG_LIBDIR_SUFFIX=",
34 "CLANG_RESOURCE_DIR=",
35 "C_INCLUDE_DIRS=",
36 "CLANG_CONFIG_FILE_SYSTEM_DIR=",
37 "CLANG_CONFIG_FILE_USER_DIR=",
38 "DEFAULT_SYSROOT=",
39 "GCC_INSTALL_PREFIX=",
40 "CLANG_ANALYZER_WITH_Z3=",
41 "BACKEND_PACKAGE_STRING=LLVM ${llvm_version}svn",
42 "ENABLE_LINKER_BUILD_ID=",
43 "ENABLE_X86_RELAX_RELOCATIONS=",
44 "ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=",
45 "CLANG_ENABLE_OBJC_REWRITER=1", # FIXME: flag?
46 ]
47
48 if (clang_enable_arcmt) {
49 args += [ "CLANG_ENABLE_ARCMT=1" ]
50 } else {
51 args += [ "CLANG_ENABLE_ARCMT=" ]
52 }
53
54 if (clang_enable_static_analyzer) {
55 args += [ "CLANG_ENABLE_STATIC_ANALYZER=1" ]
56 } else {
57 args += [ "CLANG_ENABLE_STATIC_ANALYZER=" ]
58 }
59
60 if (host_os != "win") {
61 args += [ "CLANG_HAVE_RLIMITS=1" ]
62 } else {
63 args += [ "CLANG_HAVE_RLIMITS=" ]
64 }
65
66 if (llvm_enable_libxml2) {
67 args += [ "CLANG_HAVE_LIBXML=1" ]
68 } else {
69 args += [ "CLANG_HAVE_LIBXML=" ]
70 }
71
72 if (host_os == "mac") {
73 # FIXME: Hardcoding this isn't great, but assuming that the host ld version
74 # has anything to do with the ld version where the built clang will run
75 # isn't either. Probably want to make this a declare_args.
76 args += [ "HOST_LINK_VERSION=305" ]
77 } else {
78 args += [ "HOST_LINK_VERSION=" ]
79 }
80
81 # Let targets depending on this find the generated file.
82 public_configs = [ ":Config_config" ]
83 }
+0
-4
utils/gn/secondary/clang/lib/ARCMigrate/enable.gni less more
None declare_args() {
1 # Whether to include the arc migrate tool in the clang binary.
2 clang_enable_arcmt = true
3 }
+0
-82
utils/gn/secondary/clang/lib/Basic/BUILD.gn less more
None static_library("Basic") {
1 output_name = "clangBasic"
2 configs += [ "//llvm/utils/gn/build:clang_code" ]
3 public_deps = [
4 # public_dep because public header Version.h includes generated Version.inc.
5 "//clang/include/clang/Basic:AttrList",
6 "//clang/include/clang/Basic:AttrSubMatchRulesList",
7 "//clang/include/clang/Basic:DiagnosticGroups",
8 "//clang/include/clang/Basic:diags_tablegen",
9 "//clang/include/clang/Basic:version",
10 ]
11 deps = [
12 "//clang/include/clang/Basic:AttrHasAttributeImpl",
13 "//clang/include/clang/Basic:arm_fp16",
14 "//clang/include/clang/Basic:arm_neon",
15 "//clang/include/clang/Config",
16 "//llvm/include/llvm/Config:llvm-config",
17 "//llvm/lib/IR",
18 "//llvm/lib/MC",
19 "//llvm/lib/Support",
20 ]
21 include_dirs = [ "." ]
22 sources = [
23 "Attributes.cpp",
24 "Builtins.cpp",
25 "CharInfo.cpp",
26 "CodeGenOptions.cpp",
27 "Cuda.cpp",
28 "Diagnostic.cpp",
29 "DiagnosticIDs.cpp",
30 "DiagnosticOptions.cpp",
31 "FileManager.cpp",
32 "FileSystemStatCache.cpp",
33 "FixedPoint.cpp",
34 "IdentifierTable.cpp",
35 "LangOptions.cpp",
36 "MemoryBufferCache.cpp",
37 "Module.cpp",
38 "ObjCRuntime.cpp",
39 "OpenMPKinds.cpp",
40 "OperatorPrecedence.cpp",
41 "SanitizerBlacklist.cpp",
42 "SanitizerSpecialCaseList.cpp",
43 "Sanitizers.cpp",
44 "SourceLocation.cpp",
45 "SourceManager.cpp",
46 "TargetInfo.cpp",
47 "Targets.cpp",
48 "Targets/AArch64.cpp",
49 "Targets/AMDGPU.cpp",
50 "Targets/ARC.cpp",
51 "Targets/ARM.cpp",
52 "Targets/AVR.cpp",
53 "Targets/BPF.cpp",
54 "Targets/Hexagon.cpp",
55 "Targets/Lanai.cpp",
56 "Targets/Le64.cpp",
57 "Targets/MSP430.cpp",
58 "Targets/Mips.cpp",
59 "Targets/NVPTX.cpp",
60 "Targets/Nios2.cpp",
61 "Targets/OSTargets.cpp",
62 "Targets/PNaCl.cpp",
63 "Targets/PPC.cpp",
64 "Targets/RISCV.cpp",
65 "Targets/SPIR.cpp",
66 "Targets/Sparc.cpp",
67 "Targets/SystemZ.cpp",
68 "Targets/TCE.cpp",
69 "Targets/WebAssembly.cpp",
70 "Targets/X86.cpp",
71 "Targets/XCore.cpp",
72 "TokenKinds.cpp",
73
74 # FIXME: This should be in its own target that passes -DHAVE_SVN_VERSION_INC
75 # and that also depends on a target generating SVNVersion.inc.
76 "Version.cpp",
77 "Warnings.cpp",
78 "XRayInstr.cpp",
79 "XRayLists.cpp",
80 ]
81 }
+0
-4
utils/gn/secondary/clang/lib/StaticAnalyzer/Frontend/enable.gni less more
None declare_args() {
1 # Whether to include the static analyzer in the clang binary.
2 clang_enable_static_analyzer = true
3 }
+0
-19
utils/gn/secondary/clang/utils/TableGen/BUILD.gn less more
None executable("clang-tblgen") {
1 deps = [
2 "//llvm/lib/Support",
3 "//llvm/lib/TableGen",
4 ]
5 sources = [
6 "ClangASTNodesEmitter.cpp",
7 "ClangAttrEmitter.cpp",
8 "ClangCommentCommandInfoEmitter.cpp",
9 "ClangCommentHTMLNamedCharacterReferenceEmitter.cpp",
10 "ClangCommentHTMLTagsEmitter.cpp",
11 "ClangDataCollectorsEmitter.cpp",
12 "ClangDiagnosticsEmitter.cpp",
13 "ClangOptionDocEmitter.cpp",
14 "ClangSACheckersEmitter.cpp",
15 "NeonEmitter.cpp",
16 "TableGen.cpp",
17 ]
18 }
+0
-41
utils/gn/secondary/clang/utils/TableGen/clang_tablegen.gni less more
None # This file introduces a templates for running clang-tblgen.
1 #
2 # Parameters:
3 #
4 # args (required)
5 # [list of strings] Flags to pass to llvm-tblgen.
6 #
7 # output_name (optional)
8 # Basename of the generated output file.
9 # Defaults to target name with ".inc" appended.
10 #
11 # td_file (optional)
12 # The .td file to pass to llvm-tblgen.
13 # Defaults to target name with ".td" appended.
14 #
15 # visibility (optional)
16 # GN's regular visibility attribute, see `gn help visibility`.
17 #
18 # Example of usage:
19 #
20 # clang_tablegen("DiagnosticGroups") {
21 # args = [ "-gen-clang-diag-groups" ]
22 # td_file = "Diagnostic.td"
23 # }
24
25 import("//llvm/utils/TableGen/tablegen.gni")
26
27 template("clang_tablegen") {
28 tablegen(target_name) {
29 forward_variables_from(invoker,
30 [
31 "args",
32 "output_name",
33 "td_file",
34 "visibility",
35 ])
36
37 # FIXME: In cross builds, this should depend on the host binary.
38 tblgen_target = "//clang/utils/TableGen:clang-tblgen"
39 }
40 }
1111 args = [
1212 "-o",
1313 rebase_path(outputs[0], root_out_dir),
14
1415 rebase_path(sources[0], root_out_dir),
1516
1617 "LLD_VERSION=$llvm_version",
3535 action(target_name) {
3636 forward_variables_from(invoker, [ "visibility" ])
3737
38 if (defined(invoker.tblgen_target)) {
39 tblgen_target = invoker.tblgen_target
40 } else {
41 # FIXME: In cross builds, this should depend on the host binary.
42 tblgen_target = "//llvm/utils/TableGen:llvm-tblgen"
43 }
38 # FIXME: In cross builds, this should depend on the host binary.
39 tblgen_target = "//llvm/utils/TableGen:llvm-tblgen"
4440 tblgen_executable = get_label_info(tblgen_target, "root_out_dir") +
4541 "/bin/" + get_label_info(tblgen_target, "name")
4642 deps = [
11071107 else:
11081108 if bashPath:
11091109 command = [bashPath, script]
1110 #print command, cwd, test.config.environment
11111110 else:
11121111 command = ['/bin/sh', script]
11131112 if litConfig.useValgrind:
15511550 return lit.Test.Result(status, output)
15521551
15531552
1554 def extractScript(test, litConfig, useExternalSh, extra_substitutions):
1553 def executeShTest(test, litConfig, useExternalSh,
1554 extra_substitutions=[]):
15551555 if test.config.unsupported:
1556 return lit.Test.Result(Test.UNSUPPORTED, 'Test is unsupported'), ''
1556 return lit.Test.Result(Test.UNSUPPORTED, 'Test is unsupported')
15571557
15581558 script = parseIntegratedTestScript(test)
15591559 if isinstance(script, lit.Test.Result):
1560 return script, ''
1560 return script
15611561 if litConfig.noExecute:
1562 return lit.Test.Result(Test.PASS), ''
1562 return lit.Test.Result(Test.PASS)
15631563
15641564 tmpDir, tmpBase = getTempPaths(test)
15651565 substitutions = list(extra_substitutions)
15661566 substitutions += getDefaultSubstitutions(test, tmpDir, tmpBase,
15671567 normalize_slashes=useExternalSh)
15681568 script = applySubstitutions(script, substitutions)
1569 return script, tmpBase
1570
1571
1572 def executeShTest(test, litConfig, useExternalSh,
1573 extra_substitutions=[]):
1574 script, tmpBase = extractScript(
1575 test, litConfig, useExternalSh, extra_substitutions)
1576 if isinstance(script, lit.Test.Result):
1577 return script
15781569
15791570 # Re-run failed tests up to test_retry_attempts times.
15801571 attempts = 1
5353 def execute_test(self, test):
5454 return _execute_test_impl(test, self.lit_config,
5555 self.parallelism_semaphores)
56
57 def execute_tests_using_ninja(self, jobs, max_time):
58 import lit.TestRunner
59 import pipes
60 sys.path.append('/Users/thakis/src/ninja/misc')
61 import ninja_syntax
62 writer = ninja_syntax.Writer(open('lit.ninja', 'w'))
63 # Writes a build.ninja with commands for all tests and runs ninja
64 # to execute them.
65 for i, test in enumerate(self.tests):
66 if not isinstance(test.config.test_format, lit.formats.ShTest):
67 test.setResult(lit.Test.Result(lit.Test.PASS, '')) # FIXME
68 continue
69 script, tmpBase = lit.TestRunner.extractScript(
70 test, self.lit_config, True, [])
71 if isinstance(script, lit.Test.Result):
72 test.result = script
73 continue
74
75 # Create the output directory if it does not already exist.
76 lit.util.mkdir_p(os.path.dirname(tmpBase))
77
78 r = 'r%04d' % i
79 # FIXME: duplication with TestRunner.executeScript()
80 # FIXME: windows
81 execdir = os.path.dirname(test.getExecPath())
82 command = ''
83 for var, val in test.config.environment.iteritems():
84 # Need export, else LLD_VERSION doesn't make it through.
85 # The export means LIT_PRESERVES_TMP=1 needs to be set while
86 # running lit, else it's gone by the time ninja runs
87 # (...or this here must run ninja, probably better anyhoo)
88 command += 'export %s=%s; ' % (var, pipes.quote(val))
89 if test.config.pipefail:
90 command += 'set -o pipefail; '
91 command += 'cd %s; { ' % execdir
92 command += '; } && { '.join(script) + '; }'
93
94 # FIXME: tests require bash for e.g. `echo -e` -- unfortunate :-/
95 command = '/bin/bash -c %s' % pipes.quote(command)
96
97 writer.rule(r, command, description=test.getFullName())
98 writer.build('always%04d' % i, r)
99
100 # FIXME: ...well...
101 test.setResult(lit.Test.Result(lit.Test.PASS, ''))
10256
10357 def execute_tests_in_pool(self, jobs, max_time):
10458 # We need to issue many wait calls, so compute the final deadline and
195149 self.consume_test_result(result)
196150 else:
197151 self.execute_tests_in_pool(jobs, max_time)
198 #self.execute_tests_using_ninja(jobs, max_time)
199152
200153 # Mark any tests that weren't run as UNRESOLVED.
201154 for test in self.tests: