Skip to content

Allows the user to specify a specific clang version #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: release-1.11
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package-lock = false
save = false
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ python:
- "2.7"

before_install:
- curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq
- sudo apt-get install -y libclang1-3.4
- sudo apt-get install -y libclang1-4.0

install:
- (cd cldoc-static && npm install)
Expand Down
5 changes: 2 additions & 3 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ do not have `make` available, then use:

```
npm install
gem install --user-install -b gems -n gems/.bin --no-ri --no-rdoc sass
```

## Generating the frontend
Expand All @@ -22,7 +21,7 @@ have been modified. To generate the frontend, use `make generate` to run `setup.
the correct paths to the installed dependencies. Again, if you do not have `make` available, use:

```
python setup.py generate --coffee=node_modules/.bin/coffee --inline=scripts/inline --sass=gems/.bin/sass
python setup.py generate --coffee=node_modules/.bin/coffee --inline=scripts/inline --sass=node_modules/.bin/node-sass
```

## Developing without installing
Expand All @@ -38,4 +37,4 @@ called `dev` is provided to run coffee and sass, without running `inline`.

# Run local cldoc
scripts/cldoc-dev [command] [OPTIONS] [FILES...]
```
```
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PYTHON = python
SETUP = $(PYTHON) setup.py
COFFEE = node_modules/.bin/coffee
INLINE_SOURCE = node_modules/inline-source
SASS = gems/.bin/sass
SASS = node_modules/.bin/node-sass
UNAME = $(shell uname)

ifeq ($(UNAME),Darwin)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ non-intrusive and robust approach.

For more information, please visit http://jessevdk.github.com/cldoc.

# Requirements

cldoc requires clang 3.9 or later to be installed on the system.

# Get started now!
To get started using cldoc, please have a look at
[Getting started](http://jessevdk.github.com/cldoc/gettingstarted.html) to install cldoc. Then explore how
Expand Down
3 changes: 2 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ python setup.py sdist upload

## Release static site generator to npm
```bash
cd cldoc-static
npm publish
```

## Push to remote
```bash
git push --tags master:master
```
```
25 changes: 15 additions & 10 deletions cldoc-static/lib/cldoc-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ function run(htmldir, outdir) {

var xmldoc = (new xmldom.DOMParser()).parseFromString(x);

var doc = jsdom.jsdom(indexhtml, {
features: {
FetchExternalResources: ['script'],
ProcessExternalResources: ["script"],
},
var virtualConsole = new jsdom.VirtualConsole();

var dom = new jsdom.JSDOM(indexhtml, {
runScripts: "dangerously",
virtualConsole: virtualConsole
});

var doc = dom.window.document;

if (doc.errors) {
for (var e = 0; e < doc.errors.length; e++) {
console.error(doc.errors[e].message);
Expand All @@ -47,7 +49,7 @@ function run(htmldir, outdir) {
process.exit(1);
}

var window = doc.defaultView;
var window = dom.window;
var $ = window.jQuery;

var cldoc = window.cldoc;
Expand Down Expand Up @@ -117,9 +119,12 @@ function run(htmldir, outdir) {
$('head').append(link);

// Write resulting html to <name>.html
fs.writeFileSync(path.join(outdir, name + '.html'), html(jsdom.serializeDocument(doc), {
max_preserve_newlines: 1
}));
var serialized = html(dom.serialize(), {
max_preserve_newlines: 1,
end_with_newline: true
});

fs.writeFileSync(path.join(outdir, name + '.html'), serialized);
}

// Write css to styles/cldoc.css
Expand All @@ -134,4 +139,4 @@ function run(htmldir, outdir) {

module.exports = {
run: run
};
};
6 changes: 3 additions & 3 deletions cldoc-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
},
"homepage": "https://github.com/jessevdk/cldoc#readme",
"dependencies": {
"js-beautify": "^1.5.10",
"jsdom": "^3.1.2",
"xmldom": "^0.1.19"
"js-beautify": "^1.7.5",
"jsdom": "^11.7.0",
"xmldom": "^0.1.27"
}
}
122 changes: 110 additions & 12 deletions cldoc/clang/cindex-updates.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/cldoc/clang/cindex.py b/cldoc/clang/cindex.py
index b53661a..114d483 100644
index b53661a..e58a2dd 100644
--- a/cldoc/clang/cindex.py
+++ b/cldoc/clang/cindex.py
@@ -1,3 +1,15 @@
Expand Down Expand Up @@ -41,7 +41,7 @@ index b53661a..114d483 100644
@property
def disable_option(self):
"""The command-line option that disables this diagnostic."""
@@ -1479,12 +1498,6 @@ class Cursor(Structure):
@@ -1479,17 +1498,6 @@ class Cursor(Structure):
"""
return conf.lib.clang_CXXMethod_isVirtual(self)

Expand All @@ -51,10 +51,49 @@ index b53661a..114d483 100644
- """
- return conf.lib.clang_CXXRecord_isAbstract(self)
-
def is_scoped_enum(self):
"""Returns True if the cursor refers to a scoped enum declaration.
- def is_scoped_enum(self):
- """Returns True if the cursor refers to a scoped enum declaration.
- """
- return conf.lib.clang_EnumDecl_isScoped(self)
-
def get_definition(self):
"""
If the cursor is a reference to a declaration or a declaration of
@@ -1565,14 +1573,6 @@ class Cursor(Structure):

return LinkageKind.from_id(self._linkage)

- @property
- def tls_kind(self):
- """Return the thread-local storage (TLS) kind of this cursor."""
- if not hasattr(self, '_tls_kind'):
- self._tls_kind = conf.lib.clang_getCursorTLSKind(self)
-
- return TLSKind.from_id(self._tls_kind)
-
@property
def extent(self):
"""
@@ -1729,6 +1742,9 @@ class Cursor(Structure):
@@ -1648,18 +1648,6 @@ class Cursor(Structure):

return self._result_type

- @property
- def exception_specification_kind(self):
- '''
- Retrieve the exception specification kind, which is one of the values
- from the ExceptionSpecificationKind enumeration.
- '''
- if not hasattr(self, '_exception_specification_kind'):
- exc_kind = conf.lib.clang_getCursorExceptionSpecificationType(self)
- self._exception_specification_kind = ExceptionSpecificationKind.from_id(exc_kind)
-
- return self._exception_specification_kind
-
@property
def underlying_typedef_type(self):
"""Return the underlying type of a typedef declaration.
@@ -1729,6 +1717,9 @@ class Cursor(Structure):

return self._hash

Expand All @@ -64,7 +103,7 @@ index b53661a..114d483 100644
@property
def semantic_parent(self):
"""Return the semantic parent for this cursor."""
@@ -1860,6 +1876,20 @@ class Cursor(Structure):
@@ -1860,6 +1851,20 @@ class Cursor(Structure):
"""
return conf.lib.clang_getFieldDeclBitWidth(self)

Expand All @@ -85,18 +124,49 @@ index b53661a..114d483 100644
@staticmethod
def from_result(res, fn, args):
assert isinstance(res, Cursor)
@@ -3407,10 +3437,6 @@ functionList = [
@@ -2161,6 +2166,13 @@ class Type(Structure):
"""Return the kind of this type."""
return TypeKind.from_id(self._kind_id)

+ def get_num_template_arguments(self):
+ return conf.lib.clang_Type_getNumTemplateArguments(self)
+
+ def get_template_argument_type(self, num):
+ """Returns the CXType for the indicated template argument."""
+ return conf.lib.clang_Type_getTemplateArgumentAsType(self, num)
+
def argument_types(self):
"""Retrieve a container for the non-variadic arguments for this type.

@@ -2290,12 +2302,6 @@ class Type(Structure):

return conf.lib.clang_isFunctionTypeVariadic(self)

- def get_address_space(self):
- return conf.lib.clang_getAddressSpace(self)
-
- def get_typedef_name(self):
- return conf.lib.clang_getTypedefName(self)
-
def is_pod(self):
"""Determine whether this Type represents plain old data (POD)."""
return conf.lib.clang_isPODType(self)
@@ -3407,14 +3413,6 @@ functionList = [
[Cursor],
bool),

- ("clang_CXXRecord_isAbstract",
- [Cursor],
- bool),
-
("clang_EnumDecl_isScoped",
[Cursor],
bool),
@@ -3432,6 +3458,15 @@ functionList = [
- ("clang_EnumDecl_isScoped",
- [Cursor],
- bool),
-
("clang_defaultDiagnosticDisplayOptions",
[],
c_uint),
@@ -3432,6 +3430,15 @@ functionList = [
("clang_disposeDiagnostic",
[Diagnostic]),

Expand All @@ -112,7 +182,35 @@ index b53661a..114d483 100644
("clang_disposeIndex",
[Index]),

@@ -4144,7 +4179,7 @@ class Config:
@@ -3820,11 +3827,6 @@ functionList = [
Type,
Type.from_result),

- ("clang_getTypedefName",
- [Type],
- _CXString,
- _CXString.from_result),
-
("clang_getTypeKindSpelling",
[c_uint],
_CXString,
@@ -3978,6 +3980,15 @@ functionList = [
[Cursor],
c_longlong),

+ ("clang_Type_getNumTemplateArguments",
+ [Type],
+ c_int),
+
+ ("clang_Type_getTemplateArgumentAsType",
+ [Type, c_uint],
+ Type,
+ Type.from_result),
+
("clang_Type_getAlignOf",
[Type],
c_longlong),
@@ -4144,7 +4155,7 @@ class Config:
return True

def register_enumerations():
Expand Down
Loading