Skip to content
Permalink
Browse files

Fixes for clang6 on Windows

* Update build.bat to match build.sh

* Add heuristic for typedefs-in-system-headers detection, fixes size_t issue

* Force newlines to be Unix (to avoid crazy git diffs)

* Update the generated file

* Make VFO test OS-agnostic

* Fix string marshalling since clang uses utf-8; add regression tests.

* Add editorconfig, set newlines/charset everywhere, add .vs to gitignore

* Don't print extra white space at the end of struct fields

* Use dotnet msbuild to build ClangSharp instead of platform-specific scripts

* Force ints for enums if possible, for cross-plat

* Fix interpretation of typedefs, for cross-plat
  • Loading branch information...
SolalPirelli authored and benpye committed Jul 4, 2018
1 parent 37a46f3 commit a878bb45d25c28a5417566cf6c874ea1ad18c400
@@ -0,0 +1,6 @@
root = true
charset = utf-8

# Make git happy
end_of_line = lf
insert_final_newline = true
@@ -5,6 +5,7 @@
*.suo
*.user
*.sln.docstates
.vs/

# Build results
[Dd]ebug/
@@ -0,0 +1,40 @@
using System;
using System.IO;
using Xunit;

namespace ClangSharp.Test
{
// This is not ported from libclangtest but instead created to test Unicode stuff
public class TranslationUnit
{
[Theory]
[InlineData("basic")]
[InlineData("example with spaces")]
[InlineData("")]
public void Basic(string name)
{
// Create a unique directory
var dir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(dir);

try
{
// Create a file with the right name
var file = new FileInfo(Path.Combine(dir, name + ".c"));
File.WriteAllText(file.FullName, "int main() { return 0; }");

var index = clang.createIndex(0, 0);
var translationUnit = clang.parseTranslationUnit(index, file.FullName, new string[0], 0, new CXUnsavedFile[0], 0, 0);
var clangFile = clang.getFile(translationUnit, file.FullName);
var clangFileName = clang.getFileName(clangFile);
var clangFileNameString = clang.getCString(clangFileName);

Assert.Equal(file.FullName, clangFileNameString);
}
finally
{
Directory.Delete(dir, true);
}
}
}
}
Oops, something went wrong.

0 comments on commit a878bb4

Please sign in to comment.
You can’t perform that action at this time.