CLITypePrinter outputs C++ code, so the proper type to be written for
Long and ULong are "long" and "unsigned long", not "int" and "unsigned
int".
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
The enum PrimitiveType represents, according to the comment, "the C++
built-in types.". However, it does not contain values for C++'s "long"
or "unsigned long", and the parser converts long to int. This is not
correct, and is a problem with 64bit support.
This patch adds Long and ULong values to PrimitiveType, and adds those
to all the switch-cases all around the code. For now Long and ULong are
handled exactly like Int and UInt, so this patch does not change
behavior.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
C++ types cannot be converted to C# types without knowing details of the
target (e.g. what is the size of "long") and
PrimitiveTypeExtensions.ConvertToType does not handle that correctly.
However, ConvertToType is not used anywhere, so let's just remove it so
that no one will use the method.
We could also fix the method, but it's an extension method for
PrimitiveType, and I don't think such an extension method should be used
for the task, as you would also need to pass it information about the
target system.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Now that the warnings have been fixed, we no longer need -fpermissive to
compile CppParser with gcc.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Fix the following warning by renaming ParserResult::Parser to
CodeParser.
In file included from ../../../src/CppParser/Parser.h:16:0,
from ../../../src/CppParser/Comments.cpp:8:
../../../src/CppParser/CppParser.h:86:13: warning: declaration of ‘CppSharp::CppParser::Parser* CppSharp::CppParser::ParserResult::Parser’ [-fpermissive]
Parser* Parser;
^
../../../src/CppParser/CppParser.h:73:8: warning: changes meaning of ‘Parser’ from ‘struct CppSharp::CppParser::Parser’ [-fpermissive]
struct Parser;
^
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Fix the following warning by renaming RawComment::FullComment to
FullCommentBlock.
In file included from ../../../src/CppParser/AST.cpp:8:0:
../../../src/CppParser/AST.h:783:18: warning: declaration of ‘CppSharp::CppParser::AST::FullComment* CppSharp::CppParser::AST::RawComment::FullComment’ [-fpermissive]
FullComment* FullComment;
^
../../../src/CppParser/AST.h:760:15: warning: changes meaning of ‘FullComment’ from ‘struct CppSharp::CppParser::AST::FullComment’ [-fpermissive]
struct CS_API FullComment : public Comment
^
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Fix the following warning by renaming RawComment::RawCommentKind to
Kind.
In file included from ../../../src/CppParser/AST.cpp:8:0:
../../../src/CppParser/AST.h:780:20: warning: declaration of ‘CppSharp::CppParser::AST::RawCommentKind CppSharp::CppParser::AST::RawComment::RawCommentKind’ [-fpermissive]
RawCommentKind RawCommentKind;
^
../../../src/CppParser/AST.h:765:13: warning: changes meaning of ‘RawCommentKind’ from ‘enum class CppSharp::CppParser::AST::RawCommentKind’ [-fpermissive]
enum struct RawCommentKind
^
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
There are multiple places in the parser which do something similar to
this:
Foo *ptr = 0;
if (...) {
Foo val = ...;
ptr = &val;
}
func(ptr);
In other words, the code takes a pointer to a local variable, and the
pointer is used even after the local variable's scope has ended.
This causes a crash on Linux. For some reason this works fine on Windows
+ Visual studio.
This patchs moves the variable ("val" in the above example) to outer
scopes, so that its life time is extended to cover the use.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Fix trivial switch/case compile warnings like the one below by adding default
case where suitable, or adding the missing cases when that makes more sense.
enumerator 'LastPreprocessingDirective' in switch of enum 'clang::PreprocessedEntity::EntityKind' is not handled
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Fix trivial switch/case compile warnings like the one below by adding default
case where suitable, or adding the missing cases when that makes more sense.
enumerator 'LastPreprocessingDirective' in switch of enum 'clang::PreprocessedEntity::EntityKind' is not handled
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Use forward declarations to avoid the need to include lots of clang headers.
This drops the compilation time for CppParser from 17.8 seconds to 14.1 seconds
for me.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
TestDestructors test cannot be run twice as a static variable holds data from
the first run.
Add an init function to set the static variable to a known state.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
DriverOptions.Is32Bit is used to decide whether to use 4 or 8 byte
pointer size in VTable calculations.
Instead of having a settable Is32Bit property, use
TargetInfo.PointerWidth for this. This allows us to remove the whole
Is32Bit property, and the IS_64_BIT define.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Fix the following warning by removing the new keyword:
src/AST/Type.cs(230,25): warning CS0109: The member `CppSharp.AST.PointerType.IsReference' does not hide an inherited member. The new keyword is not required
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Fix the following warning:
ParserGen.cs(208,26): warning CS0618: `CppSharp.AST.Declaration.Ignore' is obsolete: `Replace set by ExplicitlyIgnore(). Replace get by GenerationKind == GenerationKind.None.'
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
"libdirs { libdir }" in the main premake4.lua file causes Debug_x32
directory to be added for the libdirs for all builds. I think that's a
bug in premake, as at the same place setting, say, "targetdir" works
fine.
However, setting "libdir" to "libdirs" is not needed at all, so let's remove it.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Move windows bindings to i686-pc-win32, the same way as osx bindings are
(and linux bindings will be).
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Linux is case-sensitive with filenames, and as the NUnit library files
are lowercase, we need to use lowercase in the build files also.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>