Git Product home page Git Product logo

gen's People

Contributors

josharian avatar marxriedl avatar sbinet avatar zchee avatar zimmski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gen's Issues

Do better function naming

func CompilationDatabase_fromDirectory(BuildDir string) (CompilationDatabase_Error, CompilationDatabase) {

Unite the internal type members

  • Rename "Conversion" to "Type"
  • Rename Type.GoType to Type.Name and add a Type.CName (if it is not already there somehow)
  • Use Type everywhere and refactor "ElementType" and "PrimitiveType" so they are in the renamed "Type" structure

Refactor the receiver code

The receiver code is all over the code and in general it is one big mess. Refactor it so that the receiver gets set during or right before the method generation, or remove the receiver struct altogether.

Doxygen defgroups

Can we handle doxygen defgroups? Would that make sense for a Go documentation? e.g.
\defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors

Do correct String() or Error() Methods for enums

  • Errors should have an Error() method
  • Use Spelling() in String() if it exist
  • Generate String() out of the Enum's items
func (ck CommentKind) String() string {
    switch ck {
    case Comment_Null:
        return "Null"
    case Comment_Text:
        return "Text:"
    default:
             return fmt.Sprintf(“Unknown CommentKind value (%d)”, int(ck))
    }
}

func (c CursorKind) to_c() uint32 {
    return uint32(c)
}

func (c CursorKind) String() string {
    return c.Spelling()
}

/* for debug/testing */
func (c CursorKind) Spelling() string {
    cstr := cxstring{C.clang_getCursorKindSpelling(c.to_c())}
    defer cstr.Dispose()
    return cstr.String()
}

func (tle TypeLayoutError) Error() string {
    switch tle {
    case TLE_Invalid:
        return "TypeLayout=Invalid"

    case TLE_Incomplete:
        return "TypeLayout=Incomplete"

    case TLE_Dependent:
        return "TypeLayout=Dependent"

    case TLE_NotConstantSize:
        return "TypeLayout=NotConstantSize"

    case TLE_InvalidFieldName:
        return "TypeLayout=InvalidFieldName"
    }

    return fmt.Sprintf("TypeLayout=unknown (%d)", int(tle))
}

Should we generate slice getters for methods?

e.g.

func (cs CompletionString) Chunks() (ret []CompletionChunk) {
    ret = make([]CompletionChunk, C.clang_getNumCompletionChunks(cs.c))
    for i := range ret {
        ret[i].cs = cs.c
        ret[i].number = C.uint(i)
    }
    return
}
func (ccr CodeCompleteResults) Diagnostics() (ret Diagnostics) {
    ret = make(Diagnostics, C.clang_codeCompleteGetNumDiagnostics(ccr.c))
    for i := range ret {
        ret[i].c = C.clang_codeCompleteGetDiagnostic(ccr.c, C.uint(i))
    }
    return
}

Finish go-clang-compdb

  • Currently it does not work with the testdata directory -> fix it
  • Write a simple test like go-clang-dump

Remove the workaround for adding the function comment

The function comment during the generation is added not with the AST but by adding it to the generated string. This is needed because otherwise the comment would be on the line of the function signature and not one line before the signature. This can be surely done via a Go package.

Return "string" instead of "cxstring" for getters

E.g.

// A string that describes the platform for which this structure provides availability information. Possible values are "ios" or "macosx".
func (pa PlatformAvailability) Platform() cxstring {
    value := cxstring{pa.c.Platform}
    return value
}

Correct linting

  • The linters should handle only code that is not included in the "API binding"
  • Resolve all errors

const char * should be a built-in check

There is a lot of code that checks for const char * which is then handled differently e.g. converting it from/to a Go string. The check itself is repeated throughout the code. This should be refactored so that the check is done in a global function.

Remove the workaround for adding an empty line

The function generation has a workaround which adds a fake statement to the function and later removes it by removing a string. This should be refactored so that adding an empty line is done using some go package.

C Comments to Go Comments

Transform comments into Go style comments? e.g. what should happen with \param and \returns; there are still a lot of doxygen annotations left

Comments Affiliation

If a enum has no direct comment in the C header it uses the last comment group as its comment …. see “VisitorResult”

Generate CXstring too

Just execute the "String()" method in generateASTFunction if a Go "string" is needed. And call "Dispose" if needed on any type that has a Dispose method.

Add a vagrant setup to the repository

This should add the following:

  • A vagrant configuration for the OS, repository and packages that are needed to develop with go-clang-phoenix
  • Scripts to setup a new clang branch. This includes installing needed packages and bootstraping it

Sometimes a string needs to be null

E.g. clang_parseTranslationUnit the fname parameter needs to be null instead of an empty string if an empty string is provided in Go. How can we do that? And are there other instances?

Name return arguments

Return arguments should be named so that the Clang API is easier to read. Especially have a look at "clang_getDiagnosticOption" which seems to be a special case of the Clang API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.