We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a10d3a3 commit 2e67588Copy full SHA for 2e67588
bindgen/visitor/TreeVisitor.cpp
@@ -175,7 +175,15 @@ bool TreeVisitor::VisitVarDecl(clang::VarDecl *varDecl) {
175
std::shared_ptr<Location> TreeVisitor::getLocation(clang::Decl *decl) {
176
clang::SourceManager &sm = astContext->getSourceManager();
177
std::string filename = std::string(sm.getFilename(decl->getLocation()));
178
- std::string path = realpath(filename.c_str(), nullptr);
+ char *p = realpath(filename.c_str(), nullptr);
179
+ std::string path;
180
+ if (p) {
181
+ path = p;
182
+ delete[] p;
183
+ } else {
184
+ // TODO: check when it happens
185
+ path = "";
186
+ }
187
188
unsigned lineNumber = sm.getSpellingLineNumber(decl->getLocation());
189
return std::make_shared<Location>(path, lineNumber);
0 commit comments