.cosmetics

This commit is contained in:
Mirek Fidler 2022-09-16 09:34:56 +02:00
parent bb5b298f04
commit fc7c07db97
4 changed files with 0 additions and 699 deletions

View file

@ -1,260 +0,0 @@
#include "clang.h"
#define LLOG(x) // LOG(x)
bool current_file_parsing;
CoEvent current_file_event;
CurrentFileContext current_file;
int64 current_file_serial;
int64 current_file_done_serial;
Event<const CppFileInfo&> annotations_done;
CurrentFileContext autocomplete_file;
bool do_autocomplete;
bool autocomplete_macros;
Point autocomplete_pos;
int64 autocomplete_serial;
Event<const Vector<AutoCompleteItem>&> autocomplete_done;
void ReadAutocomplete(const CXCompletionString& string, String& name, String& signature)
{
const int chunkCount = clang_getNumCompletionChunks(string);
for(int j = 0; j < chunkCount; j++) {
const CXCompletionChunkKind chunkKind = clang_getCompletionChunkKind(string, j);
String text = FetchString(clang_getCompletionChunkText(string, j));
if(chunkKind == CXCompletionChunk_Optional)
for(int i = 0; i < clang_getNumCompletionChunks(string); i++)
ReadAutocomplete(clang_getCompletionChunkCompletionString(string, i), name, signature);
else
if(chunkKind == CXCompletionChunk_TypedText) {
name = text;
signature << text;
}
else {
signature << text;
if (chunkKind == CXCompletionChunk_ResultType) {
signature << ' ';
}
}
}
}
void CurrentFileThread()
{
MemoryIgnoreLeaksBlock __;
CurrentFileContext parsed_file;
int64 serial;
Clang clang;
auto DoAnnotations = [&] {
if(!clang.tu || !annotations_done) return;
ClangVisitor v;
v.dolocals = true;
v.WhenFile = [&] (const String& path) { return path == current_file.filename; };
v.Do(clang.tu);
CppFileInfo f;
if(v.info.GetCount()) {
f = pick(v.info[0]);
f.items.RemoveIf([&](int i) { return f.items[i].pos.y < parsed_file.line_delta; });
for(AnnotationItem& m : f.items)
m.pos.y -= parsed_file.line_delta;
f.locals.RemoveIf([&](int i) { return f.locals[i].pos.y < parsed_file.line_delta; });
for(AnnotationItem& m : f.locals)
m.pos.y -= parsed_file.line_delta;
f.refs.RemoveIf([&](int i) { return f.refs[i].pos.y < parsed_file.line_delta; });
for(ReferenceItem& m : f.refs)
m.pos.y -= parsed_file.line_delta;
}
Ctrl::Call([&] {
if(parsed_file.filename == current_file.filename &&
parsed_file.real_filename == current_file.real_filename &&
parsed_file.includes == current_file.includes &&
serial == current_file_serial) {
annotations_done(f);
FileAnnotation fa;
fa.defines = parsed_file.defines;
fa.includes = parsed_file.includes;
fa.items = pick(f.items);
fa.refs = pick(f.refs);
fa.time = Time::Low();
CodeIndex().GetAdd(NormalizePath(parsed_file.real_filename)) = pick(fa);
}
current_file_done_serial = serial;
});
};
while(!Thread::IsShutdownThreads()) {
bool was_parsing;
do {
was_parsing = false;
CurrentFileContext f, af;
int64 done_serial;
int64 aserial;
bool autocomplete_do;
{
GuiLock __;
f = current_file;
af = autocomplete_file;
serial = current_file_serial;
done_serial = current_file_done_serial;
autocomplete_do = do_autocomplete;
aserial = autocomplete_serial;
}
if(f.filename.GetCount()) {
String fn = f.filename;
if(!IsSourceFile(fn))
fn.Cat(".cpp");
if(f.filename != parsed_file.filename || f.real_filename != parsed_file.real_filename ||
f.includes != parsed_file.includes || f.defines != parsed_file.defines ||
!clang.tu) { // TODO: same is in autocomplete
parsed_file = f;
int tm = msecs();
current_file_parsing = true;
clang.Parse(fn, f.content, f.includes, f.defines,
CXTranslationUnit_PrecompiledPreamble|
CXTranslationUnit_CreatePreambleOnFirstParse|
CXTranslationUnit_SkipFunctionBodies|
CXTranslationUnit_LimitSkipFunctionBodiesToPreamble|
// CXTranslationUnit_CacheCompletionResults|
CXTranslationUnit_KeepGoing);
// DumpDiagnostics(clang.tu); _DBG_
PutVerbose(String() << "Current file parsed in " << msecs() - tm << " ms");
tm = msecs();
DoAnnotations();
PutVerbose(String() << "Current file parser output processed in " << msecs() - tm << " ms");
current_file_parsing = false;
was_parsing = true;
}
if(Thread::IsShutdownThreads()) break;
if(clang.tu && autocomplete_do) {
CXUnsavedFile ufile = { ~fn, ~af.content, (unsigned)af.content.GetCount() };
CXCodeCompleteResults *results;
current_file_parsing = true;
int tm = msecs();
{
MemoryIgnoreLeaksBlock __;
results = clang_codeCompleteAt(clang.tu, fn, autocomplete_pos.y, autocomplete_pos.x, &ufile, 1, 0);
}
PutVerbose(String() << "Autocomplete in " << msecs() - tm << " ms");
// DumpDiagnostics(clang.tu);
Vector<AutoCompleteItem> item;
if(results) {
int tm = msecs();
for(int i = 0; i < results->NumResults; i++) {
const CXCompletionString& string = results->Results[i].CompletionString;
int kind = results->Results[i].CursorKind;
if(kind == CXCursor_MacroDefinition) // we probably want this only on Ctrl+Space
continue;
if(kind == CXCursor_NotImplemented)
continue;
String name;
String signature;
ReadAutocomplete(string, name, signature);
AutoCompleteItem& m = item.Add();
m.name = name;
m.parent = FetchString(clang_getCompletionParent(string, NULL));
m.signature = CleanupPretty(signature);
m.kind = kind;
m.priority = clang_getCompletionPriority(string);
}
{
MemoryIgnoreLeaksBlock __;
clang_disposeCodeCompleteResults(results);
}
PutVerbose(String() << "Autocomplete processed in " << msecs() - tm << " ms");
}
Ctrl::Call([&] {
if(aserial == autocomplete_serial)
autocomplete_done(item);
});
current_file_parsing = false;
GuiLock __;
do_autocomplete = false;
}
if(clang.tu && serial != done_serial) {
TIMESTOP("ReParse");
current_file_parsing = true;
int tm = msecs();
bool b = clang.ReParse(fn, f.content);
PutVerbose(String() << "Current file reparsed in " << msecs() - tm << " ms");
tm = msecs();
if(b)
DoAnnotations();
PutVerbose(String() << "Current file reparsed output processed in " << msecs() - tm << " ms");
current_file_parsing = false;
was_parsing = true;
}
}
}
while(was_parsing);
current_file_event.Wait();
LLOG("Current file Thread::IsShutdownThreads() " << Thread::IsShutdownThreads());
}
LLOG("Current file thread exit");
}
void SetCurrentFile(const CurrentFileContext& ctx, Event<const CppFileInfo&> done)
{
ONCELOCK {
MemoryIgnoreNonMainLeaks();
MemoryIgnoreNonUppThreadsLeaks(); // clangs leaks static memory in threads
Thread::Start([] { CurrentFileThread(); });
Thread::AtShutdown([] {
LLOG("Shutdown current file");
current_file_event.Broadcast();
});
}
GuiLock __;
annotations_done = done;
current_file_serial++;
current_file = ctx;
current_file_event.Broadcast();
}
bool IsCurrentFileDirty()
{
GuiLock __;
return current_file_serial != current_file_done_serial;
}
bool IsCurrentFileParsing()
{
return current_file_parsing;
}
void CancelCurrentFile()
{
GuiLock __;
annotations_done.Clear();
}
void StartAutoComplete(const CurrentFileContext& ctx, int line, int column, bool macros,
Event<const Vector<AutoCompleteItem>&> done)
{
GuiLock __;
static int64 serial;
autocomplete_pos.y = line;
autocomplete_pos.x = column;
do_autocomplete = true;
autocomplete_macros = macros;
autocomplete_serial = serial++;
autocomplete_done = done;
autocomplete_file = ctx;
current_file_event.Broadcast();
}
bool IsAutocompleteParsing()
{
return do_autocomplete;
}
void CancelAutoComplete()
{
GuiLock __;
autocomplete_done.Clear();
do_autocomplete = false;
}

