danielmarjamaki added inline comments.
================
Comment at: lib/AST/ASTContext.cpp:1495
+ ASTUnit *Unit = nullptr;
+ StringRef ASTFileName;
+ auto FnUnitCacheEntry = FunctionAstUnitMap.find(MangledFnName);
----------------
As far as I see you can move this ASTFileName declaration down.
================
Comment at: lib/AST/ASTContext.cpp:1497
+ auto FnUnitCacheEntry = FunctionAstUnitMap.find(MangledFnName);
+ if (FnUnitCacheEntry == FunctionAstUnitMap.end()) {
+ if (FunctionFileMap.empty()) {
----------------
How about replacing FunctionAstUnitMap.find() with FunctionAstUnitMap.count()?
================
Comment at: lib/AST/ASTContext.cpp:1511
+ auto It = FunctionFileMap.find(MangledFnName);
+ if (It != FunctionFileMap.end())
+ ASTFileName = It->second;
----------------
As far as I see this can be changed to:
```
if (It == FunctionFileMap.end())
return nullptr;
const StringRef ASTFileName = It->second;
```
================
Comment at: tools/clang-func-mapping/ClangFnMapGen.cpp:48
+ : Ctx(Context), ItaniumCtx(MangleCtx) {}
+ std::string CurrentFileName;
+
----------------
As far I see CurrentFileName is only used in 1 method and should therefore be
private.
================
Comment at: tools/clang-func-mapping/ClangFnMapGen.cpp:86
+ SM.getFileEntryForID(SM.getMainFileID())->getName();
+ char *Path = realpath(SMgrName.str().c_str(), nullptr);
+ CurrentFileName = Path;
----------------
I believe realpath is a posix function.
https://reviews.llvm.org/D30691
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits