f62b8b3b3f
MozReview-Commit-ID: IN2hMCjMHLL --HG-- rename : browser/components/extensions/test/browser/browser_ext_url_overrides.js => browser/components/extensions/test/browser/browser_ext_url_overrides_newtab.js rename : browser/extensions/formautofill/content/FormAutofillContent.js => browser/extensions/formautofill/FormAutofillContent.jsm rename : browser/extensions/formautofill/content/FormAutofillContent.js => browser/extensions/formautofill/FormAutofillHandler.jsm rename : browser/extensions/formautofill/content/FormAutofillContent.js => browser/extensions/formautofill/FormAutofillHeuristics.jsm rename : browser/extensions/formautofill/content/FormAutofillContent.js => browser/extensions/formautofill/content/FormAutofillFrameScript.js rename : browser/themes/shared/devedition/urlbar-history-dropmarker.svg => browser/themes/shared/compacttheme/urlbar-history-dropmarker.svg rename : config/tests/makefiles/autodeps/check_mkdir.tpy => config/tests/makefiles/autodeps/check_mkdir.py rename : dom/bindings/MozMap.h => dom/bindings/Record.h rename : dom/bindings/parser/tests/test_mozmap.py => dom/bindings/parser/tests/test_record.py rename : dom/file/File.cpp => dom/file/BaseBlobImpl.cpp rename : dom/file/File.h => dom/file/BaseBlobImpl.h rename : dom/file/File.cpp => dom/file/Blob.cpp rename : dom/file/File.h => dom/file/Blob.h rename : dom/file/File.cpp => dom/file/BlobImpl.cpp rename : dom/file/File.h => dom/file/BlobImpl.h rename : dom/file/File.cpp => dom/file/EmptyBlobImpl.cpp rename : dom/file/File.h => dom/file/EmptyBlobImpl.h rename : dom/file/File.cpp => dom/file/FileBlobImpl.cpp rename : dom/file/File.h => dom/file/FileBlobImpl.h rename : dom/file/File.cpp => dom/file/MemoryBlobImpl.cpp rename : dom/file/File.h => dom/file/MemoryBlobImpl.h rename : dom/file/File.cpp => dom/file/StreamBlobImpl.cpp rename : dom/file/File.h => dom/file/StreamBlobImpl.h rename : dom/file/File.h => dom/file/StringBlobImpl.h rename : dom/file/File.h => dom/file/TemporaryBlobImpl.h rename : dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.cpp => dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp rename : dom/media/platforms/agnostic/gmp/MediaDataDecoderProxy.h => dom/media/platforms/wrappers/MediaDataDecoderProxy.h rename : dom/tests/mochitest/general/test_interfaces.html => dom/tests/mochitest/general/test_interfaces.js rename : dom/workers/test/test_navigator.html => dom/workers/test/test_navigator.js rename : js/src/jsautokw.py => js/src/frontend/GenerateReservedWords.py rename : js/src/vm/Keywords.h => js/src/frontend/ReservedWords.h rename : layout/base/RestyleManager.cpp => layout/base/GeckoRestyleManager.cpp rename : layout/base/RestyleManager.h => layout/base/GeckoRestyleManager.h rename : layout/reftests/w3c-css/submitted/ui3/box-sizing-replaced-002-ref.xht => layout/reftests/bugs/1313772-ref.xhtml rename : layout/reftests/w3c-css/submitted/ui3/box-sizing-replaced-002.xht => layout/reftests/bugs/1313772.xhtml rename : servo/components/jstraceable_derive/Cargo.toml => servo/components/deny_public_fields/Cargo.toml rename : servo/components/jstraceable_derive/Cargo.toml => servo/components/domobject_derive/Cargo.toml rename : servo/components/plugins/lints/ban.rs => servo/components/script_plugins/ban.rs rename : servo/components/plugins/jstraceable.rs => servo/components/script_plugins/jstraceable.rs rename : servo/components/plugins/lib.rs => servo/components/script_plugins/lib.rs rename : servo/components/plugins/lints/unrooted_must_root.rs => servo/components/script_plugins/unrooted_must_root.rs rename : servo/components/plugins/utils.rs => servo/components/script_plugins/utils.rs rename : testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_autocomplete.html => testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_autocomplete-manual.html rename : testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_list.html => testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_list-manual.html rename : testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_valueasdate.html => testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_valueasdate-manual.html rename : testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_valueasnumber.html => testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/input_valueasnumber-manual.html rename : testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/select_length.html => testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/select_length-manual.html rename : testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/select_selectedindex.html => testing/web-platform/tests/old-tests/submission/Infraware/Forms/contents/Forms/Not_Use/select_selectedindex-manual.html rename : testing/web-platform/tests/preload/link_header_preload_delay_onload.html.headers => testing/web-platform/tests/preload/link-header-preload-delay-onload.html.headers rename : testing/web-platform/tests/preload/link_header_preload.html.headers => testing/web-platform/tests/preload/link-header-preload.html.headers rename : services/sync/tests/unit/test_extension_storage_crypto.js => toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_crypto.js rename : toolkit/components/telemetry/TelemetryComms.h => toolkit/components/telemetry/ipc/TelemetryComms.h rename : toolkit/components/telemetry/TelemetryIPCAccumulator.cpp => toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.cpp rename : toolkit/components/telemetry/TelemetryIPCAccumulator.h => toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.h extra : amend_source : 7411c39541f0b530b4b94cf359dc73e385abea4d |
||
---|---|---|
.. | ||
ci | ||
src | ||
tests | ||
.cargo-checksum.json | ||
.cargo-ok | ||
.gitignore | ||
.travis.yml | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
Cargo.toml | ||
LICENSE.txt | ||
README.md | ||
appveyor.yml | ||
build.rs | ||
clippy.toml |
README.md
clang-sys
Rust bindings for libclang
.
If you are interested in a Rust wrapper for these bindings, see clang-rs.
Supported on the stable, beta, and nightly Rust channels.
Released under the Apache License 2.0.
Supported Versions
To target a version of libclang
, enable one of the following Cargo features:
clang_3_5
- requireslibclang
3.5 or later (Documentation)clang_3_6
- requireslibclang
3.6 or later (Documentation)clang_3_7
- requireslibclang
3.7 or later (Documentation)clang_3_8
- requireslibclang
3.8 or later (Documentation)clang_3_9
- requireslibclang
3.9 or later (Documentation)
If you do not enable one of these features, the API provided by libclang
3.5 will be available by
default.
Dependencies
By default, this crate will attempt to link to libclang
dynamically. In this case, this crate
depends on the libclang
shared library (libclang.so
on Linux, libclang.dylib
on OS X,
libclang.dll
on Windows). If you want to link to libclang
statically instead, enable the
static
Cargo feature. In this case, this crate depends on the LLVM and Clang static libraries. If
you don't want to link to libclang
at compiletime but instead want to load it at runtime, enable
the runtime
Cargo feature.
These libraries can be either be installed as a part of Clang or downloaded here.
Note: Installing libclang
through a package manager might install the libclang
shared
library as something like libclang.so.1
instead of libclang.so
. In this case, you need to make a
symbolic link from the versioned shared library to libclang.so
.
Note: The downloads for LLVM and Clang 3.8 and later do not include the libclang.a
static
library. This means you cannot link to any of these versions of libclang
statically unless you
build it from source.
Environment Variables
The following environment variables, if set, are used by this crate to find the required libraries and executables:
LLVM_CONFIG_PATH
(compile time) - provides a path to anllvm-config
executableLIBCLANG_PATH
(compile time) - provides a path to a directory containing alibclang
shared libraryLIBCLANG_STATIC_PATH
(compile time) - provides a path to a directory containing LLVM and Clang static librariesCLANG_PATH
(run time) - provides a path to aclang
executable
Linking
Dynamic
First, the libclang
shared library will be searched for in the directory provided by the
LIBCLANG_PATH
environment variable if it was set. If this fails, the directory returned by
llvm-config --libdir
will be searched. If neither of these approaches is successful, a list of
likely directories will be searched (e.g., /usr/local/lib
on Linux).
On Linux, running an executable that has been dynamically linked to libclang
may require you to
add a path to libclang.so
to the LD_LIBRARY_PATH
environment variable. The same is true on OS
X, except the DYLD_LIBRARY_PATH
environment variable is used instead.
On Windows, running an executable that has been dynamically linked to libclang
requires that
libclang.dll
can be found by the executable at runtime. See
here for more information.
Static
The availability of llvm-config
is not optional for static linking. Ensure that an instance of
this executable can be found on your system's path or set the LLVM_CONFIG_PATH
environment
variable. The required LLVM and Clang static libraries will be searched for in the same way as the
shared library is searched for, except the LIBCLANG_STATIC_PATH
environment variable is used in
place of the LIBCLANG_PATH
environment variable.
Runtime
The clang_sys::load
function is used to load a libclang
shared library for use in the thread in
which it is called. The clang_sys::unload
function will unload the libclang
shared library.
clang_sys::load
searches for a libclang
shared library in the same way one is searched for when
linking to libclang
dynamically at compiletime.