cmSourceFile: Change parameter to string_view

This commit is contained in:
John Franklin Rickard
2026-02-06 12:27:12 -05:00
committed by Brad King
parent c3c3b10d60
commit f53296147f
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -282,14 +282,14 @@ void cmSourceFile::CheckExtension()
}
}
void cmSourceFile::CheckLanguage(std::string const& ext)
void cmSourceFile::CheckLanguage(cm::string_view ext)
{
// Try to identify the source file language from the extension.
cmMakefile const* mf = this->Location.GetMakefile();
cmGlobalGenerator* gg = mf->GetGlobalGenerator();
std::string l = gg->GetLanguageFromExtension(ext);
if (!l.empty()) {
this->Language = l;
this->Language = std::move(l);
}
}
+3 -1
View File
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
#include <cm/string_view>
#include "cmCustomCommand.h"
#include "cmListFileCache.h"
#include "cmPropertyMap.h"
@@ -200,7 +202,7 @@ private:
bool FindFullPath(std::string* error, std::string* cmp0115Warning);
void CheckExtension();
void CheckLanguage(std::string const& ext);
void CheckLanguage(cm::string_view ext);
static std::string const propLANGUAGE;
static std::string const propLOCATION;