Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » 2022.3rc5
Re: 2022.3rc5 [message #59576 is a reply to message #59568] Wed, 08 February 2023 17:55 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
Hello Mirek,

I've stripped the code, and wrote the below test:

struct Clang {

	CXIndex index = nullptr;
	CXTranslationUnit tu = nullptr;

	Clang()
	{
		MemoryIgnoreLeaksBlock __;
		index = clang_createIndex(0, 0);
	}

	void Parse()
	{
		Vector<const char*> args = {
			"-std=c++14",
			"-xc++",
			"-I/usr/include/llvm",
			"-I/usr/include/c++",
			"-I/usr/include/c++/12.2.1",
			"-I/usr/include/c++/12.2.1/x86_64-pc-linux-gnu",
			"-I/usr/include/c++/12.2.1/backward",
			"-I/usr/lib/clang/15.0.7/include",
			"-I/usr/include"
			"-I/usr/local/include",
		};

		tu = clang_parseTranslationUnit(
						index,
						"/home/user/test.cpp",
                        args,
                        args.GetCount(),
                        nullptr,
                        0,
                        CXTranslationUnit_None
                 );
	}

	~Clang()
	{
		MemoryIgnoreLeaksBlock __;
		if(tu) clang_disposeTranslationUnit(tu);
		clang_disposeIndex(index);
	}

CONSOLE_APP_MAIN
{
	StdLogSetup(LOG_COUT);
	Clang().Parse();
}


This works. clang_parseTranslationUnit() returns a translation unit handle every single time. (And the handle can be successfully used to traverse the AST.


However, the same code applied to TheIDE's Clang::Parse() method, with hard coded paths as is above,
clang_parseTranslationUnit() still fails to return a translation unit every single time.

I've tried both dynamic loading and static linking (LCLANG), tested both the above code & TheIDe on Linux 6.1.9/Clang 14 & 15

At this point I am almost sure that this is not a user-side problem, because I have installed vanilla ArchLinux on both a real hardware and on a VM (on windows machine), yet I get the same failure... Could this be a process env issue? Any ideas?


Best regards,
Oblivion





[Updated on: Wed, 08 February 2023 17:57]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ide insert data/timestep/GUID
Next Topic: clang-format integration
Goto Forum:
  


Current Time: Sun May 12 18:44:45 CEST 2024

Total time taken to generate the page: 0.02754 seconds