aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2009-05-21 09:52:38 +0000
committerJay Foad <jay.foad@gmail.com>2009-05-21 09:52:38 +0000
commitbeaaccd8e2a8748f77b66e2b330fb9136937e14c (patch)
tree27f094096f297cc213a45db9a8b3a7413fd53396 /lib/Lex
parentecfbdcbaf71609ab99cdebbf2d704173070dbaf3 (diff)
Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/PPDirectives.cpp4
-rw-r--r--lib/Lex/PPMacroExpansion.cpp3
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index ca8693bf61..331424bdc8 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -1049,8 +1049,8 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok,
FilenameBuffer.push_back('<');
if (ConcatenateIncludeName(FilenameBuffer, *this))
return; // Found <eom> but no ">"? Diagnostic already emitted.
- FilenameStart = &FilenameBuffer[0];
- FilenameEnd = &FilenameBuffer[FilenameBuffer.size()];
+ FilenameStart = FilenameBuffer.data();
+ FilenameEnd = FilenameStart + FilenameBuffer.size();
break;
default:
Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 18dcfb25e7..55222c944a 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -439,7 +439,8 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
return 0;
}
- return MacroArgs::create(MI, &ArgTokens[0], ArgTokens.size(),isVarargsElided);
+ return MacroArgs::create(MI, ArgTokens.data(), ArgTokens.size(),
+ isVarargsElided);
}
/// ComputeDATE_TIME - Compute the current time, enter it into the specified