summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2015-08-06 01:01:12 +0000
committerEric Christopher <echristo@gmail.com>2015-08-06 01:01:12 +0000
commitb70ce903c2ac299a2bafc307e8096912cbc7c46f (patch)
tree3d34707df0c0cf83686b9daa6e72ad4e9e099370
parent371860374f5c907770aef56129c0ea7575e9079f (diff)
Rename the non-coding style conformant functions in namespace Builtins
to match the rest of their brethren and reformat the bits that need it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244186 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Builtins.h74
-rw-r--r--lib/AST/ASTContext.cpp2
-rw-r--r--lib/Basic/Builtins.cpp18
-rw-r--r--lib/CodeGen/CGBuiltin.cpp4
-rw-r--r--lib/CodeGen/CodeGenModule.cpp2
-rw-r--r--lib/Frontend/ChainedIncludesSource.cpp2
-rw-r--r--lib/Frontend/FrontendAction.cpp2
-rw-r--r--lib/Lex/Preprocessor.cpp2
-rw-r--r--lib/Sema/SemaChecking.cpp6
-rw-r--r--lib/Sema/SemaDecl.cpp10
-rw-r--r--lib/StaticAnalyzer/Core/CheckerContext.cpp2
11 files changed, 61 insertions, 63 deletions
diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h
index e8e97376a5..c5cf10ccf0 100644
--- a/include/clang/Basic/Builtins.h
+++ b/include/clang/Basic/Builtins.h
@@ -23,22 +23,22 @@
#undef alloca
namespace clang {
- class TargetInfo;
- class IdentifierTable;
- class ASTContext;
- class QualType;
- class LangOptions;
-
- enum LanguageID {
- GNU_LANG = 0x1, // builtin requires GNU mode.
- C_LANG = 0x2, // builtin for c only.
- CXX_LANG = 0x4, // builtin for cplusplus only.
- OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
- MS_LANG = 0x10, // builtin requires MS mode.
- ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
- ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
- ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.
- };
+class TargetInfo;
+class IdentifierTable;
+class ASTContext;
+class QualType;
+class LangOptions;
+
+enum LanguageID {
+ GNU_LANG = 0x1, // builtin requires GNU mode.
+ C_LANG = 0x2, // builtin for c only.
+ CXX_LANG = 0x4, // builtin for cplusplus only.
+ OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
+ MS_LANG = 0x10, // builtin requires MS mode.
+ ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
+ ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
+ ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.
+};
namespace Builtin {
enum ID {
@@ -62,90 +62,90 @@ public:
Context();
/// \brief Perform target-specific initialization
- void InitializeTarget(const TargetInfo &Target);
+ void initializeTarget(const TargetInfo &Target);
/// \brief Mark the identifiers for all the builtins with their
/// appropriate builtin ID # and mark any non-portable builtin identifiers as
/// such.
- void InitializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts);
+ void initializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts);
/// \brief Return the identifier name for the specified builtin,
/// e.g. "__builtin_abs".
- const char *GetName(unsigned ID) const {
- return GetRecord(ID).Name;
+ const char *getName(unsigned ID) const {
+ return getRecord(ID).Name;
}
/// \brief Get the type descriptor string for the specified builtin.
- const char *GetTypeString(unsigned ID) const {
- return GetRecord(ID).Type;
+ const char *getTypeString(unsigned ID) const {
+ return getRecord(ID).Type;
}
/// \brief Return true if this function has no side effects and doesn't
/// read memory.
bool isConst(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'c') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'c') != nullptr;
}
/// \brief Return true if we know this builtin never throws an exception.
bool isNoThrow(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'n') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'n') != nullptr;
}
/// \brief Return true if we know this builtin never returns.
bool isNoReturn(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'r') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'r') != nullptr;
}
/// \brief Return true if we know this builtin can return twice.
bool isReturnsTwice(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'j') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'j') != nullptr;
}
/// \brief Returns true if this builtin does not perform the side-effects
/// of its arguments.
bool isUnevaluated(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'u') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'u') != nullptr;
}
/// \brief Return true if this is a builtin for a libc/libm function,
/// with a "__builtin_" prefix (e.g. __builtin_abs).
bool isLibFunction(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'F') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'F') != nullptr;
}
/// \brief Determines whether this builtin is a predefined libc/libm
/// function, such as "malloc", where we know the signature a
/// priori.
bool isPredefinedLibFunction(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'f') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'f') != nullptr;
}
/// \brief Determines whether this builtin is a predefined compiler-rt/libgcc
/// function, such as "__clear_cache", where we know the signature a
/// priori.
bool isPredefinedRuntimeFunction(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'i') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'i') != nullptr;
}
/// \brief Determines whether this builtin has custom typechecking.
bool hasCustomTypechecking(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 't') != nullptr;
+ return strchr(getRecord(ID).Attributes, 't') != nullptr;
}
/// \brief Determines whether this builtin has a result or any arguments which
/// are pointer types.
bool hasPtrArgsOrResult(unsigned ID) const {
- return strchr(GetRecord(ID).Type, '*') != nullptr;
+ return strchr(getRecord(ID).Type, '*') != nullptr;
}
/// \brief Completely forget that the given ID was ever considered a builtin,
/// e.g., because the user provided a conflicting signature.
- void ForgetBuiltin(unsigned ID, IdentifierTable &Table);
+ void forgetBuiltin(unsigned ID, IdentifierTable &Table);
/// \brief If this is a library function that comes from a specific
/// header, retrieve that header name.
const char *getHeaderName(unsigned ID) const {
- return GetRecord(ID).HeaderName;
+ return getRecord(ID).HeaderName;
}
/// \brief Determine whether this builtin is like printf in its
@@ -163,14 +163,14 @@ public:
///
/// Such functions can be const when the MathErrno lang option is disabled.
bool isConstWithoutErrno(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'e') != nullptr;
+ return strchr(getRecord(ID).Attributes, 'e') != nullptr;
}
private:
- const Info &GetRecord(unsigned ID) const;
+ const Info &getRecord(unsigned ID) const;
/// \brief Is this builtin supported according to the given language options?
- bool BuiltinIsSupported(const Builtin::Info &BuiltinInfo,
+ bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
const LangOptions &LangOpts);
/// \brief Helper function for isPrintfLike and isScanfLike.
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index e17a9819bd..bc94bd0bb5 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -8118,7 +8118,7 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
QualType ASTContext::GetBuiltinType(unsigned Id,
GetBuiltinTypeError &Error,
unsigned *IntegerConstantArgs) const {
- const char *TypeStr = BuiltinInfo.GetTypeString(Id);
+ const char *TypeStr = BuiltinInfo.getTypeString(Id);
SmallVector<QualType, 8> ArgTypes;
diff --git a/lib/Basic/Builtins.cpp b/lib/Basic/Builtins.cpp
index 1d80e00152..4ca82f38aa 100644
--- a/lib/Basic/Builtins.cpp
+++ b/lib/Basic/Builtins.cpp
@@ -30,7 +30,7 @@ static const Builtin::Info BuiltinInfo[] = {
#include "clang/Basic/Builtins.def"
};
-const Builtin::Info &Builtin::Context::GetRecord(unsigned ID) const {
+const Builtin::Info &Builtin::Context::getRecord(unsigned ID) const {
if (ID < Builtin::FirstTSBuiltin)
return BuiltinInfo[ID];
assert(ID - Builtin::FirstTSBuiltin < NumTSRecords && "Invalid builtin ID!");
@@ -43,12 +43,12 @@ Builtin::Context::Context() {
NumTSRecords = 0;
}
-void Builtin::Context::InitializeTarget(const TargetInfo &Target) {
+void Builtin::Context::initializeTarget(const TargetInfo &Target) {
assert(NumTSRecords == 0 && "Already initialized target?");
Target.getTargetBuiltins(TSRecords, NumTSRecords);
}
-bool Builtin::Context::BuiltinIsSupported(const Builtin::Info &BuiltinInfo,
+bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
const LangOptions &LangOpts) {
bool BuiltinsUnsupported = LangOpts.NoBuiltin &&
strchr(BuiltinInfo.Attributes, 'f');
@@ -66,22 +66,22 @@ bool Builtin::Context::BuiltinIsSupported(const Builtin::Info &BuiltinInfo,
/// InitializeBuiltins - Mark the identifiers for all the builtins with their
/// appropriate builtin ID # and mark any non-portable builtin identifiers as
/// such.
-void Builtin::Context::InitializeBuiltins(IdentifierTable &Table,
+void Builtin::Context::initializeBuiltins(IdentifierTable &Table,
const LangOptions& LangOpts) {
// Step #1: mark all target-independent builtins with their ID's.
for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
- if (BuiltinIsSupported(BuiltinInfo[i], LangOpts)) {
+ if (builtinIsSupported(BuiltinInfo[i], LangOpts)) {
Table.get(BuiltinInfo[i].Name).setBuiltinID(i);
}
// Step #2: Register target-specific builtins.
for (unsigned i = 0, e = NumTSRecords; i != e; ++i)
- if (BuiltinIsSupported(TSRecords[i], LangOpts))
+ if (builtinIsSupported(TSRecords[i], LangOpts))
Table.get(TSRecords[i].Name).setBuiltinID(i+Builtin::FirstTSBuiltin);
}
-void Builtin::Context::ForgetBuiltin(unsigned ID, IdentifierTable &Table) {
- Table.get(GetRecord(ID).Name).setBuiltinID(0);
+void Builtin::Context::forgetBuiltin(unsigned ID, IdentifierTable &Table) {
+ Table.get(getRecord(ID).Name).setBuiltinID(0);
}
bool Builtin::Context::isLike(unsigned ID, unsigned &FormatIdx,
@@ -92,7 +92,7 @@ bool Builtin::Context::isLike(unsigned ID, unsigned &FormatIdx,
assert(::toupper(Fmt[0]) == Fmt[1] &&
"Format string is not in the form \"xX\"");
- const char *Like = ::strpbrk(GetRecord(ID).Attributes, Fmt);
+ const char *Like = ::strpbrk(getRecord(ID).Attributes, Fmt);
if (!Like)
return false;
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 1555d294a1..394d0d15b1 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -48,7 +48,7 @@ llvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
if (FD->hasAttr<AsmLabelAttr>())
Name = getMangledName(D);
else
- Name = Context.BuiltinInfo.GetName(BuiltinID) + 10;
+ Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
llvm::FunctionType *Ty =
cast<llvm::FunctionType>(getTypes().ConvertType(FD->getType()));
@@ -1778,7 +1778,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
return emitLibraryCall(*this, FD, E, EmitScalarExpr(E->getCallee()));
// See if we have a target specific intrinsic.
- const char *Name = getContext().BuiltinInfo.GetName(BuiltinID);
+ const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
if (const char *Prefix =
llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch())) {
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 8e5bc5d327..fe1f9bae78 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1439,7 +1439,7 @@ namespace {
unsigned BuiltinID = FD->getBuiltinID();
if (!BuiltinID || !BI.isLibFunction(BuiltinID))
return true;
- StringRef BuiltinName = BI.GetName(BuiltinID);
+ StringRef BuiltinName = BI.getName(BuiltinID);
if (BuiltinName.startswith("__builtin_") &&
Name == BuiltinName.slice(strlen("__builtin_"), StringRef::npos)) {
Result = true;
diff --git a/lib/Frontend/ChainedIncludesSource.cpp b/lib/Frontend/ChainedIncludesSource.cpp
index 5a5d2d55ed..d36162b8da 100644
--- a/lib/Frontend/ChainedIncludesSource.cpp
+++ b/lib/Frontend/ChainedIncludesSource.cpp
@@ -169,7 +169,7 @@ IntrusiveRefCntPtr<ExternalSemaSource> clang::createChainedIncludesSource(
if (firstInclude) {
Preprocessor &PP = Clang->getPreprocessor();
- PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(),
+ PP.getBuiltinInfo().initializeBuiltins(PP.getIdentifierTable(),
PP.getLangOpts());
} else {
assert(!SerialBufs.empty());
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 3e0f7a12c3..36135e816f 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -375,7 +375,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
if (CI.getLangOpts().Modules)
CI.createModuleManager();
- PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(),
+ PP.getBuiltinInfo().initializeBuiltins(PP.getIdentifierTable(),
PP.getLangOpts());
} else {
// FIXME: If this is a problem, recover from it by creating a multiplex
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index e2db638a33..29a00d3ca3 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -176,7 +176,7 @@ void Preprocessor::Initialize(const TargetInfo &Target) {
this->Target = &Target;
// Initialize information about built-ins.
- BuiltinInfo.InitializeTarget(Target);
+ BuiltinInfo.initializeTarget(Target);
HeaderInfo.setTarget(Target);
}
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index d9d26e2af6..e1656f2e89 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -2142,7 +2142,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
// Get the decl for the concrete builtin from this, we can tell what the
// concrete integer type we should convert to is.
unsigned NewBuiltinID = BuiltinIndices[BuiltinIndex][SizeIndex];
- const char *NewBuiltinName = Context.BuiltinInfo.GetName(NewBuiltinID);
+ const char *NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
FunctionDecl *NewBuiltinDecl;
if (NewBuiltinID == BuiltinID)
NewBuiltinDecl = FDecl;
@@ -4833,7 +4833,7 @@ static void emitReplacement(Sema &S, SourceLocation Loc, SourceRange Range,
}
}
} else {
- FunctionName = S.Context.BuiltinInfo.GetName(AbsKind);
+ FunctionName = S.Context.BuiltinInfo.getName(AbsKind);
HeaderName = S.Context.BuiltinInfo.getHeaderName(AbsKind);
if (HeaderName) {
@@ -4909,7 +4909,7 @@ void Sema::CheckAbsoluteValueFunction(const CallExpr *Call,
// function call.
if (ArgType->isUnsignedIntegerType()) {
const char *FunctionName =
- IsStdAbs ? "std::abs" : Context.BuiltinInfo.GetName(AbsKind);
+ IsStdAbs ? "std::abs" : Context.BuiltinInfo.getName(AbsKind);
Diag(Call->getExprLoc(), diag::warn_unsigned_abs) << ArgType << ParamType;
Diag(Call->getExprLoc(), diag::note_remove_abs)
<< FunctionName
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index d0d9516347..e25b160806 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1733,20 +1733,18 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
if (Error) {
if (ForRedeclaration)
Diag(Loc, diag::warn_implicit_decl_requires_sysheader)
- << getHeaderName(Error)
- << Context.BuiltinInfo.GetName(ID);
+ << getHeaderName(Error) << Context.BuiltinInfo.getName(ID);
return nullptr;
}
if (!ForRedeclaration && Context.BuiltinInfo.isPredefinedLibFunction(ID)) {
Diag(Loc, diag::ext_implicit_lib_function_decl)
- << Context.BuiltinInfo.GetName(ID)
- << R;
+ << Context.BuiltinInfo.getName(ID) << R;
if (Context.BuiltinInfo.getHeaderName(ID) &&
!Diags.isIgnored(diag::ext_implicit_lib_function_decl, Loc))
Diag(Loc, diag::note_include_header_or_declare)
<< Context.BuiltinInfo.getHeaderName(ID)
- << Context.BuiltinInfo.GetName(ID);
+ << Context.BuiltinInfo.getName(ID);
}
DeclContext *Parent = Context.getTranslationUnitDecl();
@@ -8290,7 +8288,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
if (!T.isNull() && !Context.hasSameType(T, NewFD->getType())) {
// The type of this function differs from the type of the builtin,
// so forget about the builtin entirely.
- Context.BuiltinInfo.ForgetBuiltin(BuiltinID, Context.Idents);
+ Context.BuiltinInfo.forgetBuiltin(BuiltinID, Context.Idents);
}
}
diff --git a/lib/StaticAnalyzer/Core/CheckerContext.cpp b/lib/StaticAnalyzer/Core/CheckerContext.cpp
index 6b22bf411c..37b2564a81 100644
--- a/lib/StaticAnalyzer/Core/CheckerContext.cpp
+++ b/lib/StaticAnalyzer/Core/CheckerContext.cpp
@@ -45,7 +45,7 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl *FD,
if (BId != 0) {
if (Name.empty())
return true;
- StringRef BName = FD->getASTContext().BuiltinInfo.GetName(BId);
+ StringRef BName = FD->getASTContext().BuiltinInfo.getName(BId);
if (BName.find(Name) != StringRef::npos)
return true;
}