[clang] cb89d37 - Revert "[clang] Allow printing 64 bit ints in diagnostics"
Arthur Eubanks via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 5 22:25:00 PDT 2021
Author: Arthur Eubanks
Date: 2021-10-05T22:24:16-07:00
New Revision: cb89d3739db746ea50eb50b7208e689126394391
URL: https://github.com/llvm/llvm-project/commit/cb89d3739db746ea50eb50b7208e689126394391
DIFF: https://github.com/llvm/llvm-project/commit/cb89d3739db746ea50eb50b7208e689126394391.diff
LOG: Revert "[clang] Allow printing 64 bit ints in diagnostics"
This reverts commit edfff2f8b0435bc4af94bd3b41bf57244d84d993.
Breaks clang-tidy.
Added:
Modified:
clang/include/clang/AST/Attr.h
clang/include/clang/AST/Decl.h
clang/include/clang/AST/NestedNameSpecifier.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/Diagnostic.h
clang/include/clang/Sema/ParsedAttr.h
clang/lib/Basic/Diagnostic.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index 6366d6e8837ef..651f98adc7330 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/include/clang/AST/Attr.h
@@ -374,7 +374,8 @@ struct ParsedTargetAttr {
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
const Attr *At) {
- DB.AddTaggedVal(reinterpret_cast<uint64_t>(At), DiagnosticsEngine::ak_attr);
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(At),
+ DiagnosticsEngine::ak_attr);
return DB;
}
} // end namespace clang
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index b46499203b0bc..d124ed282bb15 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -4589,7 +4589,7 @@ class EmptyDecl : public Decl {
/// into a diagnostic with <<.
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD,
const NamedDecl *ND) {
- PD.AddTaggedVal(reinterpret_cast<uint64_t>(ND),
+ PD.AddTaggedVal(reinterpret_cast<intptr_t>(ND),
DiagnosticsEngine::ak_nameddecl);
return PD;
}
diff --git a/clang/include/clang/AST/NestedNameSpecifier.h b/clang/include/clang/AST/NestedNameSpecifier.h
index eb01780598a7f..8bc3e25c0f4b3 100644
--- a/clang/include/clang/AST/NestedNameSpecifier.h
+++ b/clang/include/clang/AST/NestedNameSpecifier.h
@@ -521,7 +521,7 @@ class NestedNameSpecifierLocBuilder {
/// NestedNameSpecifiers into a diagnostic with <<.
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
NestedNameSpecifier *NNS) {
- DB.AddTaggedVal(reinterpret_cast<uint64_t>(NNS),
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS),
DiagnosticsEngine::ak_nestednamespec);
return DB;
}
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index f8c1fe91085f0..b8d72f904d0b6 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -7146,7 +7146,7 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD,
/// into a diagnostic with <<.
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD,
QualType T) {
- PD.AddTaggedVal(reinterpret_cast<uint64_t>(T.getAsOpaquePtr()),
+ PD.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
DiagnosticsEngine::ak_qualtype);
return PD;
}
diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h
index 5eb27964d6259..efb725845d3e8 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -164,9 +164,9 @@ struct DiagnosticStorage {
/// The values for the various substitution positions.
///
/// This is used when the argument is not an std::string. The specific value
- /// is mangled into an uint64_t and the interpretation depends on exactly
+ /// is mangled into an intptr_t and the interpretation depends on exactly
/// what sort of argument kind it is.
- uint64_t DiagArgumentsVal[MaxArguments];
+ intptr_t DiagArgumentsVal[MaxArguments];
/// The values for the various substitution positions that have
/// string arguments.
@@ -1179,7 +1179,7 @@ class StreamingDiagnostic {
DiagStorage = nullptr;
}
- void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const {
+ void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const {
if (!DiagStorage)
DiagStorage = getStorage();
@@ -1580,18 +1580,18 @@ class Diagnostic {
/// Return the specified signed integer argument.
/// \pre getArgKind(Idx) == DiagnosticsEngine::ak_sint
- int64_t getArgSInt(unsigned Idx) const {
+ int getArgSInt(unsigned Idx) const {
assert(getArgKind(Idx) == DiagnosticsEngine::ak_sint &&
"invalid argument accessor!");
- return (int64_t)DiagObj->DiagStorage.DiagArgumentsVal[Idx];
+ return (int)DiagObj->DiagStorage.DiagArgumentsVal[Idx];
}
/// Return the specified unsigned integer argument.
/// \pre getArgKind(Idx) == DiagnosticsEngine::ak_uint
- uint64_t getArgUInt(unsigned Idx) const {
+ unsigned getArgUInt(unsigned Idx) const {
assert(getArgKind(Idx) == DiagnosticsEngine::ak_uint &&
"invalid argument accessor!");
- return DiagObj->DiagStorage.DiagArgumentsVal[Idx];
+ return (unsigned)DiagObj->DiagStorage.DiagArgumentsVal[Idx];
}
/// Return the specified IdentifierInfo argument.
@@ -1605,7 +1605,7 @@ class Diagnostic {
/// Return the specified non-string argument in an opaque form.
/// \pre getArgKind(Idx) != DiagnosticsEngine::ak_std_string
- uint64_t getRawArg(unsigned Idx) const {
+ intptr_t getRawArg(unsigned Idx) const {
assert(getArgKind(Idx) != DiagnosticsEngine::ak_std_string &&
"invalid argument accessor!");
return DiagObj->DiagStorage.DiagArgumentsVal[Idx];
diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h
index 52b2c0d963fce..64a078866ca52 100644
--- a/clang/include/clang/Sema/ParsedAttr.h
+++ b/clang/include/clang/Sema/ParsedAttr.h
@@ -1119,14 +1119,14 @@ enum AttributeDeclKind {
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
const ParsedAttr &At) {
- DB.AddTaggedVal(reinterpret_cast<uint64_t>(At.getAttrName()),
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(At.getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return DB;
}
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
const ParsedAttr *At) {
- DB.AddTaggedVal(reinterpret_cast<uint64_t>(At->getAttrName()),
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(At->getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return DB;
}
@@ -1141,7 +1141,7 @@ template <typename ACI,
std::is_same<ACI, AttributeCommonInfo>::value, int> = 0>
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
const ACI &CI) {
- DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI.getAttrName()),
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(CI.getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return DB;
}
@@ -1151,7 +1151,7 @@ template <typename ACI,
std::is_same<ACI, AttributeCommonInfo>::value, int> = 0>
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
const ACI* CI) {
- DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI->getAttrName()),
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(CI->getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return DB;
}
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 9b7ad96b949f1..1b779afa0f310 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -932,7 +932,7 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
}
// ---- INTEGERS ----
case DiagnosticsEngine::ak_sint: {
- int64_t Val = getArgSInt(ArgNo);
+ int Val = getArgSInt(ArgNo);
if (ModifierIs(Modifier, ModifierLen, "select")) {
HandleSelectModifier(*this, (unsigned)Val, Argument, ArgumentLen,
@@ -951,7 +951,7 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
break;
}
case DiagnosticsEngine::ak_uint: {
- uint64_t Val = getArgUInt(ArgNo);
+ unsigned Val = getArgUInt(ArgNo);
if (ModifierIs(Modifier, ModifierLen, "select")) {
HandleSelectModifier(*this, Val, Argument, ArgumentLen, OutStr);
More information about the cfe-commits
mailing list