[PATCH] D74515: Add coding standard recommending use of qualifiers in cpp files

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 18:37:54 PST 2020


rjmccall added inline comments.


================
Comment at: llvm/docs/CodingStandards.rst:789
+declaration. In C++, this would declare a new overload of ``llvm::foo``, for
+example:
+
----------------
Consider this:

> Doing this helps to avoid bugs where the definition does not
> match the declaration from the header.  For example, the following
> C++ code defines a new overload of `llvm::foo` instead of providing
> a definition for the existing function declared in the header:
>
> <example>
>
> This error will not be caught until the build is nearly complete, when
> the linker fails to find a definition for any uses of the original function.
> If the function were instead defined with a namespace qualifier, the
> error would have been caught immediately when the definition was
> compiled.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74515/new/

https://reviews.llvm.org/D74515





More information about the llvm-commits mailing list