Page 1 of 1
Clang Code Complete and *.inl
Posted: Wed Mar 06, 2013 3:50 pm
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?...
Re: Clang Code Complete and *.inl
Posted: Fri Mar 08, 2013 12:29 pm
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
Re: Clang Code Complete and *.inl
Posted: Fri Mar 08, 2013 5:26 pm
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
Re: Clang Code Complete and *.inl
Posted: Fri Mar 08, 2013 8:53 pm
by NilC
Thans for answers