Browse Source

Merge pull request #262 from tomba/fix-warnings

Fix CppParser compile warnings
pull/259/merge
João Matos 12 years ago
parent
commit
7fcd81ebbc
  1. 1
      build/LLVM.lua
  2. 6
      src/Core/Parser/ASTConverter.cs
  3. 2
      src/CppParser/AST.cpp
  4. 4
      src/CppParser/AST.h
  5. 16
      src/CppParser/Bindings/CLI/AST.cpp
  6. 4
      src/CppParser/Bindings/CLI/AST.h
  7. 16
      src/CppParser/Bindings/CSharp/i686-pc-win32/AST.cs
  8. 4
      src/CppParser/Comments.cpp
  9. 6
      src/CppParser/CppParser.cpp
  10. 2
      src/CppParser/CppParser.h
  11. 8
      src/CppParser/Parser.cpp

1
build/LLVM.lua

@ -32,7 +32,6 @@ function SetupLLVMLibs()
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") } libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
configuration "not vs*" configuration "not vs*"
buildoptions { "-fpermissive" }
defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" } defines { "__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS" }
configuration "macosx" configuration "macosx"

6
src/Core/Parser/ASTConverter.cs

@ -657,13 +657,13 @@ namespace CppSharp
{ {
var _rawComment = new AST.RawComment var _rawComment = new AST.RawComment
{ {
Kind = ConvertRawCommentKind(rawComment.RawCommentKind), Kind = ConvertRawCommentKind(rawComment.Kind),
BriefText = rawComment.BriefText, BriefText = rawComment.BriefText,
Text = rawComment.Text, Text = rawComment.Text,
}; };
if (rawComment.FullComment != null) if (rawComment.FullCommentBlock != null)
_rawComment.FullComment = commentConverter.Visit(rawComment.FullComment) _rawComment.FullComment = commentConverter.Visit(rawComment.FullCommentBlock)
as AST.FullComment; as AST.FullComment;
return _rawComment; return _rawComment;

2
src/CppParser/AST.cpp

@ -626,7 +626,7 @@ Comment::Comment(CommentKind kind) : Kind(kind) {}
DEF_STRING(RawComment, Text) DEF_STRING(RawComment, Text)
DEF_STRING(RawComment, BriefText) DEF_STRING(RawComment, BriefText)
RawComment::RawComment() : FullComment(0) {} RawComment::RawComment() : FullCommentBlock(0) {}
FullComment::FullComment() : Comment(CommentKind::FullComment) {} FullComment::FullComment() : Comment(CommentKind::FullComment) {}

4
src/CppParser/AST.h

@ -777,10 +777,10 @@ enum struct RawCommentKind
struct CS_API RawComment struct CS_API RawComment
{ {
RawComment(); RawComment();
RawCommentKind RawCommentKind; RawCommentKind Kind;
STRING(Text) STRING(Text)
STRING(BriefText) STRING(BriefText)
FullComment* FullComment; FullComment* FullCommentBlock;
}; };
#pragma region Commands #pragma region Commands

16
src/CppParser/Bindings/CLI/AST.cpp

@ -2934,23 +2934,23 @@ void CppSharp::Parser::AST::RawComment::BriefText::set(System::String^ s)
((::CppSharp::CppParser::AST::RawComment*)NativePtr)->setBriefText(arg0); ((::CppSharp::CppParser::AST::RawComment*)NativePtr)->setBriefText(arg0);
} }
CppSharp::Parser::AST::RawCommentKind CppSharp::Parser::AST::RawComment::RawCommentKind::get() CppSharp::Parser::AST::RawCommentKind CppSharp::Parser::AST::RawComment::Kind::get()
{ {
return (CppSharp::Parser::AST::RawCommentKind)((::CppSharp::CppParser::AST::RawComment*)NativePtr)->RawCommentKind; return (CppSharp::Parser::AST::RawCommentKind)((::CppSharp::CppParser::AST::RawComment*)NativePtr)->Kind;
} }
void CppSharp::Parser::AST::RawComment::RawCommentKind::set(CppSharp::Parser::AST::RawCommentKind value) void CppSharp::Parser::AST::RawComment::Kind::set(CppSharp::Parser::AST::RawCommentKind value)
{ {
((::CppSharp::CppParser::AST::RawComment*)NativePtr)->RawCommentKind = (::CppSharp::CppParser::AST::RawCommentKind)value; ((::CppSharp::CppParser::AST::RawComment*)NativePtr)->Kind = (::CppSharp::CppParser::AST::RawCommentKind)value;
} }
CppSharp::Parser::AST::FullComment^ CppSharp::Parser::AST::RawComment::FullComment::get() CppSharp::Parser::AST::FullComment^ CppSharp::Parser::AST::RawComment::FullCommentBlock::get()
{ {
return (((::CppSharp::CppParser::AST::RawComment*)NativePtr)->FullComment == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::FullComment((::CppSharp::CppParser::AST::FullComment*)((::CppSharp::CppParser::AST::RawComment*)NativePtr)->FullComment); return (((::CppSharp::CppParser::AST::RawComment*)NativePtr)->FullCommentBlock == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::FullComment((::CppSharp::CppParser::AST::FullComment*)((::CppSharp::CppParser::AST::RawComment*)NativePtr)->FullCommentBlock);
} }
void CppSharp::Parser::AST::RawComment::FullComment::set(CppSharp::Parser::AST::FullComment^ value) void CppSharp::Parser::AST::RawComment::FullCommentBlock::set(CppSharp::Parser::AST::FullComment^ value)
{ {
((::CppSharp::CppParser::AST::RawComment*)NativePtr)->FullComment = (::CppSharp::CppParser::AST::FullComment*)value->NativePtr; ((::CppSharp::CppParser::AST::RawComment*)NativePtr)->FullCommentBlock = (::CppSharp::CppParser::AST::FullComment*)value->NativePtr;
} }

4
src/CppParser/Bindings/CLI/AST.h

@ -1933,13 +1933,13 @@ namespace CppSharp
void set(System::String^); void set(System::String^);
} }
property CppSharp::Parser::AST::RawCommentKind RawCommentKind property CppSharp::Parser::AST::RawCommentKind Kind
{ {
CppSharp::Parser::AST::RawCommentKind get(); CppSharp::Parser::AST::RawCommentKind get();
void set(CppSharp::Parser::AST::RawCommentKind); void set(CppSharp::Parser::AST::RawCommentKind);
} }
property CppSharp::Parser::AST::FullComment^ FullComment property CppSharp::Parser::AST::FullComment^ FullCommentBlock
{ {
CppSharp::Parser::AST::FullComment^ get(); CppSharp::Parser::AST::FullComment^ get();
void set(CppSharp::Parser::AST::FullComment^); void set(CppSharp::Parser::AST::FullComment^);

16
src/CppParser/Bindings/CSharp/i686-pc-win32/AST.cs

@ -7081,10 +7081,10 @@ namespace CppSharp
public struct Internal public struct Internal
{ {
[FieldOffset(0)] [FieldOffset(0)]
public CppSharp.Parser.AST.RawCommentKind RawCommentKind; public CppSharp.Parser.AST.RawCommentKind Kind;
[FieldOffset(52)] [FieldOffset(52)]
public global::System.IntPtr FullComment; public global::System.IntPtr FullCommentBlock;
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
@ -7191,33 +7191,33 @@ namespace CppSharp
} }
} }
public CppSharp.Parser.AST.RawCommentKind RawCommentKind public CppSharp.Parser.AST.RawCommentKind Kind
{ {
get get
{ {
var __ptr = (Internal*)__Instance.ToPointer(); var __ptr = (Internal*)__Instance.ToPointer();
return __ptr->RawCommentKind; return __ptr->Kind;
} }
set set
{ {
var __ptr = (Internal*)__Instance.ToPointer(); var __ptr = (Internal*)__Instance.ToPointer();
__ptr->RawCommentKind = value; __ptr->Kind = value;
} }
} }
public CppSharp.Parser.AST.FullComment FullComment public CppSharp.Parser.AST.FullComment FullCommentBlock
{ {
get get
{ {
var __ptr = (Internal*)__Instance.ToPointer(); var __ptr = (Internal*)__Instance.ToPointer();
return (__ptr->FullComment == IntPtr.Zero) ? null : new CppSharp.Parser.AST.FullComment(__ptr->FullComment); return (__ptr->FullCommentBlock == IntPtr.Zero) ? null : new CppSharp.Parser.AST.FullComment(__ptr->FullCommentBlock);
} }
set set
{ {
var __ptr = (Internal*)__Instance.ToPointer(); var __ptr = (Internal*)__Instance.ToPointer();
__ptr->FullComment = value == (CppSharp.Parser.AST.FullComment) null ? global::System.IntPtr.Zero : value.__Instance; __ptr->FullCommentBlock = value == (CppSharp.Parser.AST.FullComment) null ? global::System.IntPtr.Zero : value.__Instance;
} }
} }
} }