View file

@ -9,8 +9,6 @@ file
clang.h,
libclang.h,
clang.dli,
todo.txt,
done.txt,
util.cpp,
macros.cpp,
CxxIcon.cpp,
@ -18,7 +16,6 @@ file
libclang.cpp,
clang.cpp,
Visitor.cpp,
CurrentFile.cpp.bak,
CurrentFile.cpp,
Indexer.cpp;

View file

@ -1,297 +0,0 @@
DONE:
= Navigator
- class AString : public B { - remove template<> in navigator
= Assist configuration
- Option "reindex manual" (autosetup based on CPU cores)
- Number of indexer threads
- Number of cached files
- options to disable assist
- option for logging
- Enel/ProjectDB.cpp:46 - does not see ts.table Alt-J
- AssistEditor Virtual methods not showing LineEdit etc..
- Visitor.cpp hasid = false - remove initialisation
- Core/String.h - conversion operators wrong nests (template argument)
- out of sync SetCurrentFile
- MSVC
- Remove //$
- check dialog mode of navigator
- missing preamble folder - check preamble creation
- AutoComplete remove duplicate lines
- use codeindex info for file annotations
- Hdepend NoConsole
- current file indexing
- Navigator: () -> operator char *
- when scope is selected in navigator, search should be ingored
- optimise loading
- NewFile gets called on .log update resulting in SetCurrentFile and SyncHeaders (maybe not?)
- Alt+J bool IsIgnored(const String& id) jump on Find
- * line in navigator
- Enel/Scenarios.cpp:52 int i = list.;
- inside AutoObstacleTerrainsLayerMulti, J inside CoFor
- OpenWind/PowerCurve.cpp:3883 J on GetElevation
- Vector/VectorLayer.cpp:870 J on GetBuffer
- Raster/RasterLayer.cpp:841 J on NewRc
- Occasional freeze probably due to reindexing
- Heap leaks in Linux
- Alt-I on AssistDisplay::Paint
- Autocomplete Size sz; sz.ct - when the name is not found, list is missing (should not be)
- for .txt file, navigator keeps showing previous local file
- ImagePainter iw; iw.Arc - CtrlSpace shows nothing
- Alt+C int Indexer::jobs_done; missing ;
- virtuals - remove = 0 (e.g. ImageMaker)
- ow "stdev" in Navigator produces second weird set of references that lead just to class GetStdevStdevVCounts
- alt-U ide/clang/clang.h:23 on SourceLocation
- Alt-J at CtrlLib/CtrlUtil.cpp:143 does not
- Wind/MetMastLayer.cpp:1324 no jump
- Wind/MetMastLayer.cpp:6358 no jump
- CXGlobalOpt_ThreadBackgroundPriorityForIndexing
- Wind/MetTimeProf.cpp:881 jump on CUtil::
- Wind/MetMastLayer.cpp:6331 jumps to sqr
- Wind/MetMastLayer.cpp:427 - no current file - 208KB :)
- CUtils:: - no assist after "::" (but works with Ctrl+Space)
- Alt-K in void AssistEditor::Assist(bool macros) does not show all (_Bool problem?)
- Indexer.cpp [7, 423] (Indexer::Job&,const Upp::String&)const
- Indexer.cpp [32, 368] FileAnnotation&&)(false)
- In CONSOLE_APP_MAIN jumps do not wrok
- Time GatherDependencies(const String& path, VectorMap<String, Time>& result, Index<String>& define_includes,
Alt+I next line "No relevant..."
- IdeBar.cpp [35, 35] M::*)(A1,A2,A3,A4,A5,MP1,MP2,MP3,MP4,MP5),P1,P2,P3,P4,P5)
// probably method pointer in parameters list
- OpenWind.h autocomplete
- Alt+J on CurrentFileContext
- Indexer.cpp refs (issue with macro)
[3, 417] Upp::operator
[3, 417] Upp::VppLog()
[3, 417] Upp::EOL
- Indexer.cpp refs
[3, 418] CoEvent::Broadcast() // somehow choose Indexer::event here
[9, 418] CoEvent::Broadcast()
[3, 418] Indexer::event
- failed AC keeps running (sites[i]. instead of ->)
- aux files / autocomplete
- inbody
- newly created file looks like parsing until first function(?)
- Handle local variables on jumps
- ReduceCfgCache - move tdx files to Cache
- Implement typedefs
- Alt+K in void Ide::FFoundFinish(bool files)
- reindex all source files seems to run twice
- remove bool Ide::GotoDesignerFile(const String& path, const String& scope, const String& name, int line)
- Usage .lay of FileSel::dir adds some strange lines
- Remove IdeGotoFileAndId (after fixing laydes Alt+K)
- Alt-J on layout
- Alt-U on IconDes::Arrow shows Image::Arrow too
- AltC static method(); (header->source) retains static
- Ide::SwapS - local struct members annotated
- DLOG(CleanupId(s)); - jump on CleanupId does go to DLOG (it has a good reason to, but anyway...)
-> Problem is with clang_Location_isFromMainFile, for expanded macro, it returns false
- navigator - GotoDesignerFile
- GREAT CODEBASE PURGE:
- ReferenceDlg
- bool IsCodeRefType(const String& type)
- void TopicEditor::InsertItem()
- void TopicEditor::Label(String& label)
- void TopicEditor::FixTopic()
- bool auto_rescan;
bool auto_check;
- IdeGotoCodeRef
- void LayDes::GotoUsing()
- thisbacks
- virtuals
- different master header currentfile / index issue
- Alt-K - maybe should show declaration/definition too?
- Indexer::IsRunning should account for SchedulerThread
- In Navigator, Assist should be before AssistEditor, when search is "Assist"
- virtuals do not work with With...Layout<TopWindow> base
- Ctrl+Space is sort of slow (too many items?)
- reduce cache
- TMPDIR?
- No autocomplete in void MainConfigDlg::FlagDlg()
- void MainConfigDlg::FlagDlg() no Upp function on Ctrl+Space
- id = main(int,const char*argv[]) - argv[] should not be there
- Indexer.cpp refs
[3, 417] Upp::Stream::operator // operator<< ?
- FlagDlg
- Size SplashCtrl::MakeLogo(Ctrl& parent, Array<Ctrl>& ctrl)
- Reindex all files should clear .ppi cache for hdepends too.
- Alt+I - if single, we still want to go to annotation line
- Implement annotation columns
- save file annotation to codeindex
- Alt+I - functions do not work
- ide.h is not indexed
- AssistTest missing istream
- Alt+I by name
- Alt+I by nest
- remove StartAutoCompleteThread, StartCurrentFileParserThread, change to oncelock
- Core/String.h - empty macros at the start in navigator
- void Navigator::SyncCursor()
- operator bool - wrong nest (Core/Speller.cpp)
- Core/String.h - operator const void *() - wrong highlighting (all bold)
- immediate reparse (probably Update?)
- Speller.cpp - Speller type has {}, Line too
- global navigation not working properly
- rescan everything function
- unicode is very long because { 123 , 41234234
- local file navigation off by 1 line
- indexer TabBar missing
- destructor name is not bold (clang/visitor.cpp)
- constructor - worng nest(Core/Speller.cpp)
- AString type [31] - wrong icon
- * nest in navigator local file
- PaintCpp ending spaces in navigator
- Navigator -> (constructor does not have return value)
- Upp:: missing from Vector
- class Ctrl
- class Logc
- writing to text is slow (IsSource detection?)
- .txt keeps syncing
- Enum annotations
- .txt is pulsing all time
- i < items crash at start occassionally
- ide/Core.h - no annotations
REJECTED:
- autocomplete templates ?
- navlines
- Speller.cpp: structures have wrong nest (missing itself)
- void NavDlg::GoTo()
- AssistTest updates delayed

View file

@ -1,139 +0,0 @@
EPICS:
= Handling of C files
- C:\u\llvm_ide\uppsrc\plugin\z\lib\compress.c (22:24) unknown type name 'dest' - do we need CBLITZ?
- .c files
= AltC fixes
- AltC Vector<Job> Indexer::jobs; should be: Vector<Indexer::Job> Indexer::jobs;
- Alt+C static void AtShutdown(void (*shutdownfn)());
= Assist configuration
- Option "first config only"
- in linux, show libclang path
= Annotations/Visitor/formatting
= Navigator
- navigator "BAD" - should be first
- Navigator cycling struct AssistEditor : CodeEditor, Navigator { goes to contructor as well
- (unnamed) BAD -> LogicalReport - fix enum in autocomplete
- Sort navigator in header order
= Macros
- first macro in the file (AssistTest) is ignored
ISUES:
- Saving
- commentdp
- TPP HELP WINDOW->EDITOR - go to active label
- Do TODOs
- header without .cpp speed
- enum annotation popup (Ctrl::)
- check editor mode
- Error output: (): x += GetTextSize(" Ôćĺ ", StdFont());
- x += GetTextSize(" Ôćĺ ", StdFont()) - autocomplete fails on UTF8
- unnamed union in String0
- Wait for indexer?
- FFound key to reuse pane for repeated finds
- TriggerIndexer should probably also restart CurrentFile and maybe autocomplete
- TriggerIndexer on theide exit
- check default parameters and virtuals / alt+c, commentdp
- String GetClass(const AnnotationItem& m) vs m.nest - do we need GetClass?
- Wind/MetMastLayer.cpp:6354 no jump on sqrt (?)
- Macros with PPInfo
- Icons Alt-J/I/U
- void ClearTurbineVarsCache() - after switching main config, reparse file
- Core/Parser.h slow for some reason...
NONCLANG:
- Debugger Threads should show active threads first
- Debugger Threads clicks on threads do not work anymore
- QTF :\1label\1:
- StringBuffer does not work in debugger pdb
- popup tip is going white
- should call Ctrl::ShutdownThreads in gui
void AppExit__()
{
Thread::ShutdownThreads();
- tree drag/drop does not show texts
- Ide::Ide.iml - showing flags (like HD) is delayed
- Visitor.cpp - jump on CXPrintingPolicyProperty
NTH:
- fixups?
- Find all debug logs
- Find all virtual method overrides
- replace/remove Hdepend
- resolve '.' in FlagDlg
- figure out how to add info to config flags
- improve main config dialog
- current file errors
- BLITZ dialog
- reindex source files - add progress
- Use BlitzFile function
- autocomplete <Functions>, <macros>, ....
- autocomplete <symbols>
- even better operator pretty rendering
- current file
- Alt+I should try previous method
- Handle templates
- Alt-J if everything fails (template, e.g. OpenWindUtil/Utils.h:348), go by the name
- Alt-J relaxed rules if not found (in templates, different parameters)
- Remove template < > in autocomplete
LATER:
- optimise hdepend (then maybe remove .h limitation for syncheaders)