Details
Diff Detail
Event Timeline
include-fixer/find-all-symbols/FindAllSymbols.cpp | ||
---|---|---|
204–213 | It seems weird to add this and just forward the interface. | |
include-fixer/find-all-symbols/FindAllSymbols.h | ||
50 | I think the fact that those are generated via IWYU comments are an implementation detail, and this code doesn't care. Perhaps call it HeaderMapping or HeaderRemapping. Also, it's unclear what the semantics are, so I think this needs a comment. | |
include-fixer/find-all-symbols/PragmaCommentHandler.h | ||
24 | I'd pull out an interface like HeaderMapCollector or ForwardingHeaderCollector, or even just pass in a std::function that collects the header. Or, just make this PragmaCommentHandler have a method to return a list of forwarding headers? |
Re semantics, you may want to link to IWYU's docs at
https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md
.
- Kim
Den 3 maj 2016 6:34 em skrev "Manuel Klimek via cfe-commits" <
cfe-commits@lists.llvm.org>:
klimek added inline comments.
Comment at: include-fixer/find-all-symbols/FindAllSymbols.cpp:173-182
@@ -165,1 +172,12 @@+void FindAllSymbols::addPragmaHeader(FileID ID, llvm::StringRef FilePath)
{
+ PragmaHeaderMap[ID] = FilePath;
+}
+
+llvm::Optional<std::string> FindAllSymbols::getPragmaHeader(FileID ID)
const {
+ auto It = PragmaHeaderMap.find(ID);
+ if (It == PragmaHeaderMap.end())
+ return llvm::None;
+ return It->second;
+}+
It seems weird to add this and just forward the interface.
Comment at: include-fixer/find-all-symbols/FindAllSymbols.h:49
@@ -45,1 +48,3 @@+ void addPragmaHeader(FileID ID, llvm::StringRef FilePath);
+
I think the fact that those are generated via IWYU comments are an
implementation detail, and this code doesn't care. Perhaps call it
HeaderMapping or HeaderRemapping. Also, it's unclear what the semantics
are, so I think this needs a comment.Comment at: include-fixer/find-all-symbols/PragmaCommentHandler.h:23
@@ +22,3 @@
+public:
+ PragmaCommentHandler(FindAllSymbols *Matcher) : Matcher(Matcher) {}+
I'd pull out an interface like HeaderMapCollector or
ForwardingHeaderCollector, or even just pass in a std::function that
collects the header. Or, just make this PragmaCommentHandler have a method
to return a list of forwarding headers?
Generally, I think this couples the two classes much more than necessary.Repository:
rL LLVMhttp://reviews.llvm.org/D19816
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
include-fixer/find-all-symbols/FindAllSymbols.h | ||
---|---|---|
45 | I'd pass in the HeaderMap here. | |
include-fixer/find-all-symbols/PragmaCommentHandler.h | ||
23 | "PragmaCommentHandler handle all pragma comment" Perhaps: | |
unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp | ||
374 | Any reason for the extra block here? |
Update.
unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp | ||
---|---|---|
374 | Because I want to keep consistence with other test cases here. |
unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp | ||
---|---|---|
374 | Why are the other test cases using an extra block? |
include-fixer/find-all-symbols/PragmaCommentHandler.cpp | ||
---|---|---|
28 | Oh, didn't notice that. Yeah, we can use the find to handle the case.for now. |
LG with nit to fix.
include-fixer/find-all-symbols/FindAllSymbols.h | ||
---|---|---|
44–45 | Add a comment describing what the Collector is for. |
No space between #includes in LLVM.