4
src/CppParser/Comments.cpp

@ -40,7 +40,7 @@ RawComment* Parser::WalkRawComment(const clang::RawComment* RC)
auto &SM = C->getSourceManager(); auto &SM = C->getSourceManager();
auto Comment = new RawComment(); auto Comment = new RawComment();
Comment->RawCommentKind = ConvertRawCommentKind(RC->getKind()); Comment->Kind = ConvertRawCommentKind(RC->getKind());
Comment->Text = RC->getRawText(SM); Comment->Text = RC->getRawText(SM);
Comment->BriefText = RC->getBriefText(*AST); Comment->BriefText = RC->getBriefText(*AST);
@ -264,6 +264,6 @@ void Parser::HandleComments(clang::Decl* D, Declaration* Decl)
if (clang::comments::FullComment* FC = RC->parse(*AST, &C->getPreprocessor(), D)) if (clang::comments::FullComment* FC = RC->parse(*AST, &C->getPreprocessor(), D))
{ {
auto CB = static_cast<FullComment*>(ConvertCommentBlock(FC)); auto CB = static_cast<FullComment*>(ConvertCommentBlock(FC));
RawComment->FullComment = CB; RawComment->FullCommentBlock = CB;
} }
} }

6
src/CppParser/CppParser.cpp

