Clang Code Complete and *.inl

Discussion about CodeLite development process and patches
NilC
CodeLite Enthusiast
Posts: 34
Joined: Fri Sep 14, 2012 1:01 pm
Genuine User: Yes
IDE Question: C++
Contact:

Clang Code Complete and *.inl

Post by NilC »

We got two files:

InclineClass.h:

Code: Select all

class InclineClass {
public:
    void Increment();

private:
    int _count;
};

#include "InclineClass.inl"
InclineClass.inl:

Code: Select all

void InclineClass::HelloWorld() {
    _count+++
}
ctags code complete working in *.inl file, clang - not. Clang can't see reference between *.h and *.inl. I want to fix it, where shold I look first?...
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Clang Code Complete and *.inl

Post by eranif »

Hi,

I am not sure we can fix this...
The problem is that the code completion is working in a TU (translation unit) mode.

This means that "InclineClass.inl" can not be compiled as a standalone file - clang will complain about unidentified scope "InclineClass" - since it actually tries to compile it, but the file can not be compiled without the "parent" file including it

The other code completion (which we refer to as "ctags" but actually is far more complex than just ctags..., as ctags is not context aware) uses the look up table and the scope parser is tolerant enough to understand that we are inside a scope named "InclineClass" from there its easy - just look in the look-up table (*.tags files) and suggest completion.

Eran
Make sure you have read the HOW TO POST thread
User avatar
Jarod42
CodeLite Expert
Posts: 240
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Clang Code Complete and *.inl

Post by Jarod42 »

a possible work-around may be :

Code: Select all

#ifndef INCLINE_H
#define INCLINE_H

class InclineClass {
public:
    void Increment();
private:
    int _count;
};

#include "InclineClass.inl"
#endif

Code: Select all

#ifndef INCLINE_INL
#define INCLINE_INL
#include "InclineClass.h"

void InclineClass::Increment() {
    _count++;
}
#endif
NilC
CodeLite Enthusiast
Posts: 34
Joined: Fri Sep 14, 2012 1:01 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Clang Code Complete and *.inl

Post by NilC »

Thans for answers
Post Reply