File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,22 @@ class SuppressionList;
5050
5151const Settings SimpleTokenizer::s_settings;
5252
53+ std::set<std::string> ScopedFile::s_scopedfiles;
54+
5355// TODO: better path-only usage
5456ScopedFile::ScopedFile (std::string name, const std::string &content, std::string path)
5557 : mName(std::move(name))
5658 , mPath(Path::toNativeSeparators(std::move(path)))
5759 , mFullPath(Path::join(mPath , mName ))
5860{
61+ if (mPath .empty () && mName .empty ()) {
62+ throw std::runtime_error (" ScopedFile(" + mFullPath + " ) - no file specified" );
63+ }
64+
65+ if (!s_scopedfiles.emplace (mFullPath ).second ) {
66+ throw std::runtime_error (" ScopedFile(" + mFullPath + " ) - file not unique" );
67+ }
68+
5969 if (!mPath .empty () && mPath != Path::getCurrentPath ()) {
6070 if (Path::isDirectory (mPath ))
6171 throw std::runtime_error (" ScopedFile(" + mFullPath + " ) - directory already exists" );
Original file line number Diff line number Diff line change @@ -157,6 +157,8 @@ class ScopedFile {
157157 const std::string mName ;
158158 const std::string mPath ;
159159 const std::string mFullPath ;
160+
161+ static std::set<std::string> s_scopedfiles;
160162};
161163
162164class PreprocessorHelper
You can’t perform that action at this time.
0 commit comments