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;
50
50
51
51
const Settings SimpleTokenizer::s_settings;
52
52
53
+ std::set<std::string> ScopedFile::s_scopedfiles;
54
+
53
55
// TODO: better path-only usage
54
56
ScopedFile::ScopedFile (std::string name, const std::string &content, std::string path)
55
57
: mName(std::move(name))
56
58
, mPath(Path::toNativeSeparators(std::move(path)))
57
59
, mFullPath(Path::join(mPath , mName ))
58
60
{
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
+
59
69
if (!mPath .empty () && mPath != Path::getCurrentPath ()) {
60
70
if (Path::isDirectory (mPath ))
61
71
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 {
157
157
const std::string mName ;
158
158
const std::string mPath ;
159
159
const std::string mFullPath ;
160
+
161
+ static std::set<std::string> s_scopedfiles;
160
162
};
161
163
162
164
class PreprocessorHelper
You can’t perform that action at this time.
0 commit comments