[PATCH] Added code-completion results to override virtual methods from base class
Richard Smith
richard at metafoo.co.uk
Thu Apr 4 14:10:20 PDT 2013
================
Comment at: lib/Sema/SemaCodeComplete.cpp:1300
@@ +1299,3 @@
+ ConsumedMethods.insert(MD->getName());
+ unsigned priority = CCP_MemberDeclaration;
+ if (MD->isPure())
----------------
Per coding style, this should be named Priority
================
Comment at: lib/Sema/SemaCodeComplete.cpp:1292-1293
@@ +1291,4 @@
+
+ if (!IsCollectPass) {
+ if (MD->getAttr<FinalAttr>() || !InBaseClass)
+ ConsumedMethods.insert(MD->getName());
----------------
Please use 2 space indent.
================
Comment at: lib/Sema/SemaCodeComplete.cpp:1283
@@ +1282,3 @@
+ {
+ IsCollectPass = true;
+ }
----------------
Please use 2 space indent.
================
Comment at: lib/Sema/SemaCodeComplete.cpp:3290-3291
@@ +3289,4 @@
+ Results.setFilter(&ResultBuilder::IsOrdinaryNonValueName);
+ }
+ break;
+
----------------
Please put the 'break' inside the braces.
================
Comment at: include/clang/Sema/CodeCompleteConsumer.h:104
@@ +103,3 @@
+ /// \brief Divide by this factor when a code-completion will override
+ /// pure virtual method rather than just virtual
+ CCF_OverridePureVirtual = 2
----------------
Missing full stop.
================
Comment at: lib/Sema/SemaCodeComplete.cpp:1281-1282
@@ +1280,4 @@
+
+ void StartCollectPass()
+ {
+ IsCollectPass = true;
----------------
Open brace on same line as function declaration, please.
================
Comment at: lib/Sema/SemaCodeComplete.cpp:3286
@@ +3285,3 @@
+ OverridableMethodDeclConsumer Consumer(Results, CurContext);
+ LookupVisibleDecls(S, LookupMemberName, Consumer, false);
+ Consumer.StartCollectPass();
----------------
Rather than using name lookup / VisibleDeclConsumer here, could you use CXXRecordDecl::getFinalOverriders?
================
Comment at: lib/Sema/SemaCodeComplete.cpp:1294
@@ +1293,3 @@
+ if (MD->getAttr<FinalAttr>() || !InBaseClass)
+ ConsumedMethods.insert(MD->getName());
+ return;
----------------
This won't correctly handle multiple declarations with the same name, and will assert on declarations with non-identifier names.
http://llvm-reviews.chandlerc.com/D622
More information about the cfe-commits
mailing list