This is an archive of the discontinued LLVM Phabricator instance.

Comment parsing: Specify argument numbers for some block commands
ClosedPublic

Authored by aaronpuchert on May 11 2022, 2:11 PM.

Details

Summary

The command traits have a member NumArgs for which all the parsing
infrastructure is in place, but no command was setting it to a value
other than 0. By doing so we get warnings when passing an empty
paragraph to \retval (the first argument is the return value, then comes
the description). We also take \xrefitem along for the ride, although as
the documentation states it's unlikely to be used directly.

Diff Detail

Event Timeline

aaronpuchert created this revision.May 11 2022, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2022, 2:11 PM
aaronpuchert requested review of this revision.May 11 2022, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2022, 2:11 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
gribozavr2 accepted this revision.May 11 2022, 4:09 PM
This revision is now accepted and ready to land.May 11 2022, 4:09 PM

Add an AST test to check that we parse the arguments correctly. (We don't use them for diagnostics currently.)

This revision was landed with ongoing or failed builds.May 13 2022, 4:49 AM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.May 13 2022, 6:40 AM

Hello,

one of your three commits in https://github.com/llvm/llvm-project/compare/562ce1592456...d2396d896ee1 broke building on mac:

Please take a look, and revert for now if it takes a while to fix.

(Here's the error:

In file included from ../../clang/lib/AST/CommentParser.cpp:9:
In file included from ../../clang/include/clang/AST/CommentParser.h:16:
In file included from ../../clang/include/clang/AST/Comment.h:17:
In file included from ../../clang/include/clang/AST/DeclObjC.h:16:
In file included from ../../clang/include/clang/AST/Decl.h:19:
In file included from ../../clang/include/clang/AST/DeclBase.h:18:
In file included from ../../clang/include/clang/AST/DeclarationName.h:16:
In file included from ../../clang/include/clang/AST/Type.h:21:
In file included from ../../clang/include/clang/AST/NestedNameSpecifier.h:18:
../../clang/include/clang/Basic/Diagnostic.h:1353:8: error: use of overloaded operator '<<' is ambiguous (with operand types 'const clang::StreamingDiagnostic' and 'typename remove_reference<unsigned long &>::type' (aka 'unsigned long'))
    DB << std::move(V);
    ~~ ^  ~~~~~~~~~~~~
../../clang/lib/AST/CommentParser.cpp:417:57: note: in instantiation of function template specialization 'clang::DiagnosticBuilder::operator<<<unsigned long, void>' requested here
        << CommandTok.is(tok::at_command) << Info->Name << Args.size()
                                                        ^
../../clang/include/clang/Basic/Diagnostic.h:1400:35: note: candidate function
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                  ^
../../clang/include/clang/Basic/Diagnostic.h:1406:35: note: candidate function
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                  ^
../../clang/include/clang/Basic/Diagnostic.h:1422:35: note: candidate function
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                  ^
../../clang/include/clang/Basic/Diagnostic.h:1428:35: note: candidate function
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                  ^
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, unsigned long)
    DB << std::move(V);
       ^
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, int)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, long long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, __int128)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, unsigned int)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, unsigned long long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(int, unsigned __int128)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(long, unsigned long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(long long, unsigned long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(__int128, unsigned long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(unsigned int, unsigned long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(unsigned long, unsigned long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(unsigned long long, unsigned long)
../../clang/include/clang/Basic/Diagnostic.h:1353:8: note: built-in candidate operator<<(unsigned __int128, unsigned long)

)

Looking at that error some more, it must've been D125429. Moving the comment over there, sorry for the noise.