diff --git a/uppsrc/ide/Builders/Build.h b/uppsrc/ide/Builders/Build.h index 66c2354c9..bf3426082 100644 --- a/uppsrc/ide/Builders/Build.h +++ b/uppsrc/ide/Builders/Build.h @@ -25,8 +25,6 @@ String NoCr(const char *s); int CharFilterSlash(int c); String GetDefaultMethod(); -String GetMethodName(const String& method); -String GetMethodPath(const String& method); VectorMap GetMethodVars(const String& method); String MainConf(const Workspace& wspc, String& add_includes); diff --git a/uppsrc/ide/Builders/ClangTidy.cpp b/uppsrc/ide/Builders/ClangTidy.cpp index b1389f3e9..c329f6382 100644 --- a/uppsrc/ide/Builders/ClangTidy.cpp +++ b/uppsrc/ide/Builders/ClangTidy.cpp @@ -9,6 +9,9 @@ Index ClangTidy::active_checks; bool ClangTidy::HasClangTidy() { + if(!TheIdeContext()) + return false; // so that GetMethodVars returns something real... + ONCELOCK { #ifdef PLATFORM_WIN32 for(String p : Split(GetMethodVars("CLANGx64").Get("PATH", ""), ';')) { @@ -34,9 +37,10 @@ bool ClangTidy::HasClangTidy() groups.FindAdd(s); } Load(ClangTidyConfigPath()); - goto exit; // break not compatible with POSIX / ONCELOCK +#ifdef PLATFORM_WIN32 + break; +#endif } - #ifdef PLATFORM_WIN32 } #endif diff --git a/uppsrc/ide/ClangTidy.cpp b/uppsrc/ide/ClangTidy.cpp index 2d9777173..473214289 100644 --- a/uppsrc/ide/ClangTidy.cpp +++ b/uppsrc/ide/ClangTidy.cpp @@ -138,7 +138,7 @@ void Ide::ClangTidy(Gate what) return; } - MakeBuild *mb = dynamic_cast(TheIdeContext()); // TODO: Move to Builders/umk + MakeBuild *mb = dynamic_cast(TheIdeContext()); if(!mb) return; @@ -170,28 +170,4 @@ void Ide::ClangTidy(Gate what) EndBuilding(true); SetErrorEditor(); - -/* - String files; - for(const String& f : ResolveFiles(sc, ccjpath, paths)) - path << "\"" << f << "\" "; - - if(IsNull(v)) - return sExeFilePath + " --checks=* " + path; - - String checks = Nvl(v["checks"], "*"); - String extraargs = Nvl(v["extra_args"], ""); - String standard = Nvl(v["standard"], "c++14"); - - String s; - s << sExeFilePath << " " - << "--checks=\"" << checks << "\" " - << "--quiet "; - - if(FileExists(ccjpath)) - s << "-p=\"" << ccjdir << "\" "; - - return s + extraargs + (extraargs.GetCount() ? " " : "") + path - + (FileExists(ccjpath) ? "" : "-- -std=" + standard); -*/ } diff --git a/uppsrc/ide/Core/Core.h b/uppsrc/ide/Core/Core.h index 16c2d1657..a19e5165b 100644 --- a/uppsrc/ide/Core/Core.h +++ b/uppsrc/ide/Core/Core.h @@ -56,21 +56,21 @@ class PPInfo { bool guarded = false; // has include guards int blitz = 0; // AUTO, APPROVED, PROHIBITED Time time = Null; // file time - + bool dirty = true; // need to be rechecked for change (filetime) - + void Dirty() { dirty = true; time = Null; } void Parse(Stream& in); void Serialize(Stream& s); }; - + struct Dir : Moveable { Index subdirs; VectorMap files; - + void Load(const String& dir); }; - + ArrayMap files; Vector includes; // include dirs int includes_base_count; // for trimming out additional includes @@ -94,7 +94,7 @@ public: void SetIncludes(Vector&& includes); void SetIncludes(const String& includes); - + void BaseIncludes(); void AddInclude(const String& include); @@ -114,7 +114,7 @@ public: bool speculative = true); Time GetTime(const String& path, VectorMap *ret_result = nullptr); - + const VectorMap& GetFileDefines(const String& path) { return File(NormalizePath(path)).all_defines; } const VectorMap& GetFileFlags(const String& path) { return File(NormalizePath(path)).flags; } @@ -156,7 +156,7 @@ public: virtual bool IdeConsoleWait() = 0; virtual bool IdeConsoleWait(int slot) = 0; virtual void IdeConsoleOnFinish(Event<> cb) = 0; - + virtual void IdeProcessEvents() = 0; virtual bool IdeIsDebug() const = 0; @@ -184,6 +184,8 @@ public: virtual String IdeGetIncludePath() = 0; virtual String GetDefaultMethod(); + virtual VectorMap GetMethodVars(const String& method); + virtual String GetMethodName(const String& method); virtual bool IsPersistentFindReplace() = 0; @@ -568,16 +570,16 @@ struct Builder { Index pkg_config; // names of packages for pkg-config Vector CINC; Vector Macro; - + String cc_inc; // for AddCommands only VectorMap tmpfilei; // for naming automatic response files VectorMap dependencies; // dependencies of the last HdependFileTime call - + static VectorMap cmdx_cache; // caching e.g. pkg-config String CmdX(const char *s); - + Time HdependFileTime(const String& path); virtual bool BuildPackage(const String& package, Vector& linkfile, Vector& immfile, @@ -688,7 +690,7 @@ enum { ITEM_SIGN, ITEM_UPP, ITEM_TYPE, - + ITEM_PTYPE = ITEM_TYPE + 10000, }; diff --git a/uppsrc/ide/Core/Ide.cpp b/uppsrc/ide/Core/Ide.cpp index afe9f1c7f..afa1445b7 100644 --- a/uppsrc/ide/Core/Ide.cpp +++ b/uppsrc/ide/Core/Ide.cpp @@ -39,26 +39,31 @@ String IdeContext::GetDefaultMethod() return LoadFile(ConfigFile("default_method")); } -String GetMethodName(const String& method) -{ - return method + ".bm"; -} - -VectorMap GetMethodVars(const String& method) +VectorMap IdeContext::GetMethodVars(const String& method) { VectorMap map; - LoadVarFile(GetMethodPath(method), map); + LoadVarFile(ConfigFile(GetMethodName(method)), map); return map; } +String IdeContext::GetMethodName(const String& method) +{ + return (String)~method + ".bm"; +} + String GetDefaultMethod() { return the_ide ? the_ide->GetDefaultMethod() : String(); } +VectorMap GetMethodVars(const String& method) +{ + return the_ide ? the_ide->GetMethodVars(method) : VectorMap(); +} + String GetMethodPath(const String& method) { - return ConfigFile(GetMethodName(method)); + return the_ide ? the_ide->GetMethodName(method) : String(); } bool IdeIsBuilding() @@ -233,4 +238,4 @@ void IdePutErrorLine(const String& s) { if(the_ide) the_ide->IdePutErrorLine(s); -} +} \ No newline at end of file