diff --git a/uppsrc/Core/Defs.h b/uppsrc/Core/Defs.h index 7415fd2e1..c44d8bb69 100644 --- a/uppsrc/Core/Defs.h +++ b/uppsrc/Core/Defs.h @@ -48,7 +48,7 @@ inline void LOGNOP__() {} #define _cm_ , -#define __countof(a) int(sizeof(a) / sizeof(a[0])) +#define __countof(a) int(sizeof(a) / sizeof(a[0]) ) #define __Expand1(x) x(1) #define __Expand2(x) __Expand1(x) x(2) diff --git a/uppsrc/CppBase/CppBase.h b/uppsrc/CppBase/CppBase.h index 53a86d271..f7cfeac31 100644 --- a/uppsrc/CppBase/CppBase.h +++ b/uppsrc/CppBase/CppBase.h @@ -30,7 +30,7 @@ struct CppMacro : Moveable { String Expand(const Vector& p, const Vector& ep) const; - void Serialize(Stream& s) { s % param % body; } + void Serialize(Stream& s); String ToString() const; }; @@ -67,15 +67,17 @@ struct PPFile { // contains "macro extract" of file, only info about macros defi Time filetime; Array item; Index includes; - + Vector keywords; + String md5sum; + void Parse(Stream& in); - void Serialize(Stream& s) { s % filetime % item % includes; } + void Serialize(Stream& s) { s % filetime % item % includes % keywords % md5sum; } void Dump() const; private: Vector ppmacro; // indicies of macros in sAllMacros - void CheckEndNamespace(Vector& namespace_block, int level); + void CheckEndNamespace(Vector& namespace_block, int level, Md5Stream& md5); }; PPMacro *FindPPMacro(const String& id, Index& segment_id, int& segmenti); @@ -102,7 +104,7 @@ bool IncludesFile(const String& parent_path, const String& header_path); struct FlatPP { Index segment_id; Index usings; -// Index includes; + Index includes; }; const FlatPP& GetFlatPPFile(const char *path); // with #includes resolved @@ -135,11 +137,7 @@ struct Cpp { Index namespace_using; // 'using namespace' up to start of file Vector namespace_stack; // namspace up to start of file - Index ids; // all ids in the file - - String usings; // usings combined for the purpose of change detection ("CheckFile") - String namespaces; // namespace_stack at the beginning of file, combined, for detection - String includes; // all file includes, combined, for detection + Md5Stream md5; void Define(const char *s); @@ -151,8 +149,7 @@ struct Cpp { bool Preprocess(const String& sourcefile, Stream& in, const String& currentfile, bool just_get_macros = false); - VectorMap GetDefinedMacros(); - String GetIncludedMacroValues(const Vector& id); + String GetDependeciesMd5(const Vector& m); typedef Cpp CLASSNAME; }; diff --git a/uppsrc/CppBase/cpp.cpp b/uppsrc/CppBase/cpp.cpp index 2a5b6b56a..1af7842b6 100644 --- a/uppsrc/CppBase/cpp.cpp +++ b/uppsrc/CppBase/cpp.cpp @@ -52,7 +52,6 @@ String Cpp::Expand(const char *s) s++; String id(bid, s); LTIMING("Expand ID2"); - ids.FindAdd(id); if(notmacro.Find(id) < 0) { const PPMacro *pp = macro.FindLastPtr(id); int segmenti = pp ? segment_id.Find(pp->segment_id) : -1; @@ -155,6 +154,7 @@ void Cpp::DoFlatInclude(const String& header_path) LTIMING("DoFlatInclude"); LLOG("Flat include " << header_path); if(header_path.GetCount()) { + md5.Put(header_path); if(visited.Find(header_path) >= 0) return; visited.Add(header_path); @@ -164,8 +164,11 @@ void Cpp::DoFlatInclude(const String& header_path) segment_id.FindAdd(pp.segment_id[i]); for(int i = 0; i < pp.usings.GetCount(); i++) { namespace_using.FindAdd(pp.usings[i]); - usings << ";" << pp.usings[i]; + md5.Put('$'); + md5.Put(pp.usings[i]); } + for(int i = 0; i < pp.includes.GetCount(); i++) + visited.FindAdd(pp.includes[i]); } } @@ -195,6 +198,7 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, bo if(s.GetCount()) { if(notthefile && (s == sourcefile || IncludesFile(s, sourcefile))) { LLOG("Include IN " << s); + md5.Put(s); Do(sourcefile, in, s, get_macros); RHITCOUNT("Include IN"); } @@ -216,104 +220,109 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, bo LLOG("pp end namespace " << namespace_stack); } else - if(m.type == PP_USING) + if(m.type == PP_USING) { namespace_using.FindAdd(m.text); + md5.Put('$'); + md5.Put(m.text); + } } if(sourcefile != currentfile) return; } - namespaces = Join(namespace_stack, ";"); + md5.Put('@'); + md5.Put(Join(namespace_stack, ";")); + + done = true; + + if(get_macros) + return; - if(!get_macros) { - LTIMING("Expand"); - incomment = false; + LTIMING("Expand"); + incomment = false; + prefix_macro.Clear(); + StringBuffer result; + result.Clear(); + result.Reserve(16384); + int lineno = 0; + bool incomment = false; + int segment_serial = 0; + segment_id.Add(--segment_serial); +#ifdef IGNORE_ELSE + int ignore_else = 0; +#endif + while(!in.IsEof()) { + String l = prefix_macro + in.GetLine(); prefix_macro.Clear(); - StringBuffer result; - result.Clear(); - result.Reserve(16384); - int lineno = 0; - bool incomment = false; - int segment_serial = 0; - segment_id.Add(--segment_serial); - #ifdef IGNORE_ELSE - int ignore_else = 0; - #endif - while(!in.IsEof()) { - String l = prefix_macro + in.GetLine(); - prefix_macro.Clear(); - lineno++; - int el = 0; - while(*l.Last() == '\\' && !in.IsEof()) { - el++; - l.Trim(l.GetLength() - 1); - l.Cat(in.GetLine()); + lineno++; + int el = 0; + while(*l.Last() == '\\' && !in.IsEof()) { + el++; + l.Trim(l.GetLength() - 1); + l.Cat(in.GetLine()); + } + RemoveComments(l, incomment); + CParser p(l); + if(p.Char('#')) { + if(p.Id("define")) { + result.Cat(l + "\n"); + CppMacro m; + String id = m.Define(p.GetPtr()); + if(id.GetCount()) { + PPMacro& pp = macro.Add(id); + pp.macro = m; + pp.segment_id = segment_serial; + notmacro.Trim(kw.GetCount()); + } } - RemoveComments(l, incomment); - CParser p(l); - if(p.Char('#')) { - if(p.Id("define")) { - result.Cat(l + "\n"); - CppMacro m; - String id = m.Define(p.GetPtr()); - if(id.GetCount()) { - PPMacro& pp = macro.Add(id); - pp.macro = m; - pp.segment_id = segment_serial; - notmacro.Trim(kw.GetCount()); - } - } - else - if(p.Id("undef")) { - result.Cat(l + "\n"); - if(p.IsId()) { - segment_id.Add(--segment_serial); - PPMacro& m = macro.Add(p.ReadId()); - m.segment_id = segment_serial; - m.macro.SetUndef(); - notmacro.Trim(kw.GetCount()); - segment_id.Add(--segment_serial); - } - } - else { - result.Cat('\n'); - #ifdef IGNORE_ELSE - if(ignore_else) { - if(p.Id("if") || p.Id("ifdef") || p.Id("ifndef")) - ignore_else++; - else - if(p.Id("endif")) - ignore_else--; - } - else { - if(p.Id("else") || p.Id("elif")) - ignore_else = 1; - } - #endif - if(p.Id("include")) { - LTIMING("Expand include"); - String s = GetIncludePath(p.GetPtr(), current_folder); - DoFlatInclude(s); - segment_id.Add(--segment_serial); - includes << ';' << s; - } + else + if(p.Id("undef")) { + result.Cat(l + "\n"); + if(p.IsId()) { + segment_id.Add(--segment_serial); + PPMacro& m = macro.Add(p.ReadId()); + m.segment_id = segment_serial; + m.macro.SetUndef(); + notmacro.Trim(kw.GetCount()); + segment_id.Add(--segment_serial); } } else { - LTIMING("Expand expand"); + result.Cat('\n'); #ifdef IGNORE_ELSE - if(ignore_else) - result.Cat('\n'); - else + if(ignore_else) { + if(p.Id("if") || p.Id("ifdef") || p.Id("ifndef")) + ignore_else++; + else + if(p.Id("endif")) + ignore_else--; + } + else { + if(p.Id("else") || p.Id("elif")) + ignore_else = 1; + } #endif - result.Cat(Expand(l) + "\n"); + if(p.Id("include")) { + LTIMING("Expand include"); + String s = GetIncludePath(p.GetPtr(), current_folder); + DoFlatInclude(s); + segment_id.Add(--segment_serial); + } } - while(el--) - result.Cat("\n"); } - output = result; + else { + LTIMING("Expand expand"); + #ifdef IGNORE_ELSE + if(ignore_else) + result.Cat('\n'); + else + #endif + result.Cat(Expand(l) + "\n"); + } + while(el--) + result.Cat("\n"); } - done = true; + output = result; } Index Cpp::kw; @@ -328,7 +337,7 @@ bool Cpp::Preprocess(const String& sourcefile, Stream& in, const String& current segment_id.Clear(); segment_id.Add(0); segment_id.Reserve(100); - + ONCELOCK { const char **h = CppKeyword(); while(*h) { @@ -348,34 +357,15 @@ bool Cpp::Preprocess(const String& sourcefile, Stream& in, const String& current return done; } -VectorMap Cpp::GetDefinedMacros() -{ - LTIMING("GetDefinedMacros"); - VectorMap r; - for(int i = 0; i < r.GetCount(); i++) - r[i] = MD5String(r[i]); - LLOG("GetDefinedMacros " << r); - return r; -} +void GetAllMacros(Md5Stream& md5, const String& id, Index& segment_id); -String GetAllMacros(const String& id, Index& segment_id); - -String Cpp::GetIncludedMacroValues(const Vector& m) +String Cpp::GetDependeciesMd5(const Vector& m) { String r; - LTIMING("GetUsedMacroValues"); - r << "##namespace\n" << namespaces << "\n" - << "##usings\n" << usings << "\n"; for(int i = 0; i < m.GetCount(); i++) { - String mm = GetAllMacros(m[i], segment_id); - if(mm.GetCount()) - r << '#' << m[i] << '\n' << mm << '\n'; + GetAllMacros(md5, m[i], segment_id); } -#ifdef _DEBUG - return r; -#else - return MD5String(r); -#endif + return md5.FinishString(); } END_UPP_NAMESPACE diff --git a/uppsrc/CppBase/macro.cpp b/uppsrc/CppBase/macro.cpp index 161b33ddf..6becef9f9 100644 --- a/uppsrc/CppBase/macro.cpp +++ b/uppsrc/CppBase/macro.cpp @@ -62,6 +62,12 @@ String CppMacro::ToString() const return r; } +void CppMacro::Serialize(Stream& s) +{ + s % param % body; + s.SerializeRaw(md5, 16); +} + String CppMacro::Expand(const Vector& p, const Vector& ep) const { String r; diff --git a/uppsrc/CppBase/ppfile.cpp b/uppsrc/CppBase/ppfile.cpp index 36affbe1e..597bb4610 100644 --- a/uppsrc/CppBase/ppfile.cpp +++ b/uppsrc/CppBase/ppfile.cpp @@ -132,11 +132,12 @@ const CppMacro *FindMacro(const String& id, Index& segment_id, int& segment return m ? &m->macro : NULL; } -void PPFile::CheckEndNamespace(Vector& namespace_block, int level) +void PPFile::CheckEndNamespace(Vector& namespace_block, int level, Md5Stream& md5) { if(namespace_block.GetCount() && namespace_block.Top() == level) { namespace_block.Drop(); item.Add().type = PP_NAMESPACE_END; + md5.Put('.'); } } @@ -155,7 +156,9 @@ void PPFile::Parse(Stream& in) Vector namespace_block; bool next_segment = true; Index local_segments; + keywords.Clear(); int linei = 0; + Md5Stream md5; while(!in.IsEof()) { String l = in.GetLine(); while(*l.Last() == '\\' && !in.IsEof()) { @@ -182,12 +185,19 @@ void PPFile::Parse(Stream& in) m.line = linei; m.macro = def; ppmacro.Add(sAllMacros.Put(id, m)); + md5.Put("#", 1); + md5.Put(id); + md5.Put(0); + md5.Put(m.macro.md5, 16); } } else if(p.Id("undef")) { if(p.IsId()) { String id = p.ReadId(); + md5.Put("#", 1); + md5.Put(id); + md5.Put(1); int segmenti = -1; PPMacro *um = FindPPMacro(id, local_segments, segmenti); if(um) { // heuristic: only local undefs are allowed @@ -217,6 +227,8 @@ void PPFile::Parse(Stream& in) item.Drop(); else includes.FindAdd(m.text); + md5.Put('@'); + md5.Put(m.text); } } else { @@ -238,6 +250,9 @@ void PPFile::Parse(Stream& in) m.type = type; m.text = id; } + md5.Put('$'); + md5.Put(type); + md5.Put(id); } was_namespace = was_using = false; } @@ -262,20 +277,23 @@ void PPFile::Parse(Stream& in) m.text = namespace_macro[q]; namespace_block.Add(level); level++; + md5.Put('%'); + md5.Put(id); } else { q = namespace_end_macro.Find(id); if(q >= 0) { level--; - CheckEndNamespace(namespace_block, level); + CheckEndNamespace(namespace_block, level, md5); } } + keywords.Add(id); } else if(p.Char('}')) { if(level > 0) { level--; - CheckEndNamespace(namespace_block, level); + CheckEndNamespace(namespace_block, level, md5); } } else @@ -290,6 +308,17 @@ void PPFile::Parse(Stream& in) catch(...) {} linei++; } + md5sum = md5.FinishString(); + Sort(keywords); + Vector remove; + int i = 0; + while(i < keywords.GetCount()) { // Remove identical items + int ii = i; + i++; + while(i < keywords.GetCount() && keywords[ii] == keywords[i]) + remove.Add(i++); + } + keywords.Remove(remove); } void PPFile::Dump() const @@ -418,6 +447,7 @@ const FlatPP& GetFlatPPFile(const char *path, Index& visited) const PPFile& pp = GetPPFile(path); int n = visited.GetCount(); visited.FindAdd(path); + fp.includes.FindAdd(path); for(int i = 0; i < pp.item.GetCount(); i++) { const PPItem& m = pp.item[i]; if(m.type == PP_INCLUDE) { @@ -427,9 +457,11 @@ const FlatPP& GetFlatPPFile(const char *path, Index& visited) visited.Add(s); const FlatPP& pp = GetFlatPPFile(s, visited); for(int i = 0; i < pp.segment_id.GetCount(); i++) - fp.segment_id.Add(pp.segment_id[i]); + fp.segment_id.FindAdd(pp.segment_id[i]); for(int i = 0; i < pp.usings.GetCount(); i++) - fp.usings.Add(pp.usings[i]); + fp.usings.FindAdd(pp.usings[i]); + for(int i = 0; i < pp.includes.GetCount(); i++) + fp.includes.FindAdd(pp.includes[i]); } } else @@ -450,17 +482,29 @@ const FlatPP& GetFlatPPFile(const char *path) return GetFlatPPFile(path, visited); } -String GetAllMacros(const String& id, Index& segment_id) +void GetAllMacros(Md5Stream& md5, const String& id, Index& segment_id) { + Vector< Tuple2 > pos; + Vector def; String r; int q = sAllMacros.Find(id); while(q >= 0) { const PPMacro& m = sAllMacros[q]; - if(segment_id.Find(m.segment_id) >= 0) - r << '\n' << m.macro; + int si = segment_id.Find(m.segment_id); + if(si >= 0) { + pos.Add(MakeTuple(si, m.line)); + def.Add(&m.macro); + } q = sAllMacros.FindNext(q); } - return r; + IndexSort(pos, def); + int n = def.GetCount(); + if(n) { + md5.Put(&n, sizeof(int)); + md5.Put(id); + for(int i = 0; i < n; i++) + md5.Put(def[i]->md5, 16); + } } static VectorMap s_namespace_macro; diff --git a/uppsrc/ide/Browser/Base.cpp b/uppsrc/ide/Browser/Base.cpp index 128d663f3..c507101e0 100644 --- a/uppsrc/ide/Browser/Base.cpp +++ b/uppsrc/ide/Browser/Base.cpp @@ -8,12 +8,13 @@ #define LDUMP(x) // DDUMP(x) +#define CPP_CODEBASE_VERSION 314 + ArrayMap source_file; void SourceFileInfo::Serialize(Stream& s) { - s % time % check_info % ids % included_id_macros % namespace_info % using_info - % defined_macros % defined_namespace_info % includes; + s % time % check_info % dependencies_md5sum % md5sum; if(s.IsLoading()) { depends.Clear(); depends_time = Null; @@ -84,8 +85,6 @@ void SerializeCodeBase(Stream& s) CodeBase().Serialize(s); } -#define CPP_CODEBASE_VERSION 10 - void SaveCodeBase() { LTIMING("SaveCodeBase"); @@ -234,16 +233,14 @@ bool CheckFile(SourceFileInfo& f, const String& path) FileIn in(path); String npath = NormalizeSourcePath(path); pp.Preprocess(npath, in, GetMasterFile(npath), true); - String included_id_macros = pp.GetIncludedMacroValues(f.ids.GetKeys()); - if(f.included_id_macros != included_id_macros) { - f.depends_time = Null; - f.depends.Clear(); - return false; - } + String md5 = pp.GetDependeciesMd5(GetPPFile(path).keywords); + bool r = f.dependencies_md5sum == md5; + f.depends.Clear(); + f.dependencies_md5sum = md5; for(int i = 0; i < pp.visited.GetCount(); i++) f.depends.Add(sTimePath.FindAdd(pp.visited[i])); f.depends_time = GetDependsTime(f.depends); - return true; + return r; } void ParseFiles(Progress& pi, const Index& parse_file) @@ -258,8 +255,7 @@ void ParseFiles(Progress& pi, const Index& parse_file) FileIn fi(path); LDUMP(path); LDUMP(parse_file[i]); - bool dummy; - ParseSrc(fi, parse_file[i], callback1(BrowserScanError, i), true, false, dummy, dummy); + ParseSrc(fi, parse_file[i], callback1(BrowserScanError, i)); } } @@ -305,12 +301,8 @@ void UpdateCodeBase(Progress& pi) UpdateCodeBase2(pi); } -Vector ParseSrc(Stream& in, int file, Callback2 error, - bool do_macros, bool get_changes, - bool& namespace_info_changed, - bool& includes_changed) +void ParseSrc(Stream& in, int file, Callback2 error) { - Vector cm; String path = GetSourceFilePath(file); LLOG("====== Parse " << file << ": " << path); Vector pp; @@ -333,45 +325,10 @@ Vector ParseSrc(Stream& in, int file, Callback2 erro cpp.Preprocess(path, in, GetMasterFile(GetSourceFilePath(file))); filetype = decode(ext, ".h", FILE_H, ".hpp", FILE_HPP, ".cpp",FILE_CPP, ".c", FILE_C, FILE_OTHER); - if(do_macros) { - sfi.ids = cpp.ids.PickKeys(); - sfi.included_id_macros = cpp.GetIncludedMacroValues(sfi.ids.GetKeys()); - LDUMP(sfi.ids); - LDUMP(sfi.time); - VectorMap dm = cpp.GetDefinedMacros(); - LDUMP(dm); - if(sfi.defined_macros != dm) { - LTIMING("Find changed macros"); - if(get_changes) { - Buffer found(sfi.defined_macros.GetCount(), false); - for(int i = 0; i < dm.GetCount() && cm.GetCount() < 10; i++) { - String id = dm.GetKey(i); - int q = sfi.defined_macros.Find(id); - if(q < 0 || sfi.defined_macros[q] != dm[i]) - cm.Add(id); - if(q >= 0) - found[q] = true; - } - for(int i = 0; i < sfi.defined_macros.GetCount() && cm.GetCount() < 10; i++) - if(!found[i]) - cm.Add(sfi.defined_macros.GetKey(i)); - } - sfi.defined_macros = pick(dm); - } - } StringStream pin(cpp.output); Parser p; p.Do(pin, CodeBase(), file, filetype, GetFileName(path), error, Vector(), cpp.namespace_stack, cpp.namespace_using); - if(sfi.defined_namespace_info != p.namespace_info) { - sfi.defined_namespace_info = p.namespace_info; - namespace_info_changed = true; - } - if(cpp.includes != sfi.includes) { - sfi.includes = cpp.includes; - includes_changed = true; - } - return cm; } for(int i = 0; i < pp.GetCount(); i++) { @@ -380,20 +337,9 @@ Vector ParseSrc(Stream& in, int file, Callback2 erro p.Do(pin, CodeBase(), file, filetype, GetFileName(path), error, Vector(), cpp.namespace_stack, cpp.namespace_using); } - return cm; } -bool HasIntersection(const Index& ids, const Vector& cm) -{ - if(cm.GetCount() >= 10) - return true; - for(int i = 0; i < cm.GetCount(); i++) - if(ids.Find(cm[i]) >= 0) - return true; - return false; -} - -void CodeBaseScanFile(Stream& in, const String& fn, bool check_macros) +void CodeBaseScanFile0(Stream& in, const String& fn) { LLOG("===== CodeBaseScanFile " << fn); @@ -405,23 +351,29 @@ void CodeBaseScanFile(Stream& in, const String& fn, bool check_macros) int file = GetSourceFileIndex(fn); CppBase& base = CodeBase(); base.RemoveFile(file); - SourceFileInfo& f = source_file[file]; - bool namespace_info_changed = false; - bool includes_changed = false; - Vector cm = ParseSrc(in, file, CNULL, check_macros, true, - namespace_info_changed, includes_changed); - LDUMP(f.defined_macros); - LDUMP(check_macros); - if(check_macros && (includes_changed || namespace_info_changed || cm.GetCount())) - SyncCodeBase(); - else - FinishCodeBase(); + ParseSrc(in, file, CNULL); } -void CodeBaseScanFile(const String& fn, bool check_macros) +void CodeBaseScanFile(Stream& in, const String& fn) { + CodeBaseScanFile0(in, fn); + FinishCodeBase(); +} + +void CodeBaseScanFile(const String& fn) +{ + LLOG("CodeBaseScanFile " << fn); FileIn in(fn); - CodeBaseScanFile(in, fn, check_macros); + CodeBaseScanFile(in, fn); + int file = GetSourceFileIndex(fn); + SourceFileInfo& f = source_file[file]; + String md5sum = GetPPFile(fn).md5sum; + if(md5sum != f.md5sum) { + SyncCodeBase(); + f.md5sum = md5sum; + } + else + FinishCodeBase(); } void ClearCodeBase() diff --git a/uppsrc/ide/Browser/Browser.h b/uppsrc/ide/Browser/Browser.h index 16be4570f..d5081606c 100644 --- a/uppsrc/ide/Browser/Browser.h +++ b/uppsrc/ide/Browser/Browser.h @@ -21,13 +21,8 @@ CppBase& CodeBase(); struct SourceFileInfo { Time time; bool check_info; // this is not special file, like .iml, .sch - Index ids; // all identifiers in the file - String included_id_macros; // included macros from ids set - String namespace_info; // namespace defined at the start of file - String using_info; // using namespace info at the start of file - VectorMap defined_macros; // macros defined by the file (to detect changes) - String defined_namespace_info; // set of usings and namespaces in the file (to detect changes) - String includes; // includes in the file (to detect changes) + String dependencies_md5sum; // dependencies from other files - usings, initial namespace, macros + String md5sum; // preprocessing 'fingerprint' to detect changes Vector depends; // indicies of file this files depends on, for time-check Time depends_time; @@ -37,11 +32,9 @@ struct SourceFileInfo { }; void NewCodeBase(); -Vector ParseSrc(Stream& in, int file, Callback2 error, - bool do_macros, bool get_changes, - bool& namespace_info_changed, bool& includes_changed); -void CodeBaseScanFile(Stream& in, const String& fn, bool check_macros); -void CodeBaseScanFile(const String& fn, bool check_macros); +void ParseSrc(Stream& in, int file, Callback2 error); +void CodeBaseScanFile(Stream& in, const String& fn); +void CodeBaseScanFile(const String& fn); void ClearCodeBase(); // void CheckCodeBase(); void RescanCodeBase(); diff --git a/uppsrc/ide/Cpp.cpp b/uppsrc/ide/Cpp.cpp index b20cfb44f..22479feb1 100644 --- a/uppsrc/ide/Cpp.cpp +++ b/uppsrc/ide/Cpp.cpp @@ -121,7 +121,7 @@ void AssistEditor::Context(Parser& parser, int pos) { LTIMING("Context"); - theide->ScanFile(false); + theide->ScanFile(); String s = Get(0, pos); StringStream ss(s); diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index eba98b52e..1f7067b28 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -881,7 +881,7 @@ public: void SearchCode(); void Goto(); void GotoGlobal(); - void ScanFile(bool check_macros); + void ScanFile(); bool SwapSIf(const char *cref); void SwapS(); void FindId(const String& id); diff --git a/uppsrc/ide/idefile.cpp b/uppsrc/ide/idefile.cpp index 84c37ae4f..bac2c3465 100644 --- a/uppsrc/ide/idefile.cpp +++ b/uppsrc/ide/idefile.cpp @@ -208,12 +208,12 @@ bool Ide::IsProjectFile(const String& f) const return false; } -void Ide::ScanFile(bool check_macros) +void Ide::ScanFile() { if(IsCppBaseFile()) { String s = ~editor; StringStream ss(s); - CodeBaseScanFile(ss, editfile, check_macros); + CodeBaseScanFile(ss, editfile); } } @@ -274,7 +274,7 @@ void Ide::SaveFile0(bool always) if(tm != FileGetTime(fn)) TouchFile(fn); if(IsProjectFile(fn) && ToUpper(GetFileExt(fn)) == ".LAY") - CodeBaseScanFile(fn, true); + CodeBaseScanFile(fn); return; } @@ -380,7 +380,8 @@ void Ide::SaveFile0(bool always) if(editor.IsDirty()) { text_updated.Kill(); - ScanFile(true); + if(IsCppBaseFile()) + CodeBaseScanFile(editfile); } editor.ClearDirty(); @@ -571,7 +572,7 @@ void Ide::EditFile0(const String& path, byte charset, bool astext, const String& void Ide::EditFileAssistSync() { - ScanFile(false); + ScanFile(); editor.Annotate(editfile); editor.SyncNavigator(); } @@ -690,7 +691,7 @@ void Ide::CheckFileUpdate() "Reload", "Keep")) return; if(IsCppBaseFile()) - CodeBaseScanFile(editfile, false); + CodeBaseScanFile(editfile); ReloadFile(); }