summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeCompletionStrings.cpp
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-10-20 15:30:37 +0000
committerSam McCall <sam.mccall@gmail.com>2018-10-20 15:30:37 +0000
commitc008af646620f6718384c2cd95f58a7311fe10fb (patch)
tree4961c6079af876f19462df09f9a0d0fa1176a824 /clang-tools-extra/clangd/CodeCompletionStrings.cpp
parent0c35aa114d34c4f8add2a532de3a797ef0c1b667 (diff)
downloadbcm5719-llvm-c008af646620f6718384c2cd95f58a7311fe10fb.tar.gz
bcm5719-llvm-c008af646620f6718384c2cd95f58a7311fe10fb.zip
[clangd] Namespace style cleanup in cpp files. NFC.
Standardize on the most common namespace setup in our *.cpp files: using namespace llvm; namespace clang { namespace clangd { void foo(StringRef) { ... } And remove redundant llvm:: qualifiers. (Except for cases like make_unique where this causes problems with std:: and ADL). This choice is pretty arbitrary, but some broad consistency is nice. This is going to conflict with everything. Sorry :-/ Squash the other configurations: A) using namespace llvm; using namespace clang; using namespace clangd; void clangd::foo(StringRef); This is in some of the older files. (It prevents accidentally defining a new function instead of one in the header file, for what that's worth). B) namespace clang { namespace clangd { void foo(llvm::StringRef) { ... } This is fine, but in practice the using directive often gets added over time. C) namespace clang { namespace clangd { using namespace llvm; // inside the namespace This was pretty common, but is a bit misleading: name lookup preferrs clang::clangd::foo > clang::foo > llvm:: foo (no matter where the using directive is). llvm-svn: 344850
Diffstat (limited to 'clang-tools-extra/clangd/CodeCompletionStrings.cpp')
-rw-r--r--clang-tools-extra/clangd/CodeCompletionStrings.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang-tools-extra/clangd/CodeCompletionStrings.cpp b/clang-tools-extra/clangd/CodeCompletionStrings.cpp
index 21db26e0808..4381b437c2f 100644
--- a/clang-tools-extra/clangd/CodeCompletionStrings.cpp
+++ b/clang-tools-extra/clangd/CodeCompletionStrings.cpp
@@ -14,9 +14,9 @@
#include "clang/Basic/SourceManager.h"
#include <utility>
+using namespace llvm;
namespace clang {
namespace clangd {
-
namespace {
bool isInformativeQualifierChunk(CodeCompletionString::Chunk const &Chunk) {
@@ -24,7 +24,7 @@ bool isInformativeQualifierChunk(CodeCompletionString::Chunk const &Chunk) {
StringRef(Chunk.Text).endswith("::");
}
-void appendEscapeSnippet(const llvm::StringRef Text, std::string *Out) {
+void appendEscapeSnippet(const StringRef Text, std::string *Out) {
for (const auto Character : Text) {
if (Character == '$' || Character == '}' || Character == '\\')
Out->push_back('\\');
@@ -32,13 +32,13 @@ void appendEscapeSnippet(const llvm::StringRef Text, std::string *Out) {
}
}
-bool looksLikeDocComment(llvm::StringRef CommentText) {
+bool looksLikeDocComment(StringRef CommentText) {
// We don't report comments that only contain "special" chars.
// This avoids reporting various delimiters, like:
// =================
// -----------------
// *****************
- return CommentText.find_first_not_of("/*-= \t\r\n") != llvm::StringRef::npos;
+ return CommentText.find_first_not_of("/*-= \t\r\n") != StringRef::npos;
}
} // namespace
@@ -56,7 +56,7 @@ std::string getDocComment(const ASTContext &Ctx,
}
std::string getDeclComment(const ASTContext &Ctx, const NamedDecl &Decl) {
- if (llvm::isa<NamespaceDecl>(Decl)) {
+ if (isa<NamespaceDecl>(Decl)) {
// Namespaces often have too many redecls for any particular redecl comment
// to be useful. Moreover, we often confuse file headers or generated
// comments with namespace comments. Therefore we choose to just ignore
@@ -146,7 +146,7 @@ void getSignature(const CodeCompletionString &CCS, std::string *Signature,
}
std::string formatDocumentation(const CodeCompletionString &CCS,
- llvm::StringRef DocComment) {
+ StringRef DocComment) {
// Things like __attribute__((nonnull(1,3))) and [[noreturn]]. Present this
// information in the documentation field.
std::string Result;
OpenPOWER on IntegriCloud