TargetInfo no longer includes a reference to SourceManager.
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:
FullLoc.getManager().someMethod(FullLoc.getLocation());
instead we have:
FullLoc.someMethod();
Modified TextDiagnostics (and related classes) to use this short-hand.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44957 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Lex/LiteralSupport.cpp b/Lex/LiteralSupport.cpp
index d00d9c3..0313823 100644
--- a/Lex/LiteralSupport.cpp
+++ b/Lex/LiteralSupport.cpp
@@ -93,8 +93,10 @@
}
// See if any bits will be truncated when evaluated as a character.
- unsigned CharWidth = IsWide ? PP.getTargetInfo().getWCharWidth(Loc)
- : PP.getTargetInfo().getCharWidth(Loc);
+ unsigned CharWidth = IsWide
+ ? PP.getTargetInfo().getWCharWidth(PP.getFullLoc(Loc))
+ : PP.getTargetInfo().getCharWidth(PP.getFullLoc(Loc));
+
if (CharWidth != 32 && (ResultChar >> CharWidth) != 0) {
Overflow = true;
ResultChar &= ~0U >> (32-CharWidth);
@@ -122,8 +124,10 @@
ThisTokBuf[0] >= '0' && ThisTokBuf[0] <= '7');
// Check for overflow. Reject '\777', but not L'\777'.
- unsigned CharWidth = IsWide ? PP.getTargetInfo().getWCharWidth(Loc)
- : PP.getTargetInfo().getCharWidth(Loc);
+ unsigned CharWidth = IsWide
+ ? PP.getTargetInfo().getWCharWidth(PP.getFullLoc(Loc))
+ : PP.getTargetInfo().getCharWidth(PP.getFullLoc(Loc));
+
if (CharWidth != 32 && (ResultChar >> CharWidth) != 0) {
PP.Diag(Loc, diag::warn_octal_escape_too_large);
ResultChar &= ~0U >> (32-CharWidth);
@@ -453,13 +457,13 @@
// FIXME: This assumes that 'int' is 32-bits in overflow calculation, and the
// size of "value".
- assert(PP.getTargetInfo().getIntWidth(Loc) == 32 &&
+ assert(PP.getTargetInfo().getIntWidth(PP.getFullLoc(Loc)) == 32 &&
"Assumes sizeof(int) == 4 for now");
// FIXME: This assumes that wchar_t is 32-bits for now.
- assert(PP.getTargetInfo().getWCharWidth(Loc) == 32 &&
+ assert(PP.getTargetInfo().getWCharWidth(PP.getFullLoc(Loc)) == 32 &&
"Assumes sizeof(wchar_t) == 4 for now");
// FIXME: This extensively assumes that 'char' is 8-bits.
- assert(PP.getTargetInfo().getCharWidth(Loc) == 8 &&
+ assert(PP.getTargetInfo().getCharWidth(PP.getFullLoc(Loc)) == 8 &&
"Assumes char is 8 bits");
bool isFirstChar = true;
@@ -505,7 +509,7 @@
// character constants are not sign extended in the this implementation:
// '\xFF\xFF' = 65536 and '\x0\xFF' = 255, which matches GCC.
if (!IsWide && !isMultiChar && (Value & 128) &&
- PP.getTargetInfo().isCharSigned(Loc))
+ PP.getTargetInfo().isCharSigned(PP.getFullLoc(Loc)))
Value = (signed char)Value;
}
@@ -583,7 +587,9 @@
// query the target. As such, wchar_tByteWidth is only valid if AnyWide=true.
wchar_tByteWidth = ~0U;
if (AnyWide) {
- wchar_tByteWidth = Target.getWCharWidth(StringToks[0].getLocation());
+ wchar_tByteWidth =
+ Target.getWCharWidth(PP.getFullLoc(StringToks[0].getLocation()));
+
assert((wchar_tByteWidth & 7) == 0 && "Assumes wchar_t is byte multiple!");
wchar_tByteWidth /= 8;
}