diff options
author | Brad King <brad.king@kitware.com> | 2014-04-10 15:29:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-04-10 17:40:06 (GMT) |
commit | 159fa06a9323e76e9cc2a67a899cc216f266bf5a (patch) | |
tree | ab39d00efa86518dfa8b37302f379a9382df047d | |
parent | 80d1be2da7aea241318130e4c49aebfe54377e29 (diff) | |
download | CastXML-159fa06a9323e76e9cc2a67a899cc216f266bf5a.zip CastXML-159fa06a9323e76e9cc2a67a899cc216f266bf5a.tar.gz CastXML-159fa06a9323e76e9cc2a67a899cc216f266bf5a.tar.bz2 |
castxml: Register all LLVM target architectures and asm parsers
We need as parsers to support Visual Studio system header files
that contain inline assembly.
-rw-r--r-- | src/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/castxml.cxx | 6 | ||||
-rw-r--r-- | test/CMakeLists.txt | 7 | ||||
-rw-r--r-- | test/expect/gccxml.any.inline-asm-ms.xml.txt | 7 | ||||
-rw-r--r-- | test/input/inline-asm-ms.cxx | 1 |
5 files changed, 27 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e500363..0771859 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,7 +43,12 @@ set(clang_libs clangBasic ) -llvm_map_components_to_libraries(llvm_libs native option bitreader) +llvm_map_components_to_libraries(llvm_libs + native + option + bitreader + ${LLVM_TARGETS_TO_BUILD} + ) add_executable(castxml castxml.cxx diff --git a/src/castxml.cxx b/src/castxml.cxx index cf6fb27..a53c8fe 100644 --- a/src/castxml.cxx +++ b/src/castxml.cxx @@ -23,6 +23,7 @@ #include "llvm/Support/Allocator.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Process.h" +#include "llvm/Support/TargetSelect.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/system_error.h" @@ -44,6 +45,11 @@ int main(int argc_in, const char** argv_in) { suppressInteractiveErrors(); + llvm::InitializeAllTargets(); + llvm::InitializeAllTargetMCs(); + llvm::InitializeAllAsmPrinters(); + llvm::InitializeAllAsmParsers(); + llvm::SmallVector<const char*, 64> argv; llvm::SpecificBumpPtrAllocator<char> argAlloc; if(llvm::error_code e = diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 05ffc70..af36e84 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,6 +33,7 @@ macro(castxml_test_gccxml_common prefix ext std test) -std=${std} ${CMAKE_CURRENT_LIST_DIR}/input/${test}.${ext} -o ${prefix}.${std}.${test}.xml + ${castxml_test_gccxml_extra_arguments} ) add_test( NAME ${prefix}.${std}.${test} @@ -181,6 +182,12 @@ castxml_test_gccxml(using-declaration-start) castxml_test_gccxml(using-directive-ns) castxml_test_gccxml(using-directive-start) +if(";${LLVM_TARGETS_TO_BUILD};" MATCHES ";X86;") + set(castxml_test_gccxml_extra_arguments -target i386-pc-windows-msvc) + castxml_test_gccxml(inline-asm-ms) + unset(castxml_test_gccxml_extra_arguments) +endif() + castxml_test_gccxml_c(FundamentalType) castxml_test_gccxml_c(Typedef-called-class) diff --git a/test/expect/gccxml.any.inline-asm-ms.xml.txt b/test/expect/gccxml.any.inline-asm-ms.xml.txt new file mode 100644 index 0000000..cbf66f7 --- /dev/null +++ b/test/expect/gccxml.any.inline-asm-ms.xml.txt @@ -0,0 +1,7 @@ +^<\?xml version="1.0"\?> +<GCC_XML[^>]*> + <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1"/> + <FundamentalType id="_2" name="void"/> + <Namespace id="_3" name="::"/> + <File id="f1" name=".*/test/input/inline-asm-ms.cxx"/> +</GCC_XML>$ diff --git a/test/input/inline-asm-ms.cxx b/test/input/inline-asm-ms.cxx new file mode 100644 index 0000000..1454d85 --- /dev/null +++ b/test/input/inline-asm-ms.cxx @@ -0,0 +1 @@ +void start() { __asm { int 1 } } |