Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Eidsness2014-04-07 12:42:38 +0000
committerAndrew Eidsness2014-04-28 13:15:57 +0000
commit60e7d2e0a8b8d686e00296f19e5e660ceb80f0ee (patch)
tree76a7e63ed8804c78cdf34cbf90cf2a8268b00e56 /extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
parent736db7e86c838a6a162b77b2c69b5a5a6a221029 (diff)
downloadorg.eclipse.papyrus-60e7d2e0a8b8d686e00296f19e5e660ceb80f0ee.tar.gz
org.eclipse.papyrus-60e7d2e0a8b8d686e00296f19e5e660ceb80f0ee.tar.xz
org.eclipse.papyrus-60e7d2e0a8b8d686e00296f19e5e660ceb80f0ee.zip
Bug 425215: Duplicate #include directives
When class uses more than one type from the AnsiCLibrary package, multiple, identical #include directives are generated. I've created a utility rule to generate #include directives. The parameter to the rule is a string containing the path of the file to be included. The rule also fixes a problem where #include's were specifying system includes (angle-bracket strings) instead of user includes (quoted strings). Include directives are now generated in two steps. In the first step, all dependencies are examined to create an ordered set of strings with the include paths. In the second step the new utility rule is used to generate the directive. Change-Id: I11b784f1def4875ecf2c40cae7c3995d7666ef48 Signed-off-by: Andrew Eidsness <eclipse@jfront.com>
Diffstat (limited to 'extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl12
1 files changed, 8 insertions, 4 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
index 1f50d6b5763..007a48b1f47 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
@@ -15,15 +15,19 @@
[class.name/] template binding header
************************************************************/
-[_package.CppOwnerPackageIncludeDeclaration()/]
-
-[CppClassAllIncludesDeclaration()/]
+[for (path : String |
+ Sequence{ _package.cppOwnerPackageIncludePath() }
+ ->addAll( CppClassAllIncludes() )
+ ->flatten()
+ ->asOrderedSet())]
+[path.IncludeDirective()/]
+[/for]
[CppIncludeHeader()/]
[let tb : TemplateBinding = getTemplateBindings()]
[let templateElement : Element = tb.target->asSequence()->first()]
-#include <[_package.getFullPath()/]/[templateElement.owner.oclAsType(NamedElement).name/].[getHeaderSuffix()/]>
+[IncludeDirective( _package.getFullPath() + '/' + templateElement.owner.oclAsType(NamedElement).name + '.' + getHeaderSuffix() )/]
[openNS()/]
/************************************************************/

Back to the top