@ -33,7 +33,7 @@ DEF_STRING(ParserTargetInfo, ABI)
ParserResult::ParserResult() ParserResult::ParserResult()
: ASTContext(0) : ASTContext(0)
, Library(0) , Library(0)
, Parser(0) , CodeParser(0)
{ {
} }
@ -42,12 +42,12 @@ ParserResult::ParserResult(const ParserResult& rhs)
, Diagnostics(rhs.Diagnostics) , Diagnostics(rhs.Diagnostics)
, ASTContext(rhs.ASTContext) , ASTContext(rhs.ASTContext)
, Library(rhs.Library) , Library(rhs.Library)
, Parser(rhs.Parser) , CodeParser(rhs.CodeParser)
{} {}
ParserResult::~ParserResult() ParserResult::~ParserResult()
{ {
delete Parser; delete CodeParser;
} }
ParserDiagnostic::ParserDiagnostic() {} ParserDiagnostic::ParserDiagnostic() {}

2
src/CppParser/CppParser.h

@ -83,7 +83,7 @@ struct CS_API ParserResult
CppSharp::CppParser::AST::ASTContext* ASTContext; CppSharp::CppParser::AST::ASTContext* ASTContext;
CppSharp::CppParser::AST::NativeLibrary* Library; CppSharp::CppParser::AST::NativeLibrary* Library;
Parser* Parser; Parser* CodeParser;
}; };
enum class SourceLocationKind enum class SourceLocationKind

8
src/CppParser/Parser.cpp

@ -2948,8 +2948,8 @@ ParserResult* ClangParser::ParseHeader(ParserOptions* Opts)
return nullptr; return nullptr;
auto res = new ParserResult(); auto res = new ParserResult();
res->Parser = new Parser(Opts); res->CodeParser = new Parser(Opts);
return res->Parser->ParseHeader(Opts->FileName, res); return res->CodeParser->ParseHeader(Opts->FileName, res);
} }
ParserResult* ClangParser::ParseLibrary(ParserOptions* Opts) ParserResult* ClangParser::ParseLibrary(ParserOptions* Opts)
@ -2958,8 +2958,8 @@ ParserResult* ClangParser::ParseLibrary(ParserOptions* Opts)
return nullptr; return nullptr;
auto res = new ParserResult(); auto res = new ParserResult();
res->Parser = new Parser(Opts); res->CodeParser = new Parser(Opts);
return res->Parser->ParseLibrary(Opts->FileName, res); return res->CodeParser->ParseLibrary(Opts->FileName, res);
} }
ParserTargetInfo* ClangParser::GetTargetInfo(ParserOptions* Opts) ParserTargetInfo* ClangParser::GetTargetInfo(ParserOptions* Opts)

Loading…
Cancel
Save