[cfe-commits] r91255 - /cfe/trunk/lib/CodeGen/CGRTTI.cpp
Anders Carlsson
andersca at mac.com
Sun Dec 13 15:47:29 PST 2009
Author: andersca
Date: Sun Dec 13 17:47:29 2009
New Revision: 91255
URL: http://llvm.org/viewvc/llvm-project?rev=91255&view=rev
Log:
Simplify BuildSimpleType in the RTTBuilder to avoid using an std::vector.
Modified:
cfe/trunk/lib/CodeGen/CGRTTI.cpp
Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=91255&r1=91254&r2=91255&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Sun Dec 13 17:47:29 2009
@@ -375,11 +375,6 @@
}
llvm::Constant *BuildSimpleType(QualType Ty, const char *vtbl) {
- std::vector<llvm::Constant *> info;
- assert(info.empty() && "Info vector must be empty!");
-
- llvm::Constant *C;
-
llvm::SmallString<256> OutName;
CGM.getMangleContext().mangleCXXRTTI(Ty, OutName);
llvm::StringRef Name = OutName.str();
@@ -392,13 +387,13 @@
bool Extern = DecideExtern(Ty);
bool Hidden = DecideHidden(Ty);
- C = BuildVtableRef(vtbl);
- info.push_back(C);
- info.push_back(BuildName(Ty, Hidden, Extern));
-
+ llvm::Constant *Info[] = {
+ BuildVtableRef(vtbl), BuildName(Ty, Hidden, Extern)
+ };
+
// We always generate these as hidden, only the name isn't hidden.
- return finish(&info[0], info.size(), GV, Name, /*Hidden=*/true,
- GetLinkageFromExternFlag(Extern));
+ return finish(&Info[0], llvm::array_lengthof(Info), GV, Name,
+ /*Hidden=*/true, GetLinkageFromExternFlag(Extern));
}
/// BuildType - Builds the type info for the given type.
More information about the cfe-commits
mailing list