From 2108f7a243a5018b4ffc09bcbc2a8bdbe3c9a4d1 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 1 Jun 2022 17:04:58 -0700 Subject: [PATCH] [Object] Fix namespace style issues in D122069 https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions --- llvm/lib/Object/OffloadBinary.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/llvm/lib/Object/OffloadBinary.cpp b/llvm/lib/Object/OffloadBinary.cpp index f57d07c39023..498a991209bd 100644 --- a/llvm/lib/Object/OffloadBinary.cpp +++ b/llvm/lib/Object/OffloadBinary.cpp @@ -14,9 +14,8 @@ #include "llvm/Object/Error.h" #include "llvm/Support/FileOutputBuffer.h" -namespace llvm { - -namespace object { +using namespace llvm; +using namespace llvm::object; Expected> OffloadBinary::create(MemoryBufferRef Buf) { @@ -94,7 +93,7 @@ OffloadBinary::write(const OffloadingImage &OffloadingData) { return MemoryBuffer::getMemBufferCopy(OS.str()); } -OffloadKind getOffloadKind(StringRef Name) { +OffloadKind object::getOffloadKind(StringRef Name) { return llvm::StringSwitch(Name) .Case("openmp", OFK_OpenMP) .Case("cuda", OFK_Cuda) @@ -102,7 +101,7 @@ OffloadKind getOffloadKind(StringRef Name) { .Default(OFK_None); } -StringRef getOffloadKindName(OffloadKind Kind) { +StringRef object::getOffloadKindName(OffloadKind Kind) { switch (Kind) { case OFK_OpenMP: return "openmp"; @@ -115,7 +114,7 @@ StringRef getOffloadKindName(OffloadKind Kind) { } } -ImageKind getImageKind(StringRef Name) { +ImageKind object::getImageKind(StringRef Name) { return llvm::StringSwitch(Name) .Case("o", IMG_Object) .Case("bc", IMG_Bitcode) @@ -125,7 +124,7 @@ ImageKind getImageKind(StringRef Name) { .Default(IMG_None); } -StringRef getImageKindName(ImageKind Kind) { +StringRef object::getImageKindName(ImageKind Kind) { switch (Kind) { case IMG_Object: return "o"; @@ -141,7 +140,3 @@ StringRef getImageKindName(ImageKind Kind) { return ""; } } - -} // namespace object - -} // namespace llvm