]> granicus.if.org Git - clang/commit
Enforce safe usage of DiagnosticsEngine::getCustomDiagID()
authorAlp Toker <alp@nuanti.com>
Sun, 26 Jan 2014 06:17:37 +0000 (06:17 +0000)
committerAlp Toker <alp@nuanti.com>
Sun, 26 Jan 2014 06:17:37 +0000 (06:17 +0000)
commita2474459beca778d352a16e6463cf4dd9e29dc06
tree446314f9ee030469e4c144cec8db4f4ec51e279f
parentd6de61539c778f1d8449208c381234d13f7643cb
Enforce safe usage of DiagnosticsEngine::getCustomDiagID()

Replace the last incorrect uses and templatize the function to require a
compile-time constant string preventing further misuse.

The diagnostic formatter expects well-formed input and has undefined behaviour
with arbitrary input or crafted user strings in source files. Accepting user
input would also have caused unbounded generation of new diagnostic IDs which
can be problematic in long-running sessions or language bindings.

This completes the work to fix several incorrect callers that passed user
input or raw messages to the diagnostics engine where a constant format string
was expected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200132 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/Diagnostic.h
include/clang/Basic/DiagnosticIDs.h
lib/ARCMigrate/FileRemapper.cpp
lib/ARCMigrate/ObjCMT.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenPGO.cpp
lib/Lex/PTHLexer.cpp