summaryrefslogtreecommitdiff
path: root/src/ir/function.rs
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2017-07-06 12:23:56 +1200
committerDylan McKay <me@dylanmckay.io>2017-07-08 11:38:23 +1200
commit239a0154cdab5fa0052f2ce98129e2c169dc1cc4 (patch)
treeb52435287980d77af247fc49b0a3f34dd5bb72ed /src/ir/function.rs
parent3bb248ba247c2b8b3433c03102276b925b5025d0 (diff)
Intelligently convert C/C++ comments to Rust
With this change, we can correctly parse C++ block comments. ``` /** * Does a thing * * More documentation. This test does something * useful. */ ``` into ``` /// Does a thing /// /// More documentation. This test does something /// useful. ``` Fixes servo/rust-bindgen#426.
Diffstat (limited to 'src/ir/function.rs')
-rw-r--r--src/ir/function.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index 9865997d..299bd65c 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -1,5 +1,6 @@
//! Intermediate representation for C/C++ functions and methods.
+use super::comment;
use super::context::{BindgenContext, ItemId};
use super::dot::DotAttributes;
use super::item::Item;
@@ -405,7 +406,7 @@ impl ClangSubItemParser for Function {
mangled_name = None;
}
- let comment = cursor.raw_comment();
+ let comment = cursor.raw_comment().map(comment::preprocess);
let function = Self::new(name, mangled_name, sig, comment);
Ok(ParseResult::New(function, Some(cursor)))