This commit is contained in:
Mirek Fidler 2026-07-23 13:20:04 +02:00
commit fe451cb7e7
5 changed files with 35 additions and 50 deletions

View file

@ -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<String, String> GetMethodVars(const String& method);
String MainConf(const Workspace& wspc, String& add_includes);

View file

@ -9,6 +9,9 @@ Index<String> 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

View file

@ -138,7 +138,7 @@ void Ide::ClangTidy(Gate<const String&> what)
return;
}
MakeBuild *mb = dynamic_cast<MakeBuild *>(TheIdeContext()); // TODO: Move to Builders/umk
MakeBuild *mb = dynamic_cast<MakeBuild *>(TheIdeContext());
if(!mb)
return;
@ -170,28 +170,4 @@ void Ide::ClangTidy(Gate<const String&> 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);
*/
}

View file

@ -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<Dir> {
Index<String> subdirs;
VectorMap<String, Time> files;
void Load(const String& dir);
};
ArrayMap<String, PPFile> files;
Vector<String> includes; // include dirs
int includes_base_count; // for trimming out additional includes
@ -94,7 +94,7 @@ public:
void SetIncludes(Vector<String>&& 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<String, Time> *ret_result = nullptr);
const VectorMap<String, String>& GetFileDefines(const String& path) { return File(NormalizePath(path)).all_defines; }
const VectorMap<String, String>& 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<String, String> GetMethodVars(const String& method);
virtual String GetMethodName(const String& method);
virtual bool IsPersistentFindReplace() = 0;
@ -568,16 +570,16 @@ struct Builder {
Index<String> pkg_config; // names of packages for pkg-config
Vector<String> CINC;
Vector<String> Macro;
String cc_inc; // for AddCommands only
VectorMap<String, int> tmpfilei; // for naming automatic response files
VectorMap<String, Time> dependencies; // dependencies of the last HdependFileTime call
static VectorMap<String, String> cmdx_cache; // caching e.g. pkg-config
String CmdX(const char *s);
Time HdependFileTime(const String& path);
virtual bool BuildPackage(const String& package, Vector<String>& linkfile, Vector<String>& immfile,
@ -688,7 +690,7 @@ enum {
ITEM_SIGN,
ITEM_UPP,
ITEM_TYPE,
ITEM_PTYPE = ITEM_TYPE + 10000,
};

View file

@ -39,26 +39,31 @@ String IdeContext::GetDefaultMethod()
return LoadFile(ConfigFile("default_method"));
}
String GetMethodName(const String& method)
{
return method + ".bm";
}
VectorMap<String, String> GetMethodVars(const String& method)
VectorMap<String, String> IdeContext::GetMethodVars(const String& method)
{
VectorMap<String, String> 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<String, String> GetMethodVars(const String& method)
{
return the_ide ? the_ide->GetMethodVars(method) : VectorMap<String, String>();
}
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);
}
}