alexfh added inline comments.

================
Comment at: clang-tidy/misc/LambdaFunctionNameCheck.cpp:61-62
+void LambdaFunctionNameCheck::registerPPCallbacks(CompilerInstance &Compiler) {
+  Compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(
+      new MacroExpansionsWithFileAndLine(&SuppressMacroExpansions)));
+}
----------------
`llvm::make_unique<MacroExpansionsWithFileAndLine>(...)`


================
Comment at: clang-tidy/misc/LambdaFunctionNameCheck.cpp:67-68
+  const auto *E = Result.Nodes.getNodeAs<PredefinedExpr>("E");
+  if (E->getIdentType() == PredefinedExpr::Func ||
+      E->getIdentType() == PredefinedExpr::Function) {
+    if (E->getLocation().isMacroID()) {
----------------
nit: I'd use the early return style here.


================
Comment at: clang-tidy/misc/LambdaFunctionNameCheck.cpp:73-74
+      SourceRange AsRange(ER.first, ER.second);
+      for (const auto& R : SuppressMacroExpansions) {
+        if (R == AsRange) {
+          // This is a macro expansion for which we should not warn.
----------------
I'm afraid this can become extremely slow on large files with 
boilerplate/generated code. Since the code is just looking for exact matches 
(and not any overlapping ranges, for example), we could replace the vector with 
a (hash?) map to limit the worst case complexity.


https://reviews.llvm.org/D33497



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to